-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 게시판 생성 me 최신화 안됨 문제 및 디자인 개선 (#87)
- Loading branch information
1 parent
a102a88
commit d61a01e
Showing
4 changed files
with
34 additions
and
22 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,10 +1,21 @@ | ||
import { observer } from 'mobx-react-lite'; | ||
import { useEffect } from 'react'; | ||
import { Route } from 'react-router-dom'; | ||
|
||
import { useRootStore } from '@/stores/RootStore'; | ||
|
||
type Props = { | ||
children?: React.ReactNode; | ||
}; | ||
|
||
export const AuthRouter: React.FC<Props> = observer(({ children, ...rest }) => { | ||
const { | ||
auth: { fetch }, | ||
} = useRootStore(); | ||
|
||
useEffect(() => { | ||
fetch(); | ||
}, []); | ||
|
||
return <Route {...rest} render={() => children} />; | ||
}); |
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
27 changes: 19 additions & 8 deletions
27
src/pages/board/boardList/components/BoardCreateButton.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 |
---|---|---|
@@ -1,26 +1,37 @@ | ||
import styled from '@emotion/styled'; | ||
import AddBoxIcon from '@mui/icons-material/AddBox'; | ||
import PlaylistAddIcon from '@mui/icons-material/PlaylistAdd'; | ||
import { observer } from 'mobx-react-lite'; | ||
import { generatePath, useParams } from 'react-router-dom'; | ||
|
||
import { UniformLogo } from '@/assets'; | ||
import { ClearLink, RightButtonWrapper } from '@/components'; | ||
import { PAGE_URL, PostParams } from '@/configs/path'; | ||
import { usePageUiStore } from '@/hooks'; | ||
import { useRootStore } from '@/stores/RootStore'; | ||
|
||
export const BoardCreateButton: React.FC = observer(() => { | ||
const { | ||
auth: { me }, | ||
} = useRootStore(); | ||
|
||
return ( | ||
<Wrapper to={generatePath(PAGE_URL.BoardCreate)}> | ||
<Icon fontSize="large" /> | ||
</Wrapper> | ||
<> | ||
{me && (me.isAdmin || me.isCircleLeader || me.isPresident) ? ( | ||
<Wrapper to={generatePath(PAGE_URL.BoardCreate)}> | ||
<Icon fontSize="large" /> | ||
</Wrapper> | ||
) : ( | ||
<UniformLogo /> | ||
)} | ||
</> | ||
); | ||
}); | ||
|
||
const Wrapper = styled(ClearLink)` | ||
${RightButtonWrapper} | ||
`; | ||
|
||
const Icon = styled(AddBoxIcon)` | ||
const Icon = styled(PlaylistAddIcon)` | ||
position: absolute; | ||
top: 11px; | ||
right: 20px; | ||
top: 9px; | ||
right: 25px; | ||
`; |