|
@@ -20,7 +20,8 @@ import {
|
|
Send,
|
|
Send,
|
|
ChatBubbleOutline,
|
|
ChatBubbleOutline,
|
|
TurnedInNot,
|
|
TurnedInNot,
|
|
- AccountCircle
|
|
|
|
|
|
+ AccountCircle,
|
|
|
|
+ AddComment
|
|
} from '@mui/icons-material/'
|
|
} from '@mui/icons-material/'
|
|
import Grid from '@mui/material/Unstable_Grid2';
|
|
import Grid from '@mui/material/Unstable_Grid2';
|
|
|
|
|
|
@@ -45,6 +46,10 @@ export function CardPost({ postData }) {
|
|
history.push(`/user/${postData?.owner?._id}`)
|
|
history.push(`/user/${postData?.owner?._id}`)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ function AddCommentFocus() {
|
|
|
|
+ document.getElementById('addCommentField').focus()
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
return (
|
|
return (
|
|
<Card
|
|
<Card
|
|
@@ -59,9 +64,7 @@ export function CardPost({ postData }) {
|
|
avatar={
|
|
avatar={
|
|
<Avatar
|
|
<Avatar
|
|
alt={postData?.owner?.login}
|
|
alt={postData?.owner?.login}
|
|
-
|
|
|
|
src={(url + postData?.owner?.avatar?.url)}
|
|
src={(url + postData?.owner?.avatar?.url)}
|
|
-
|
|
|
|
sx={{
|
|
sx={{
|
|
width: 50,
|
|
width: 50,
|
|
height: 50
|
|
height: 50
|
|
@@ -74,7 +77,6 @@ export function CardPost({ postData }) {
|
|
sx={{
|
|
sx={{
|
|
cursor: 'pointer'
|
|
cursor: 'pointer'
|
|
}}
|
|
}}
|
|
-
|
|
|
|
onClick={toAccount}
|
|
onClick={toAccount}
|
|
>
|
|
>
|
|
{postData?.owner?.login}
|
|
{postData?.owner?.login}
|
|
@@ -91,17 +93,12 @@ export function CardPost({ postData }) {
|
|
|
|
|
|
sx={{
|
|
sx={{
|
|
flex: '0 0 450px',
|
|
flex: '0 0 450px',
|
|
- overflowY: 'auto'
|
|
|
|
|
|
+ overflowY: 'auto',
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
<Grid
|
|
<Grid
|
|
container
|
|
container
|
|
-
|
|
|
|
spacing={2}
|
|
spacing={2}
|
|
-
|
|
|
|
- sx={{
|
|
|
|
- marginBottom: '20px'
|
|
|
|
- }}
|
|
|
|
>
|
|
>
|
|
<Grid
|
|
<Grid
|
|
xs={2}
|
|
xs={2}
|
|
@@ -112,9 +109,7 @@ export function CardPost({ postData }) {
|
|
>
|
|
>
|
|
<Avatar
|
|
<Avatar
|
|
alt={postData?.owner?.login}
|
|
alt={postData?.owner?.login}
|
|
-
|
|
|
|
src={(url + postData?.owner?.avatar?.url)}
|
|
src={(url + postData?.owner?.avatar?.url)}
|
|
-
|
|
|
|
sx={{
|
|
sx={{
|
|
width: 40,
|
|
width: 40,
|
|
height: 40
|
|
height: 40
|
|
@@ -127,15 +122,24 @@ export function CardPost({ postData }) {
|
|
>
|
|
>
|
|
<Typography
|
|
<Typography
|
|
variant="subtitle2"
|
|
variant="subtitle2"
|
|
|
|
+ color="text.secondary"
|
|
|
|
+ sx={{
|
|
|
|
+ cursor: 'pointer'
|
|
|
|
+ }}
|
|
|
|
+ onClick={toAccount}
|
|
|
|
+ >
|
|
|
|
+ {postData?.owner?.login}
|
|
|
|
+ </Typography>
|
|
|
|
|
|
|
|
+ <Typography
|
|
|
|
+ variant="subtitle2"
|
|
color="text.secondary"
|
|
color="text.secondary"
|
|
>
|
|
>
|
|
- {postData?.owner?.login} {postData?.title}
|
|
|
|
|
|
+ {postData?.title}
|
|
</Typography>
|
|
</Typography>
|
|
|
|
|
|
<Typography
|
|
<Typography
|
|
variant="body2"
|
|
variant="body2"
|
|
-
|
|
|
|
color="text.secondary"
|
|
color="text.secondary"
|
|
>
|
|
>
|
|
{postData?.text}
|
|
{postData?.text}
|
|
@@ -144,7 +148,7 @@ export function CardPost({ postData }) {
|
|
</Grid>
|
|
</Grid>
|
|
|
|
|
|
<Grid>
|
|
<Grid>
|
|
- <Comments />
|
|
|
|
|
|
+ <Comments data={postData?.comments} />
|
|
</Grid>
|
|
</Grid>
|
|
</CardContent>
|
|
</CardContent>
|
|
|
|
|
|
@@ -160,41 +164,30 @@ export function CardPost({ postData }) {
|
|
>
|
|
>
|
|
<Grid
|
|
<Grid
|
|
xs={12}
|
|
xs={12}
|
|
-
|
|
|
|
container
|
|
container
|
|
-
|
|
|
|
justifyContent="space-between"
|
|
justifyContent="space-between"
|
|
-
|
|
|
|
alignItems="center"
|
|
alignItems="center"
|
|
-
|
|
|
|
- flexDirection={{
|
|
|
|
- xs: 'column',
|
|
|
|
- sm: 'row'
|
|
|
|
- }}
|
|
|
|
-
|
|
|
|
sx={{
|
|
sx={{
|
|
fontSize: '12px'
|
|
fontSize: '12px'
|
|
}}
|
|
}}
|
|
>
|
|
>
|
|
<Grid
|
|
<Grid
|
|
container
|
|
container
|
|
-
|
|
|
|
columnSpacing={1}
|
|
columnSpacing={1}
|
|
-
|
|
|
|
- sx={{
|
|
|
|
- order: { xs: 2, sm: 1 }
|
|
|
|
- }}
|
|
|
|
>
|
|
>
|
|
<Grid>
|
|
<Grid>
|
|
<IconButton
|
|
<IconButton
|
|
aria-label="add to favorites"
|
|
aria-label="add to favorites"
|
|
|
|
+ onClick={() => (console.log('click like main post'))}
|
|
>
|
|
>
|
|
<FavoriteBorderRounded />
|
|
<FavoriteBorderRounded />
|
|
</IconButton>
|
|
</IconButton>
|
|
</Grid>
|
|
</Grid>
|
|
|
|
|
|
<Grid>
|
|
<Grid>
|
|
- <IconButton>
|
|
|
|
|
|
+ <IconButton
|
|
|
|
+ onClick={AddCommentFocus}
|
|
|
|
+ >
|
|
<ChatBubbleOutline />
|
|
<ChatBubbleOutline />
|
|
</IconButton>
|
|
</IconButton>
|
|
</Grid>
|
|
</Grid>
|
|
@@ -246,10 +239,8 @@ export function CardPost({ postData }) {
|
|
/>
|
|
/>
|
|
|
|
|
|
<TextField
|
|
<TextField
|
|
- id="input-with-sx"
|
|
|
|
-
|
|
|
|
|
|
+ id="addCommentField"
|
|
label="Add comment..."
|
|
label="Add comment..."
|
|
-
|
|
|
|
variant="standard"
|
|
variant="standard"
|
|
/>
|
|
/>
|
|
|
|
|