-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #404 from Bamdoliro/develop
어드민
- Loading branch information
Showing
18 changed files
with
425 additions
and
31 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
59 changes: 59 additions & 0 deletions
59
apps/admin/src/components/common/ButtonMenu/ButtonMenu.stories.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,59 @@ | ||
import { IconCheckDocument, IconEditDocument, IconPrint, IconUpload } from "@maru/icon"; | ||
import { color } from "@maru/theme"; | ||
import { Text } from "@maru/ui"; | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import ButtonMenu from "./ButtonMenu"; | ||
import ButtonMenuItem from "./ButtonMenuItem/ButtonMenuItem"; | ||
|
||
export default { | ||
component: ButtonMenu, | ||
title: "ButtonMenu", | ||
tags: ["autodocs"], | ||
} satisfies Meta<typeof ButtonMenu>; | ||
|
||
export const Default: StoryObj<typeof ButtonMenu> = { | ||
args: { | ||
menuItemList: [ | ||
<ButtonMenuItem> | ||
<IconCheckDocument | ||
color={color.gray600} | ||
width={24} | ||
height={24} | ||
/> | ||
<Text fontType="p2" color={color.gray900}> | ||
검토해야 하는 원서 모아보기 | ||
</Text> | ||
</ButtonMenuItem>, | ||
<ButtonMenuItem> | ||
<IconEditDocument | ||
color={color.gray600} | ||
width={24} | ||
height={24} | ||
/> | ||
<Text fontType="p2" color={color.gray900}> | ||
2차 전형 점수 입력하기 | ||
</Text> | ||
</ButtonMenuItem>, | ||
<ButtonMenuItem> | ||
<IconUpload | ||
color={color.gray600} | ||
width={24} | ||
height={24} | ||
/> | ||
<Text fontType="p2" color={color.gray900}> | ||
명단 엑셀로 내보내기 | ||
</Text> | ||
</ButtonMenuItem>, | ||
<ButtonMenuItem> | ||
<IconPrint | ||
color={color.gray600} | ||
width={24} | ||
height={24} | ||
/> | ||
<Text fontType="p2" color={color.gray900}> | ||
원서 출력하기 | ||
</Text> | ||
</ButtonMenuItem>, | ||
] | ||
}, | ||
}; |
90 changes: 90 additions & 0 deletions
90
apps/admin/src/components/common/ButtonMenu/ButtonMenu.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,90 @@ | ||
import { useBooleanState, useOutsideClick } from '@maru/hooks'; | ||
import { IconArrowBottom, IconArrowTop } from '@maru/icon'; | ||
import { color } from '@maru/theme'; | ||
import { Text } from '@maru/ui'; | ||
import { flex } from '@maru/utils'; | ||
import { CSSProperties, ReactNode } from 'react'; | ||
import styled, { css } from 'styled-components'; | ||
|
||
interface Props { | ||
width?: CSSProperties['width']; | ||
menuItemList: ReactNode[]; | ||
} | ||
|
||
const ButtonMenu = ({ width, menuItemList = [] }: Props) => { | ||
const { | ||
value: isOpen, | ||
setFalse: closeMenu, | ||
toggle: handleToggleButtonClick, | ||
} = useBooleanState(); | ||
|
||
const menuRef = useOutsideClick(closeMenu); | ||
|
||
return ( | ||
<div style={{ width: 120 }} ref={menuRef}> | ||
<StyledButtonMenu $isOpen={isOpen} onClick={handleToggleButtonClick}> | ||
<Text fontType="p2" color={color.gray700}> | ||
추가 기능 | ||
</Text> | ||
{isOpen ? ( | ||
<IconArrowTop color={color.gray600} width={24} height={24} /> | ||
) : ( | ||
<IconArrowBottom color={color.gray600} width={24} height={24} /> | ||
)} | ||
</StyledButtonMenu> | ||
<MenuListBox $isOpen={isOpen}> | ||
<MenuList style={{ width }}> | ||
{menuItemList.map((menuItem) => ( | ||
<MenuItem onClick={closeMenu}>{menuItem}</MenuItem> | ||
))} | ||
</MenuList> | ||
</MenuListBox> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ButtonMenu; | ||
|
||
const StyledButtonMenu = styled.div<{ $isOpen: boolean }>` | ||
${flex({ alignItems: 'center', justifyContent: 'space-between' })} | ||
width: 100%; | ||
height: 40px; | ||
padding: 0 10px 0 16px; | ||
background-color: ${color.white}; | ||
border-radius: 6px; | ||
cursor: pointer; | ||
${(props) => | ||
props.$isOpen | ||
? css` | ||
border: 1px solid ${color.maruDefault}; | ||
outline: 2px solid rgba(20, 112, 255, 0.25); | ||
` | ||
: css` | ||
border: 1px solid ${color.gray400}; | ||
`} | ||
`; | ||
|
||
const MenuListBox = styled.div<{ $isOpen: boolean }>` | ||
position: relative; | ||
display: ${(props) => (props.$isOpen ? 'block' : 'none')}; | ||
`; | ||
|
||
const MenuList = styled.div` | ||
z-index: 1; | ||
position: absolute; | ||
right: 0; | ||
margin-top: 8px; | ||
padding: 8px; | ||
min-width: 120px; | ||
background-color: ${color.white}; | ||
border: 1px solid ${color.gray200}; | ||
box-shadow: 0px 2px 8px 0px rgba(0, 0, 0, 0.08); | ||
border-radius: 12px; | ||
`; | ||
|
||
const MenuItem = styled.div` | ||
width: 100%; | ||
height: 44px; | ||
cursor: pointer; | ||
`; |
14 changes: 14 additions & 0 deletions
14
apps/admin/src/components/common/ButtonMenu/ButtonMenuItem/ButtonMenuItem.stories.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,14 @@ | ||
import type { Meta, StoryObj } from "@storybook/react"; | ||
import ButtonMenuItem from "./ButtonMenuItem"; | ||
|
||
export default { | ||
component: ButtonMenuItem, | ||
title: "ButtonMenuItem", | ||
tags: ["autodocs"], | ||
} satisfies Meta<typeof ButtonMenuItem>; | ||
|
||
export const Default: StoryObj<typeof ButtonMenuItem> = { | ||
args: { | ||
children: '이것은 버튼 메뉴 아이템입니다~~' | ||
}, | ||
}; |
26 changes: 26 additions & 0 deletions
26
apps/admin/src/components/common/ButtonMenu/ButtonMenuItem/ButtonMenuItem.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,26 @@ | ||
import { color } from '@maru/theme'; | ||
import { flex } from '@maru/utils'; | ||
import { ReactNode } from 'react'; | ||
import styled from 'styled-components'; | ||
|
||
interface Props { | ||
children: ReactNode; | ||
} | ||
|
||
const ButtonMenuItem = ({ children }: Props) => { | ||
return <StyledButtonMenuItem>{children}</StyledButtonMenuItem>; | ||
}; | ||
|
||
export default ButtonMenuItem; | ||
|
||
const StyledButtonMenuItem = styled.div` | ||
${flex({ alignItems: 'center' })} | ||
gap: 12px; | ||
width: 100%; | ||
height: 44px; | ||
padding: 0 8px; | ||
&:hover { | ||
background-color: ${color.gray100}; | ||
} | ||
`; |
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
Oops, something went wrong.
7105df4
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.
Successfully deployed to the following URLs:
maru-admin – ./apps/admin
maru-admin-git-main-bamdoliro1.vercel.app
maru-admin-bamdoliro1.vercel.app
marururu-admin.vercel.app
admin.maru.bamdoliro.com