-
Notifications
You must be signed in to change notification settings - Fork 0
관리자 권한 판별 라우터, 사이드바 레이아웃 (#issue 317) #319
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from 3 commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
40 changes: 40 additions & 0 deletions
40
src/components/common/admin/sidebar/AdminSidebar.styled.ts
This file contains hidden or 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,40 @@ | ||
| import styled from 'styled-components'; | ||
|
|
||
| export const SidebarContainer = styled.section` | ||
| padding: 1rem; | ||
| width: 15rem; | ||
| `; | ||
|
|
||
| export const SidebarLogoWrapper = styled.div` | ||
| display: flex; | ||
| justify-content: space-around; | ||
| align-items: flex-end; | ||
| margin: 0 1.5rem 1.5rem 0; | ||
| `; | ||
|
|
||
| export const SidebarLogoImg = styled.img` | ||
| width: 5rem; | ||
| `; | ||
|
|
||
| export const LogoutButton = styled.button` | ||
| display: flex; | ||
| flex-direction: column; | ||
| margin-bottom: 0.3rem; | ||
| `; | ||
|
|
||
| export const LogoutImg = styled.img` | ||
| width: 2rem; | ||
| filter: invert(70%); | ||
| `; | ||
|
|
||
| export const LogoutSpan = styled.span` | ||
| font-size: 0.5rem; | ||
| color: ${({ theme }) => theme.color.deepGrey}; | ||
| margin-left: -7px; | ||
| `; | ||
|
|
||
| export const MovedListContainerAll = styled.nav` | ||
| margin-top: 1.5rem; | ||
| display: grid; | ||
| gap: 1.5rem; | ||
| `; |
This file contains hidden or 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,29 @@ | ||
| import { SIDEBAR_LIST } from '../../../../constants/admin/sidebar'; | ||
| import * as S from './AdminSidebar.styled'; | ||
| import logo from '../../../../assets/mainlogo.svg'; | ||
| import logoutIcon from '../../../../assets/logout.svg'; | ||
| import AdminSidebarList from './sidebarList/AdminSidebarList'; | ||
| import ContentBorder from '../../contentBorder/ContentBorder'; | ||
| import useAuthStore from '../../../../store/authStore'; | ||
|
|
||
| export default function AdminSidebar() { | ||
| const logout = useAuthStore((state) => state.logout); | ||
|
|
||
| return ( | ||
| <S.SidebarContainer> | ||
| <S.SidebarLogoWrapper> | ||
| <S.SidebarLogoImg src={logo} alt='logo' /> | ||
| <S.LogoutButton type='button' onClick={logout}> | ||
| <S.LogoutImg src={logoutIcon} alt='logout icon' /> | ||
| <S.LogoutSpan>Logout</S.LogoutSpan> | ||
| </S.LogoutButton> | ||
|
||
| </S.SidebarLogoWrapper> | ||
| <ContentBorder /> | ||
| <S.MovedListContainerAll> | ||
| <AdminSidebarList title='' list={SIDEBAR_LIST.main} /> | ||
| <AdminSidebarList title='서비스 관리' list={SIDEBAR_LIST.service} /> | ||
| <AdminSidebarList title='사용자 관리' list={SIDEBAR_LIST.user} /> | ||
| </S.MovedListContainerAll> | ||
| </S.SidebarContainer> | ||
| ); | ||
| } | ||
35 changes: 35 additions & 0 deletions
35
src/components/common/admin/sidebar/sidebarList/AdminSidebarList.styled.ts
This file contains hidden or 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,35 @@ | ||
| import { Link } from 'react-router-dom'; | ||
| import styled from 'styled-components'; | ||
|
|
||
| export const MovedListContainer = styled.nav``; | ||
|
|
||
| export const MovedListLink = styled(Link)` | ||
| display: flex; | ||
| align-items: center; | ||
| gap: 1rem; | ||
| padding: 0.8rem; | ||
|
|
||
| &:hover { | ||
| color: ${({ theme }) => theme.color.deepGrey}; | ||
| } | ||
| `; | ||
|
|
||
| export const MovedListIcon = styled.div` | ||
| display: flex; | ||
| align-items: center; | ||
|
|
||
| svg { | ||
| width: 1.5rem; | ||
| } | ||
| `; | ||
|
|
||
| export const MovedList = styled.div` | ||
| font-size: 1.2rem; | ||
| `; | ||
|
|
||
| export const MovedListTitleWrapper = styled.div``; | ||
|
|
||
| export const MovedListTitle = styled.h3` | ||
| padding: 0.5rem; | ||
| color: ${({ theme }) => theme.color.deepGrey}; | ||
| `; |
54 changes: 54 additions & 0 deletions
54
src/components/common/admin/sidebar/sidebarList/AdminSidebarList.tsx
This file contains hidden or 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,54 @@ | ||
| import * as S from './AdminSidebarList.styled'; | ||
| import { | ||
| ArrowRightStartOnRectangleIcon, | ||
| ChatBubbleBottomCenterTextIcon, | ||
| EnvelopeIcon, | ||
| ExclamationTriangleIcon, | ||
| HomeIcon, | ||
| MegaphoneIcon, | ||
| PhotoIcon, | ||
| TagIcon, | ||
| UserGroupIcon, | ||
| } from '@heroicons/react/24/outline'; | ||
|
|
||
| const iconMap = { | ||
| mainPage: <HomeIcon />, | ||
| movedSite: <ArrowRightStartOnRectangleIcon />, | ||
| notice: <MegaphoneIcon />, | ||
| banner: <PhotoIcon />, | ||
| tags: <TagIcon />, | ||
| allUser: <UserGroupIcon />, | ||
| reports: <ExclamationTriangleIcon />, | ||
| inquiries: <EnvelopeIcon />, | ||
| manage: <ChatBubbleBottomCenterTextIcon />, | ||
| }; | ||
|
|
||
| type IconKey = keyof typeof iconMap; | ||
|
|
||
| interface AdminSidebarListProps { | ||
| title: string; | ||
| list: readonly { name: IconKey; title: string; router: string }[]; | ||
| } | ||
|
|
||
| export default function AdminSidebarList({ | ||
| title, | ||
| list, | ||
| }: AdminSidebarListProps) { | ||
| return ( | ||
| <S.MovedListContainer> | ||
| <S.MovedListTitleWrapper> | ||
| {title && <S.MovedListTitle>{title}</S.MovedListTitle>} | ||
| </S.MovedListTitleWrapper> | ||
| {list.map((item) => ( | ||
| <S.MovedListLink | ||
| to={item.router} | ||
| target={item.name.includes('movedSite') ? '_blank' : '_self'} | ||
| key={item.name} | ||
| > | ||
| <S.MovedListIcon>{iconMap[item.name]}</S.MovedListIcon> | ||
| <S.MovedList>{item.title}</S.MovedList> | ||
| </S.MovedListLink> | ||
| ))} | ||
| </S.MovedListContainer> | ||
| ); | ||
| } |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
2 changes: 1 addition & 1 deletion
2
src/components/user/customerService/noticeDetail/bottom/button/ListButton.tsx
This file contains hidden or 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
2 changes: 1 addition & 1 deletion
2
src/components/user/customerService/noticeDetail/bottom/button/OtherNoticeButton.tsx
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
2 changes: 1 addition & 1 deletion
2
src/components/user/userPage/userProjectList/UserProjectList.tsx
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🛠️ Refactor suggestion
접근성 개선을 위한 속성 추가가 필요합니다.
로그아웃 버튼과 이미지에 적절한 접근성 속성이 누락되어 있습니다.
다음과 같이 접근성 속성을 추가하세요:
<S.SidebarLogoImg src={logo} alt='logo' /> - <S.LogoutButton type='button' onClick={logout}> + <S.LogoutButton + type='button' + onClick={logout} + aria-label='관리자 로그아웃' + title='로그아웃' + > - <S.LogoutImg src={logoutIcon} alt='logout icon' /> + <S.LogoutImg src={logoutIcon} alt='' role='presentation' /> <S.LogoutSpan>Logout</S.LogoutSpan> </S.LogoutButton>📝 Committable suggestion
🤖 Prompt for AI Agents