Skip to content

Commit

Permalink
feat: post share button on card
Browse files Browse the repository at this point in the history
  • Loading branch information
warmachine028 committed Nov 28, 2024
1 parent 867059c commit 175607f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
13 changes: 8 additions & 5 deletions client/src/components/ReactButton.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useState, useRef } from 'react'
import { IconButton, Popover, Typography, Box } from '@mui/material'
import { IconButton, Popover, Typography, Box, Stack } from '@mui/material'
import {
ThumbUp,
Favorite,
Expand All @@ -21,7 +21,7 @@ const reactions = [
{ icon: SentimentDissatisfied, label: 'ANGRY', color: '#ff5722' }
]

export default function ReactButton({ post }) {
const ReactButton = ({ post }) => {
const { user } = useUser()
const { mutate: reactPost } = useReactPost()
const [reactionAnchorEl, setReactionAnchorEl] = useState(null)
Expand Down Expand Up @@ -60,10 +60,11 @@ export default function ReactButton({ post }) {
}

return (
<Box
<Stack
onMouseEnter={handleReactionIconEnter}
onMouseLeave={handleReactionIconLeave}
sx={{ display: 'flex', alignItems: 'center' }}
alignItems="center"
direction="row"
>
<IconButton
size="small"
Expand Down Expand Up @@ -118,6 +119,8 @@ export default function ReactButton({ post }) {
</IconButton>
))}
</Popover>
</Box>
</Stack>
)
}

export default ReactButton
4 changes: 1 addition & 3 deletions client/src/hooks/posts.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,7 @@ import {
deletePost,
getPost,
getPosts,
reactPost,
searchPosts,
unreactPost,
updatePost
} from '@/api'
import {
Expand All @@ -23,7 +21,7 @@ export const useGetPosts = () => {

const query = useInfiniteQuery({
queryKey: ['posts'],
queryFn: ({ pageParam }) => getPosts(pageParam, 10),
queryFn: ({ pageParam }) => getPosts(pageParam, 6),
getNextPageParam: (lastPage) => lastPage.nextCursor
})

Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/Posts.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ const Posts = () => {
container
size={{ xs: 12, md: 8, xl: 9 }}
overflow="auto"
height={'calc(100vh - 150px)'}
height={'calc(100vh - 190px)'}
sx={{
'&::-webkit-scrollbar': { display: 'none' },
scrollbarWidth: 'none',
Expand Down

0 comments on commit 175607f

Please sign in to comment.