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