Skip to content

Commit

Permalink
Posts structure comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rtrembecky committed Jan 3, 2024
1 parent 1113753 commit e78e05c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/components/Posts/Posts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,17 @@ export const Posts: FC = () => {
})
const posts = postsData?.data ?? []

const [activePostDetailIndex, setActivePostDetailIndex] = useState<number | undefined>(undefined)
const [activePostDetailIndex, setActivePostDetailIndex] = useState<number>()

if (postsIsLoading) return <Loading />

if (postsError) return <Typography>{postsError.message}</Typography>

return (
<>
{/* detail prispevku chceme zobrazit na urovni toho prispevku - `activePostDetailIndex` teda rozdeluje prispevky na dva gridy:
- prvy grid su vsetky prispevky do rozbaleneho prispevku - len jeden grid item ako jeden stlpec prispevkov (`xs={4}` ako 4 stlpce z 12)
- druhy grid su prispevky od rozbaleneho prispevku - dva grid itemy ako jeden stlpec prispevkov (`xs={4}`) a druhy stlpec ako detail prispevku (`xs={5}` - detail je sirsi) */}
{activePostDetailIndex !== 0 && (
<Grid container columnSpacing={5} mb={5}>
<Grid xs={4}>
Expand Down

0 comments on commit e78e05c

Please sign in to comment.