-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
94 additions
and
5 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
src/app/(menu)/_components/menu/elements/MobileOpenPostDialogButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
'use client'; | ||
|
||
import { IconButton } from '@/app/_components/button/IconButton'; | ||
import PostDialog from '@/app/_components/post/PostDialog'; | ||
import { useProfile } from '@/swr/client/auth'; | ||
import { Send } from '@mui/icons-material'; | ||
import { Box, styled } from '@mui/material'; | ||
import { usePathname } from 'next/navigation'; | ||
import { useState } from 'react'; | ||
|
||
const StyledButton = styled(IconButton)` | ||
position: fixed; | ||
bottom: calc( | ||
${({ theme }) => theme.mixins.bottomMenu.height}px + | ||
env(safe-area-inset-bottom) + 1rem | ||
); | ||
right: 1rem; | ||
height: auto; | ||
width: 3.5rem; | ||
aspect-ratio: 1 / 1; | ||
> svg { | ||
width: 2rem; | ||
height: auto; | ||
} | ||
${({ theme }) => theme.breakpoints.up('tablet')} { | ||
display: none; | ||
} | ||
/* FIXME: IconButtonのvariant=containedで色つかない問題が解消したら消す */ | ||
color: white; | ||
background-color: #007bbb; | ||
:hover { | ||
background-color: #007bbb; | ||
} | ||
`; | ||
|
||
export default function MobileOpenPostDialogButton() { | ||
const [getOpenDialog, setOpenDialog] = useState(false); | ||
|
||
const renderablePaths = ['/home', '/search', '/notifications']; | ||
const renderable = renderablePaths.includes(usePathname() as string); | ||
const { data: profile } = useProfile(); | ||
|
||
return ( | ||
<> | ||
{profile && renderable && ( | ||
<Box> | ||
<StyledButton | ||
variant="contained" | ||
color="primary" | ||
onClick={() => setOpenDialog(true)} | ||
> | ||
<Send /> | ||
</StyledButton> | ||
|
||
<PostDialog | ||
fullScreen | ||
open={getOpenDialog} | ||
close={() => setOpenDialog(false)} | ||
/> | ||
</Box> | ||
)} | ||
</> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters