Skip to content
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

[FE] 2차 스프린트 디자인 시스템 수정 #83

Merged
merged 80 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
bd0db86
design: Title Component width 100%로 수정
Todari Jul 22, 2024
146e577
design: TopNav width 100%로 수정
Todari Jul 22, 2024
13bb6de
fix: index.tsx export 수정
Todari Jul 22, 2024
5fad906
chore: v0.1.2 배포
Todari Jul 22, 2024
1c6a1e0
design: input 좌우 1rem 추가
Todari Jul 22, 2024
bb4218c
feat: MainLayout 추가
Todari Jul 22, 2024
3f6f3ca
chore: v0.1.3 배포
Todari Jul 22, 2024
6a2a49f
feat: TopNav none 타입 추가
jinhokim98 Jul 23, 2024
d0a80d0
chore: storybook-addon-react-router-v6 dev dependency 추가
jinhokim98 Jul 23, 2024
a57bc5a
fix: ExpenseItem button props 넣을 수 있도록 수정
jinhokim98 Jul 23, 2024
c7d56d5
design: button cursor pointer 전역설정
jinhokim98 Jul 23, 2024
7e1723d
refactor: BottomSheet component 구조 수정
Todari Jul 23, 2024
75885d0
chore: v0.1.4 배포
Todari Jul 23, 2024
f389b25
refactor: tab components 합성방식으로 변경
jinhokim98 Jul 23, 2024
53e8943
Merge branch 'feature/#61' of https://github.com/woowacourse-teams/20…
jinhokim98 Jul 23, 2024
ae377d6
feat: Flex component backgroundColor 받을 수 있도록 변경
Todari Jul 23, 2024
51cdeb5
fix: 주석이 xml 내부에서 적용안되던 오류 해결
Todari Jul 23, 2024
ca7b98c
chore: v0.1.5 배포
Todari Jul 23, 2024
72f879e
refactor: flex background prop 로직 처리 방법 변경
Todari Jul 23, 2024
da1a8f2
feat: MainLayout backgroundColor prop 추가
Todari Jul 23, 2024
59c8d9e
fix: flex backgroundColor defaultValue 제거
Todari Jul 23, 2024
f09caa2
chore: v0.1.6 배포
Todari Jul 23, 2024
f26f19f
fix: MainLayout margin padding으로 변경
Todari Jul 23, 2024
0fad857
fix: Switch 및 TopNav 내부 로직 변경
Todari Jul 23, 2024
655b9e1
test: Switch storybook 수정
Todari Jul 23, 2024
c0d85c3
fix: TopNav navigate currentPath를 이용하도록 수정
Todari Jul 23, 2024
29bfb4c
feat: v0.1.18 배포
Todari Jul 23, 2024
7ba559e
fix: TopNav navigate 변경
Todari Jul 23, 2024
d443700
Merge branch 'develop' of https://github.com/woowacourse-teams/2024-h…
jinhokim98 Jul 24, 2024
5beec10
design: tab item과 panel 사이에 gap 넣을 수 있도록 설정 및 flex container 사용
jinhokim98 Jul 24, 2024
3329cae
refactor: in out type uppercase로 수정
jinhokim98 Jul 24, 2024
ae60c1f
design: in out item font size 변경 및 텍스트 바꿔서 작성한 내용 수정
jinhokim98 Jul 24, 2024
f53f11e
Merge branch 'develop' of https://github.com/woowacourse-teams/2024-h…
jinhokim98 Jul 24, 2024
512760c
Merge branch 'develop' of https://github.com/woowacourse-teams/2024-h…
jinhokim98 Jul 24, 2024
e7ecb3c
test: InOutItem storybook 수정
Todari Jul 24, 2024
b253160
chore: v0.1.20 배포
Todari Jul 24, 2024
75d5c4c
Merge branch 'feature/#61' of https://github.com/woowacourse-teams/20…
jinhokim98 Jul 24, 2024
98a4698
design: hasDragableItem 비활성화 시 마진 수정
jinhokim98 Jul 24, 2024
b6bdcad
chore: 충돌해결
jinhokim98 Jul 24, 2024
19d2c5c
fix: props 네이밍 스토리북에 반영
jinhokim98 Jul 24, 2024
ee0e0dc
fix: navigate 뒤로가기 3번 발생하는 이슈 해결
jinhokim98 Jul 24, 2024
2e5e579
chore: v0.1.22 배포
Todari Jul 24, 2024
4b5a416
fix: Switch 내부의 불필요한 로직 제거
Todari Jul 24, 2024
0548366
chore: v0.1.23 배포
Todari Jul 24, 2024
fefabfb
fix: navigate path 로직 변경
jinhokim98 Jul 24, 2024
a60f39e
fix: 새로고침 됐을 때 해당 location 페이지를 유지하도록 수정
jinhokim98 Jul 24, 2024
3d12c84
style: children이 없는 태그 스스로 닫도록 수정
jinhokim98 Jul 24, 2024
05a6d2e
style: todo 주석 제거
jinhokim98 Jul 24, 2024
96fd931
chore: v0.1.25 배포
Todari Jul 24, 2024
8ab9717
design: fixedButton position 변경
Todari Jul 25, 2024
2d39267
chore: v0.1.26 배포
Todari Jul 25, 2024
6794598
fix: 라우팅 변경 이동 오류 해결
jinhokim98 Jul 25, 2024
5a5c47c
Merge branch 'feature/#61' of https://github.com/woowacourse-teams/20…
jinhokim98 Jul 25, 2024
d97cf14
chore: v0.1.27 배포
Todari Jul 25, 2024
daa3dbb
chore: v0.1.28 배포
Todari Jul 25, 2024
d9fc789
Merge branch 'develop' of https://github.com/woowacourse-teams/2024-h…
jinhokim98 Jul 25, 2024
689cf4c
fix: location set 로직을 home 모드에서만 작동하도록 변경
jinhokim98 Jul 25, 2024
6e50b1d
Merge branch 'feature/#61' of https://github.com/woowacourse-teams/20…
jinhokim98 Jul 25, 2024
abfdea9
chore: v0.1.29 배포
Todari Jul 25, 2024
fc5900a
Merge branch 'develop' of https://github.com/woowacourse-teams/2024-h…
jinhokim98 Jul 25, 2024
b131140
fix: TopNav navigation 로직 외부에서 넣도록 변경
jinhokim98 Jul 25, 2024
66e5c68
Merge branch 'feature/#61' of https://github.com/woowacourse-teams/20…
jinhokim98 Jul 25, 2024
5f28bc1
chore: v0.1.30 배포
Todari Jul 25, 2024
b66e94a
fix: index.ts 경로 문제로 제거
jinhokim98 Jul 25, 2024
f7d4d79
Merge branch 'feature/#61' of https://github.com/woowacourse-teams/20…
jinhokim98 Jul 25, 2024
a5614a8
chore: v0.1.13 배포
Todari Jul 25, 2024
7878939
chore: v0.1.32 배포
Todari Jul 25, 2024
1a28863
fix: Fixed Button 하단 고정되도록 변경
Todari Jul 26, 2024
db7a1a6
chore: v0.1.33 배포
Todari Jul 26, 2024
d2ba05e
v0.1.35 배포
Todari Jul 26, 2024
747de08
fix: 가격과 원을 붙여서 표기
Todari Jul 27, 2024
a758316
fix: TopNav가 children이 없어도 작동하도록 변경
jinhokim98 Jul 27, 2024
8dd3ecd
fix: children이 필수가 아니도록 변경
jinhokim98 Jul 27, 2024
21a2e5c
remove: 사용하지 않는 NavSwitch 제거
jinhokim98 Jul 27, 2024
7faab2e
chore: 파이프라인 테스트를 위한 push
pakxe Jul 27, 2024
0aea8ef
chore: 파이프라인 테스트를 위한 push
pakxe Jul 27, 2024
65db70a
remove: merge를 위한 /sever dir 삭제
Todari Jul 28, 2024
cd8c922
Merge branch 'feature/#61' of github.com:woowacourse-teams/2024-haeng…
Todari Jul 28, 2024
286ae97
style: lint 적용
Todari Jul 29, 2024
181e0f3
Merge branch 'develop' into feature/#61
Todari Jul 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
561 changes: 49 additions & 512 deletions HDesign/package-lock.json

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion HDesign/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "haengdong-design",
"version": "0.1.3",
"version": "0.1.35",
"description": "",
"main": "./dist/index.js",
"module": "./dist/index.js",
Expand Down Expand Up @@ -49,6 +49,7 @@
"globals": "^15.8.0",
"prettier": "3.3.2",
"storybook": "^8.2.2",
"storybook-addon-react-router-v6": "^2.0.15",
"ts-loader": "^9.5.1",
"tsc-alias": "^1.8.10",
"typescript": "^5.5.3",
Expand Down
2 changes: 1 addition & 1 deletion HDesign/src/components/BillItem/BillItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const BillItem: React.FC<BillItemProps> = ({
{name}
</Text>
<Text css={textStyle(theme)} size="body">
{price.toLocaleString('ko-kr')}
{price.toLocaleString('ko-kr')}원
</Text>
</Flex>
</DragHandleItem>
Expand Down
20 changes: 9 additions & 11 deletions HDesign/src/components/BottomSheet/BottomSheet.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,15 @@ const meta = {
// layout: 'centered',
},
argTypes: {
fixedButtonVariants: {
fixedButtonProps: {
description: '',
control: {type: 'select'},
options: ['', 'primary', 'secondary', 'tertiary'],
},
fixedButtonText: {
description: '',
control: {type: 'text'},
control: {type: 'object'},
},
},
args: {
fixedButtonVariants: 'primary',
fixedButtonText: '하단 고정 버튼이에요',
fixedButtonProps: {
variants: 'primary',
},
},
} satisfies Meta<typeof BottomSheet>;

Expand All @@ -36,8 +32,10 @@ type Story = StoryObj<typeof meta>;

export const Playground: Story = {
args: {
fixedButtonVariants: 'primary',
fixedButtonText: '하단 고정 버튼이에요',
fixedButtonProps: {
variants: 'primary',
children: '하단 고정 버튼',
},
},
render: ({...args}) => {
const [isOpened, setIsOpened] = useState(false);
Expand Down
2 changes: 1 addition & 1 deletion HDesign/src/components/BottomSheet/BottomSheet.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const dimmedLayerStyle = (theme: Theme) =>

export const bottomSheetContainerStyle = (theme: Theme) =>
css({
position: 'absolute',
position: 'fixed',
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
Expand Down
10 changes: 4 additions & 6 deletions HDesign/src/components/BottomSheet/BottomSheet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,23 @@
import {createPortal} from 'react-dom';

import {BottomSheetProps} from '@components/BottomSheet/BottomSheet.type';
import {useBottomSheet} from '@components/BottomSheet/useBottomSheet';
import FixedButton from '@components/FixedButton/FixedButton';

import {useTheme} from '@theme/HDesignProvider';

import {useBottomSheet} from './useBottomSheet';
import {bottomSheetContainerStyle, dimmedLayerStyle, indicatorStyle} from './BottomSheet.style';

const BottomSheet: React.FC<BottomSheetProps> = ({
fixedButtonVariants = 'primary',
isOpened = false,
children,
fixedButtonText,
fixedButtonProps,
...props
}: BottomSheetProps) => {
const {theme} = useTheme();
const {opened, handleClose} = useBottomSheet({isOpened, ...props});

// TODO: (@todari) : children 길이 길 때 overflow button에 안가리는 영역 처리
return createPortal(
<>
{opened && (
Expand All @@ -27,9 +27,7 @@ const BottomSheet: React.FC<BottomSheetProps> = ({
<div css={bottomSheetContainerStyle(theme)}>
<div css={indicatorStyle(theme)} />
{children}
{(fixedButtonVariants || fixedButtonText) && (
<FixedButton variants={fixedButtonVariants} children={fixedButtonText} />
)}
{fixedButtonProps && <FixedButton {...fixedButtonProps} />}
</div>
</>
)}
Expand Down
5 changes: 3 additions & 2 deletions HDesign/src/components/BottomSheet/BottomSheet.type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ import {ButtonVariants} from '@components/Button/Button.type';

import {Theme} from '@theme/theme.type';

import {FixedButtonProps} from '../FixedButton/FixedButton.type';

export interface BottomSheetStyleProps {
theme?: Theme;
}
Expand All @@ -12,8 +14,7 @@ export interface BottomSheetCustomProps {
isOpened?: boolean;
onChangeOpen?: () => void;
onChangeClose?: () => void;
fixedButtonVariants?: ButtonVariants;
fixedButtonText?: string;
fixedButtonProps?: FixedButtonProps;
}

export type BottomSheetOptionProps = BottomSheetStyleProps & BottomSheetCustomProps;
Expand Down
23 changes: 18 additions & 5 deletions HDesign/src/components/BottomSheet/useBottomSheet.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,36 @@
import {useEffect, useState} from 'react';
import {useCallback, useEffect, useState} from 'react';

interface UseBottomSheetProps {
isOpened: boolean;
onChangeClose?: () => void;
onChangeOpen?: () => void;
}

export const useBottomSheet = ({isOpened, onChangeClose}: UseBottomSheetProps) => {
const [opened, setOpened] = useState(isOpened);
export const useBottomSheet = ({isOpened, onChangeClose, onChangeOpen}: UseBottomSheetProps) => {
const [opened, setOpened] = useState(false);

useEffect(() => {
setOpened(isOpened);
if (!isOpened) {
handleClose();
} else {
handleOpen();
}
}, [isOpened]);

const handleClose = () => {
const handleClose = useCallback(() => {
setOpened(false);
if (onChangeClose) {
onChangeClose();
}
};
}, []);

const handleOpen = useCallback(() => {
setOpened(true);
if (onChangeOpen) {
onChangeOpen();
}
}, []);

useEffect(() => {
document.body.style.overflow = 'hidden';
Expand Down
12 changes: 9 additions & 3 deletions HDesign/src/components/ExpenseList/ExpenseList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,34 @@

import Text from '@components/Text/Text';


import {Arrow} from '@assets/index';

import {useTheme} from '@theme/HDesignProvider';

import {useTheme} from '@theme/HDesignProvider';

import {ExpenseItemProps, ExpenseListProps} from './ExpenseList.type';
import {expenseItemStyle, expenseListStyle, expenseItemLeftStyle, TextStyle} from './ExpenseList.style';

// TODO: (@soha) 따로 파일 분리할까 고민중.. 여기서만 사용할 것 같긴 한데.. 흠
function ExpenseItem({name, price}: ExpenseItemProps) {
function ExpenseItem({name, price, ...buttonProps}: ExpenseItemProps) {
const {theme} = useTheme();
return (
<button css={expenseItemStyle}>
<button css={expenseItemStyle} {...buttonProps}>
<Text size="bodyBold" css={TextStyle(theme)}>
{name}
</Text>
<div css={expenseItemLeftStyle}>
<Text css={TextStyle(theme)}>{price.toLocaleString('ko-kr')} 원</Text>
<Text css={TextStyle(theme)}>{price.toLocaleString('ko-kr')}원</Text>
<Arrow />
</div>
</button>
);
}
}

function ExpenseList({expenseList = []}: ExpenseListProps) {
function ExpenseList({expenseList = []}: ExpenseListProps) {
const {theme} = useTheme();
return (
Expand All @@ -35,5 +40,6 @@ function ExpenseList({expenseList = []}: ExpenseListProps) {
</div>
);
}
}

export default ExpenseList;
4 changes: 3 additions & 1 deletion HDesign/src/components/ExpenseList/ExpenseList.type.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
export interface ExpenseItemProps {
export interface ExpenseItemCustomProps {
name: string;
price: number;
}

export type ExpenseItemProps = React.ComponentProps<'button'> & ExpenseItemCustomProps;

export type ExpenseListProps = {
expenseList: ExpenseItemProps[];
};
5 changes: 3 additions & 2 deletions HDesign/src/components/FixedButton/FixedButton.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import {Theme} from '@theme/theme.type';
export const fixedButtonContainerStyle = (theme: Theme) =>
css({
display: 'flex',
position: 'absolute',

position: 'fixed',
maxWidth: '768px',
inset: 'auto 0 0',
margin: '0 auto',
backgroundColor: theme.colors.white,
boxSizing: 'border-box',
});
Expand Down
45 changes: 45 additions & 0 deletions HDesign/src/components/Flex/Flex.style.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import {css} from '@emotion/react';

import {changeCamelCaseToKebabCase} from '@/utils/ return str.replace(/([a-z])([A-Z])/changeCamelCaseToKebabCase';

import {FlexDirectionStrictType, FlexProps} from './Flex.type';

export const flexStyle = ({
justifyContent = 'flexStart',
alignItems = 'stretch',
flexDirection = 'row',
gap = '0',
padding = '0',
paddingInline = '0',
margin = '0',
width = 'auto',
height = 'auto',
backgroundColor,
theme,
...rest
}: FlexProps) =>
css({
display: 'flex',
justifyContent: changeCamelCaseToKebabCase(justifyContent),
alignItems: changeCamelCaseToKebabCase(alignItems),
// TODO: (@weadie) as를 사용하지 않으면 방법이 없음. css의 flexDirection속성은 string을 받지 않고 명확한 속성명(ex row-reverse)를 받고 싶어함. 다만 as를 사용해도 된다고 생각한 근거는 케밥함수가 FlexDirectionType에 명시된 모든 타입을 정확하게 변환하며, 받는 문자열이 FlexDirectionType에 제한되기 때문.
flexDirection: changeCamelCaseToKebabCase(flexDirection) as FlexDirectionStrictType,
gap,
padding,
paddingInline,
margin,
width,
height,
...rest,

backgroundColor: (() => {
switch (backgroundColor) {
case 'white':
return theme?.colors.white;
case 'gray':
return theme?.colors.grayContainer;
default:
return 'none';
}
})(),
});
35 changes: 5 additions & 30 deletions HDesign/src/components/Flex/Flex.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,15 @@
import {css} from '@emotion/react';

import {StrictPropsWithChildren} from '@/types/strictPropsWithChildren';
import {changeCamelCaseToKebabCase} from '@/utils/ return str.replace(/([a-z])([A-Z])/changeCamelCaseToKebabCase';
import {useTheme} from '@/theme/HDesignProvider';

import {FlexDirectionStrictType, FlexProps} from './Flex.type';

const flexStyle = ({
justifyContent = 'flexStart',
alignItems = 'stretch',
flexDirection = 'row',
gap = '0',
padding = '0',
paddingInline = '0',
margin = '0',
width = 'auto',
height = 'auto',
...rest
}: FlexProps) =>
css({
display: 'flex',
justifyContent: changeCamelCaseToKebabCase(justifyContent),
alignItems: changeCamelCaseToKebabCase(alignItems),
// TODO: (@weadie) as를 사용하지 않으면 방법이 없음. css의 flexDirection속성은 string을 받지 않고 명확한 속성명(ex row-reverse)를 받고 싶어함. 다만 as를 사용해도 된다고 생각한 근거는 케밥함수가 FlexDirectionType에 명시된 모든 타입을 정확하게 변환하며, 받는 문자열이 FlexDirectionType에 제한되기 때문.
flexDirection: changeCamelCaseToKebabCase(flexDirection) as FlexDirectionStrictType,
gap,
padding,
paddingInline,
margin,
width,
height,
...rest,
});
import {FlexProps} from './Flex.type';
import {flexStyle} from './Flex.style';

// TODO: (@weadie) 지정된 프롭 말고 다른 프롭도 가져올 수 있게 하자.
function Flex({children, ...props}: StrictPropsWithChildren<FlexProps>) {
return <div css={flexStyle(props)}>{children}</div>;
const {theme} = useTheme();
return <div css={flexStyle({theme, ...props})}>{children}</div>;
}

export default Flex;
9 changes: 5 additions & 4 deletions HDesign/src/components/Flex/Flex.type.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import {Theme} from '@/theme/theme.type';

export type FlexDirectionType = 'row' | 'column' | 'rowReverse' | 'columnReverse';
export type FlexDirectionStrictType = 'row' | 'column' | 'row-reverse' | 'column-reverse';
export type FlexBackgroundColor = 'gray' | 'white';

export interface FlexProps {
justifyContent?: 'flexStart' | 'center' | 'flexEnd' | 'spaceBetween' | 'spaceAround' | 'spaceEvenly';
Expand All @@ -11,8 +14,6 @@ export interface FlexProps {
margin?: string;
width?: string;
height?: string;
}

export interface ExtendedFlexProps extends FlexProps {
[key: string]: string | undefined;
backgroundColor?: FlexBackgroundColor;
theme?: Theme;
}
4 changes: 2 additions & 2 deletions HDesign/src/components/InOutItem/InOutItem.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ const meta = {
},
inOutType: {
description: '',
control: {type: 'select', options: ['in', 'out']},
control: {type: 'select', options: ['IN', 'OUT']},
},
},
args: {
names: ['감자', '토다리'],
inOutType: 'out',
inOutType: 'OUT',
},
} satisfies Meta<typeof InOutItem>;

Expand Down
4 changes: 3 additions & 1 deletion HDesign/src/components/InOutItem/InOutItem.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ export const prefixStyle = css({
gap: '0.25rem',
});

export const textStyle = (theme: Theme) =>
export const textStyle = (theme: Theme, hasDragHandle: boolean) =>
css({
paddingLeft: hasDragHandle ? '0' : '0.5rem',

color: theme.colors.black,
});
Loading
Loading