Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

35_b_post info #40

Merged
merged 3 commits into from
Nov 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions src/components/PostInfo/PostInfo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react';
import Avatar from '@mui/material/Avatar';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';

interface PostINfoProps {
userName: string;
description: string;
data: string;
image: string;
}

const PostInfo: React.FC<PostINfoProps> = ({ image, userName, description, data }) => {
return (
<>
<Box sx={{
display: "flex",
flexDirection: "row",
alignItems: "center"
}}>
<Avatar alt="Remy Sharp" src={image} sx={{ height: '60px', width: '60px' }} />
<Typography variant="h4" sx={{fontSize: "18px", width: "90%"}} align="center">{userName}</Typography>
</Box>
<Typography variant="body1" sx={{fontSize: "13px", marginTop: "10px"}}>{description}</Typography>
<Typography variant="body1" sx={{fontSize: "13px", marginTop: "15px"}}>###{data}</Typography>
</>
)
}

export default PostInfo;
1 change: 1 addition & 0 deletions src/components/PostInfo/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export {default} from './PostInfo'
Binary file added src/images/morty.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions src/pages/Home.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import Stack from '@mui/material/Stack';
import PostInfo from 'components/PostInfo';

const Home = () => {
return (
Expand All @@ -9,6 +10,7 @@ const Home = () => {
</Stack>
<Stack width="300px">
{/* All Sidebar related things go here */}
<PostInfo userName="Manuel XXX" description="askdaklsdjawdadsfdsvgbftnrt"/>
Sidebar
</Stack>
</Stack>
Expand Down
2 changes: 1 addition & 1 deletion src/utils/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ export const getUserId = () => {
const serializedUser = localStorage.getItem('user');
const user = JSON.parse(serializedUser);

return user.id;
return user?.id;
};