-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: 이벤트 홈 화면 새로운 플로우로 교체 (참여자 별 정산, 전체 지출 내역), Dropdown 컴포넌트 구현 (#582)
* feat: z index theme에 추가 * feat: 탭 컴포넌트 스타일 바뀐대로 설정 * design: gap 만큼 더 움직이도록 설정 * feat: ExpenseList안에 검색input 추가 * feat: Flex 컴포넌트에 다른 style 넣을 수 있도록 확장 * feat: inputType search일 때 검색 아이콘 보이도록 설정 * feat: 바뀐 이벤트 홈 디자인 반영 * remove: 사용하지 않는 Search 컴포넌트 삭제 * fix: Flex컴포넌트 다른 스타일 확장으로 인한 ts 오류 수정 * feat: ExpenseList isDeposited 내용 추가 * style: 사용하지 않는 import제거 * design: 버튼 색상 변경 * feat: 지출내역이 없을 때 fallback 추가 * feat: 지출 내역이 없을 때 fallback 적용 * feat: Dropdown 컴포넌트 구현 * fix: createPortal 제거 -> position absolute를 이용해 대체 * feat: AdminPage에 dropdown 컴포넌트 적용 * design: 모바일에서 클릭 시 파란색 강조되는 색 제거 * feat: 계좌번호 입력 드랍다운 눌렀을 때 페이지 이동 (머지되면 붙일 예정) * design: 탭 컴포넌트 애니메이션 cubic-bezier를 이용해서 변경 * design: 드랍다운 버튼 hover 강조 * fix: ResizeObserver를 이용해서 tab width의 값을 정확히 가져오도록 설정 * design: tab width가 0일 때 indicator가 랜더링 되지 않도록 설정 * chore: 충돌 병합
- Loading branch information
1 parent
e419eb2
commit 396ff78
Showing
35 changed files
with
438 additions
and
250 deletions.
There are no files selected for viewing
34 changes: 34 additions & 0 deletions
34
client/src/components/Design/components/Dropdown/Dropdown.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,34 @@ | ||
/** @jsxImportSource @emotion/react */ | ||
import type {Meta, StoryObj} from '@storybook/react'; | ||
|
||
import Dropdown from '@HDcomponents/Dropdown/Dropdown'; | ||
|
||
import DropdownButton from './DropdownButton'; | ||
|
||
const meta = { | ||
title: 'Components/Dropdown', | ||
component: Dropdown, | ||
tags: ['autodocs'], | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
decorators: [ | ||
Story => ( | ||
<div style={{height: '420px'}}> | ||
<Story /> | ||
</div> | ||
), | ||
], | ||
args: { | ||
children: [ | ||
<DropdownButton text="전체 참여자 관리" onClick={() => alert('전체 참여자 관리 클릭')} />, | ||
<DropdownButton text="계좌번호 입력하기" onClick={() => alert('계좌번호 입력하기 클릭')} />, | ||
], | ||
}, | ||
} satisfies Meta<typeof Dropdown>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Playground: Story = {}; |
33 changes: 33 additions & 0 deletions
33
client/src/components/Design/components/Dropdown/Dropdown.style.ts
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,33 @@ | ||
import {css} from '@emotion/react'; | ||
|
||
import {Theme} from '@components/Design/theme/theme.type'; | ||
|
||
import {FlexProps} from '../Flex/Flex.type'; | ||
|
||
export const dropdownStyle: FlexProps = { | ||
flexDirection: 'column', | ||
width: '12.5rem', | ||
padding: '0.5rem', | ||
paddingInline: '0.5rem', | ||
gap: '0.25rem', | ||
backgroundColor: 'white', | ||
|
||
otherStyle: { | ||
position: 'absolute', | ||
top: '2rem', | ||
right: '-1rem', | ||
borderRadius: '0.75rem', | ||
boxShadow: '2px 4px 16px 0 rgba(0, 0, 0, 0.08)', | ||
}, | ||
}; | ||
|
||
export const dropdownButtonStyle = (theme: Theme) => | ||
css({ | ||
height: '2rem', | ||
padding: '0.25rem 0.5rem', | ||
|
||
':hover': { | ||
borderRadius: '0.625rem', | ||
backgroundColor: theme.colors.grayContainer, | ||
}, | ||
}); |
36 changes: 36 additions & 0 deletions
36
client/src/components/Design/components/Dropdown/Dropdown.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,36 @@ | ||
/** @jsxImportSource @emotion/react */ | ||
import Icon from '../Icon/Icon'; | ||
import IconButton from '../IconButton/IconButton'; | ||
import Flex from '../Flex/Flex'; | ||
|
||
import useDropdown from './useDropdown'; | ||
import {DropdownProps} from './Dropdown.type'; | ||
import DropdownButton from './DropdownButton'; | ||
import {dropdownStyle} from './Dropdown.style'; | ||
|
||
const Dropdown = ({children}: DropdownProps) => { | ||
const {isOpen, openDropdown, meetBallsRef, dropdownRef} = useDropdown(); | ||
const isDropdownOpen = isOpen && meetBallsRef.current; | ||
|
||
return ( | ||
<IconButton | ||
ref={meetBallsRef} | ||
variants="none" | ||
onClick={openDropdown} | ||
style={{position: 'relative', WebkitTapHighlightColor: 'transparent'}} | ||
> | ||
<Icon iconType="meatballs" /> | ||
{isDropdownOpen && ( | ||
<section ref={dropdownRef}> | ||
<Flex {...dropdownStyle}> | ||
{children.map(button => ( | ||
<DropdownButton {...button.props} /> | ||
))} | ||
</Flex> | ||
</section> | ||
)} | ||
</IconButton> | ||
); | ||
}; | ||
|
||
export default Dropdown; |
7 changes: 7 additions & 0 deletions
7
client/src/components/Design/components/Dropdown/Dropdown.type.ts
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,7 @@ | ||
export type DropdownButtonProps = React.HTMLAttributes<HTMLButtonElement> & { | ||
text: string; | ||
}; | ||
|
||
export type DropdownProps = { | ||
children: React.ReactElement<DropdownButtonProps>[]; | ||
}; |
21 changes: 21 additions & 0 deletions
21
client/src/components/Design/components/Dropdown/DropdownButton.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,21 @@ | ||
/** @jsxImportSource @emotion/react */ | ||
|
||
import {useTheme} from '@components/Design/theme/HDesignProvider'; | ||
|
||
import Text from '../Text/Text'; | ||
|
||
import {dropdownButtonStyle} from './Dropdown.style'; | ||
import {DropdownButtonProps} from './Dropdown.type'; | ||
|
||
const DropdownButton = ({text, ...buttonProps}: DropdownButtonProps) => { | ||
const {theme} = useTheme(); | ||
return ( | ||
<button css={dropdownButtonStyle(theme)} {...buttonProps}> | ||
<Text size="body" color="black"> | ||
{text} | ||
</Text> | ||
</button> | ||
); | ||
}; | ||
|
||
export default DropdownButton; |
39 changes: 39 additions & 0 deletions
39
client/src/components/Design/components/Dropdown/useDropdown.ts
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,39 @@ | ||
import {useEffect, useRef, useState} from 'react'; | ||
|
||
const useDropdown = () => { | ||
const [isOpen, setIsOpen] = useState(false); | ||
const meetBallsRef = useRef<HTMLButtonElement>(null); | ||
const dropdownRef = useRef<HTMLElement>(null); | ||
|
||
const openDropdown = () => { | ||
setIsOpen(true); | ||
}; | ||
|
||
useEffect(() => { | ||
const clickOutSide = (event: MouseEvent) => { | ||
const targetNode = event.target as Node; | ||
|
||
if ( | ||
(dropdownRef.current && dropdownRef.current.contains(targetNode)) || | ||
(meetBallsRef.current && meetBallsRef.current.contains(targetNode)) | ||
) { | ||
return; | ||
} | ||
|
||
setIsOpen(false); | ||
}; | ||
document.addEventListener('mousedown', clickOutSide); | ||
return () => { | ||
document.removeEventListener('mousedown', clickOutSide); | ||
}; | ||
}, [dropdownRef]); | ||
|
||
return { | ||
isOpen, | ||
openDropdown, | ||
meetBallsRef, | ||
dropdownRef, | ||
}; | ||
}; | ||
|
||
export default useDropdown; |
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
12 changes: 0 additions & 12 deletions
12
client/src/components/Design/components/ExpenseList/ExpenseList.style.ts
This file was deleted.
Oops, something went wrong.
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
11 changes: 7 additions & 4 deletions
11
client/src/components/Design/components/ExpenseList/ExpenseList.type.ts
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,12 +1,15 @@ | ||
export interface ExpenseItemCustomProps { | ||
name: string; | ||
price: number; | ||
import {Report} from 'types/serviceType'; | ||
|
||
export type ExpenseItemCustomProps = Report & { | ||
onBankButtonClick: () => void; | ||
clipboardText: string; | ||
} | ||
}; | ||
|
||
export type ExpenseItemProps = React.ComponentProps<'div'> & ExpenseItemCustomProps; | ||
|
||
export type ExpenseListProps = { | ||
name: string; | ||
onSearch: ({target}: React.ChangeEvent<HTMLInputElement>) => void; | ||
placeholder: string; | ||
expenseList: ExpenseItemProps[]; | ||
}; |
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.