mirror of
https://github.com/bubblecup-12/VogelSocialMedia.git
synced 2025-07-06 15:18:48 +00:00
save
This commit is contained in:
parent
6f0f3580fa
commit
d0d591021e
4 changed files with 177 additions and 278 deletions
|
@ -1,61 +1,108 @@
|
|||
import React, { useState } from 'react';
|
||||
import './post.css';
|
||||
import * as React from 'react';
|
||||
import { styled } from '@mui/material/styles';
|
||||
import Card from '@mui/material/Card';
|
||||
import CardHeader from '@mui/material/CardHeader';
|
||||
import CardMedia from '@mui/material/CardMedia';
|
||||
import CardContent from '@mui/material/CardContent';
|
||||
import CardActions from '@mui/material/CardActions';
|
||||
import Collapse from '@mui/material/Collapse';
|
||||
import Avatar from '@mui/material/Avatar';
|
||||
import IconButton, { IconButtonProps } from '@mui/material/IconButton';
|
||||
import Typography from '@mui/material/Typography';
|
||||
import { red } from '@mui/material/colors';
|
||||
import FavoriteIcon from '@mui/icons-material/Favorite';
|
||||
import ShareIcon from '@mui/icons-material/Share';
|
||||
import ExpandMoreIcon from '@mui/icons-material/ExpandMore';
|
||||
import MoreVertIcon from '@mui/icons-material/MoreVert';
|
||||
|
||||
interface ExpandMoreProps extends IconButtonProps {
|
||||
expand: boolean;
|
||||
}
|
||||
|
||||
const ExpandMore = styled((props: ExpandMoreProps) => {
|
||||
const { expand, ...other } = props;
|
||||
return <IconButton {...other} />;
|
||||
})(({ theme }) => ({
|
||||
marginLeft: 'auto',
|
||||
transition: theme.transitions.create('transform', {
|
||||
duration: theme.transitions.duration.shortest,
|
||||
}),
|
||||
variants: [
|
||||
{
|
||||
props: ({ expand }) => !expand,
|
||||
style: {
|
||||
transform: 'rotate(0deg)',
|
||||
},
|
||||
},
|
||||
{
|
||||
props: ({ expand }) => !!expand,
|
||||
style: {
|
||||
transform: 'rotate(180deg)',
|
||||
},
|
||||
},
|
||||
],
|
||||
}));
|
||||
|
||||
export default function Post() {
|
||||
const [expanded, setExpanded] = useState(false);
|
||||
const [expanded, setExpanded] = React.useState(false);
|
||||
|
||||
const handleExpandClick = () => {
|
||||
setExpanded(!expanded);
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="post-card">
|
||||
<div className="post-header">
|
||||
<div className="avatar">R</div>
|
||||
<div className="post-header-text">
|
||||
<h3>Shrimp and Chorizo Paella</h3>
|
||||
<p className="subheader">September 14, 2016</p>
|
||||
</div>
|
||||
<button className="icon-button more-button" aria-label="settings">
|
||||
⋮
|
||||
</button>
|
||||
</div>
|
||||
<img
|
||||
className="post-image"
|
||||
src="/static/images/cards/paella.jpg"
|
||||
<Card sx={{ maxWidth: 345 }}>
|
||||
<CardHeader
|
||||
avatar={
|
||||
<Avatar sx={{ bgcolor: red[500] }} aria-label="recipe">
|
||||
R
|
||||
</Avatar>
|
||||
}
|
||||
action={
|
||||
<IconButton aria-label="settings">
|
||||
<MoreVertIcon />
|
||||
</IconButton>
|
||||
}
|
||||
title="Shrimp and Chorizo Paella"
|
||||
subheader="September 14, 2016"
|
||||
/>
|
||||
<CardMedia
|
||||
component="img"
|
||||
height="194"
|
||||
image="/static/images/cards/paella.jpg"
|
||||
alt="Paella dish"
|
||||
/>
|
||||
<div className="post-content">
|
||||
<p>
|
||||
<CardContent>
|
||||
<Typography variant="body2" sx={{ color: 'text.secondary' }}>
|
||||
This impressive paella is a perfect party dish and a fun meal to cook
|
||||
together with your guests. Add 1 cup of frozen peas along with the mussels,
|
||||
if you like.
|
||||
</p>
|
||||
</div>
|
||||
<div className="post-actions">
|
||||
<button className="icon-button" aria-label="add to favorites">
|
||||
<i className="fa fa-heart"></i>
|
||||
</button>
|
||||
<button className="icon-button" aria-label="share">
|
||||
<i className="fa fa-share"></i>
|
||||
</button>
|
||||
<button
|
||||
className={`icon-button expand-button ${expanded ? 'expanded' : ''}`}
|
||||
</Typography>
|
||||
</CardContent>
|
||||
<CardActions disableSpacing>
|
||||
<IconButton aria-label="add to favorites">
|
||||
<FavoriteIcon />
|
||||
</IconButton>
|
||||
<IconButton aria-label="share">
|
||||
<ShareIcon />
|
||||
</IconButton>
|
||||
<ExpandMore
|
||||
expand={expanded}
|
||||
onClick={handleExpandClick}
|
||||
aria-expanded={expanded}
|
||||
aria-label="show more"
|
||||
>
|
||||
<i className="fa fa-chevron-down"></i>
|
||||
</button>
|
||||
</div>
|
||||
{expanded && (
|
||||
<div className="post-collapse">
|
||||
<h4>Method:</h4>
|
||||
<p>
|
||||
<ExpandMoreIcon />
|
||||
</ExpandMore>
|
||||
</CardActions>
|
||||
<Collapse in={expanded} timeout="auto" unmountOnExit>
|
||||
<CardContent>
|
||||
<Typography sx={{ marginBottom: 2 }}>Method:</Typography>
|
||||
<Typography sx={{ marginBottom: 2 }}>
|
||||
Heat 1/2 cup of the broth in a pot until simmering, add saffron and set
|
||||
aside for 10 minutes.
|
||||
</p>
|
||||
<p>
|
||||
</Typography>
|
||||
<Typography sx={{ marginBottom: 2 }}>
|
||||
Heat oil in a (14- to 16-inch) paella pan or a large, deep skillet over
|
||||
medium-high heat. Add chicken, shrimp and chorizo, and cook, stirring
|
||||
occasionally until lightly browned, 6 to 8 minutes. Transfer shrimp to a
|
||||
|
@ -63,20 +110,20 @@ export default function Post() {
|
|||
pimentón, bay leaves, garlic, tomatoes, onion, salt and pepper, and cook,
|
||||
stirring often until thickened and fragrant, about 10 minutes. Add
|
||||
saffron broth and remaining 4 1/2 cups chicken broth; bring to a boil.
|
||||
</p>
|
||||
<p>
|
||||
</Typography>
|
||||
<Typography sx={{ marginBottom: 2 }}>
|
||||
Add rice and stir very gently to distribute. Top with artichokes and
|
||||
peppers, and cook without stirring, until most of the liquid is absorbed,
|
||||
15 to 18 minutes. Reduce heat to medium-low, add reserved shrimp and
|
||||
mussels, tucking them down into the rice, and cook again without
|
||||
stirring, until mussels have opened and rice is just tender, 5 to 7
|
||||
minutes more. (Discard any mussels that don't open.)
|
||||
</p>
|
||||
<p>
|
||||
minutes more. (Discard any mussels that don't open.)
|
||||
</Typography>
|
||||
<Typography>
|
||||
Set aside off of the heat to let rest for 10 minutes, and then serve.
|
||||
</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</Typography>
|
||||
</CardContent>
|
||||
</Collapse>
|
||||
</Card>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -49,8 +49,9 @@ function Feed() {
|
|||
|
||||
return (
|
||||
<div className="feedContainer">
|
||||
|
||||
<main className="feedContent" ref={feedRef}>^
|
||||
<Post/>
|
||||
<main className="feedContent" ref={feedRef}>
|
||||
{posts.map((postId, idx) => (
|
||||
<TestPost key={idx} postId={postId} />
|
||||
))}
|
||||
|
|
|
@ -1,107 +0,0 @@
|
|||
.post-card {
|
||||
max-width: 345px;
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 8px;
|
||||
overflow: hidden;
|
||||
font-family: sans-serif;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.post-header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 16px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.avatar {
|
||||
background-color: #f44336;
|
||||
color: #fff;
|
||||
border-radius: 50%;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
font-weight: bold;
|
||||
margin-right: 12px;
|
||||
}
|
||||
|
||||
.post-header-text h3 {
|
||||
margin: 0;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.subheader {
|
||||
color: #888;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
.more-button {
|
||||
position: absolute;
|
||||
right: 16px;
|
||||
top: 16px;
|
||||
font-size: 1.2rem;
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.post-image {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
max-height: 194px;
|
||||
object-fit: cover;
|
||||
}
|
||||
|
||||
.post-content {
|
||||
padding: 16px;
|
||||
color: #444;
|
||||
font-size: 0.95rem;
|
||||
}
|
||||
|
||||
.post-actions {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 8px 16px;
|
||||
border-top: 1px solid #eee;
|
||||
}
|
||||
|
||||
.icon-button {
|
||||
background: none;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: 1.1rem;
|
||||
margin-right: 10px;
|
||||
color: #555;
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
|
||||
.icon-button:hover {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.expand-button {
|
||||
margin-left: auto;
|
||||
transition: transform 0.3s ease;
|
||||
}
|
||||
|
||||
.expand-button.expanded {
|
||||
transform: rotate(180deg);
|
||||
}
|
||||
|
||||
.post-collapse {
|
||||
padding: 0 16px 16px;
|
||||
border-top: 1px solid #eee;
|
||||
}
|
||||
|
||||
.post-collapse h4 {
|
||||
margin: 16px 0 8px;
|
||||
}
|
||||
|
||||
.post-collapse p {
|
||||
margin: 0 0 12px;
|
||||
font-size: 0.95rem;
|
||||
color: #444;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue