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] issue323: 컴포넌트 개선 #345

Merged
merged 75 commits into from
Sep 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
75 commits
Select commit Hold shift + click to select a range
4f84f9a
feat: theme 수정
nan-noo Sep 7, 2022
608dada
refactor: fontSize, fontWeight theme 사용
nan-noo Sep 7, 2022
26fa2a8
refactor: radius theme 적용
nan-noo Sep 7, 2022
ff3c41b
fix: theme 오류 수정
nan-noo Sep 7, 2022
31e7c8d
fix: theme 오류 수정
nan-noo Sep 7, 2022
e545fdd
refactor: lint 적용
nan-noo Sep 7, 2022
ea714c6
chore: design 폴더 경로 추가
nan-noo Sep 10, 2022
6779b70
feat: -Icon 컴포넌트 구현
nan-noo Sep 10, 2022
4e922cf
feat: Image 컴포넌트 구현
nan-noo Sep 10, 2022
1975c45
feat: Avatar 컴포넌트 구현
nan-noo Sep 10, 2022
93573ec
feat: -Button 컴포넌트 구현
nan-noo Sep 10, 2022
53b99fa
feat: Card 관련 컴포넌트 구현
nan-noo Sep 10, 2022
5946d10
refactor: 버튼 컴포넌트 폴더 구조 변경
nan-noo Sep 10, 2022
a92b399
feat: Chip 컴포넌트 구현
nan-noo Sep 10, 2022
8f72256
feat: input, textarea, checkbox 컴포넌트 구현
nan-noo Sep 10, 2022
41d1326
feat: StudyCard 컴포넌트 수정
nan-noo Sep 10, 2022
5248d5b
feat: CreateNewStudyButton 컴포넌트 수정
nan-noo Sep 10, 2022
2d8101c
refactor: 폴더 구조 변경
nan-noo Sep 10, 2022
bb9c8b4
feat: FilterButton 컴포넌트 수정
nan-noo Sep 10, 2022
e2c6d94
feat: ButtonGroup 컴포넌트 구현
nan-noo Sep 10, 2022
294329d
feat: FilterButtonList 컴포넌트 수정
nan-noo Sep 10, 2022
2487991
refactor: 폴더 구조 변경
nan-noo Sep 10, 2022
979c73e
feat: Divider 컴포넌트 구현
nan-noo Sep 11, 2022
053565a
feat: FilterSlideButton 컴포넌트 수정
nan-noo Sep 11, 2022
8c36624
feat: FilterSection 컴포넌트 수정
nan-noo Sep 11, 2022
f5af6e9
refactor: 폴더 변경
nan-noo Sep 11, 2022
9ba9431
refactor: 폴더 이동
nan-noo Sep 11, 2022
f520f23
feat: 스터디 생성 페이지 컴포넌트들 수정
nan-noo Sep 11, 2022
3d3c1c7
fix: 스터디 생성 모킹 api 수정
nan-noo Sep 11, 2022
09d9157
feat: 스터디 수정 페이지 컴포넌트 수정
nan-noo Sep 11, 2022
46bb391
refactor: Card 컴포넌트 수정
nan-noo Sep 11, 2022
2b672a6
refactor: 폴더 이동 및 파일명 수정
nan-noo Sep 11, 2022
cadd182
feat: 상세 페이지 컴포넌트 수정
nan-noo Sep 11, 2022
e3b0313
feat: 에러 페이지 컴포넌트 수정
nan-noo Sep 11, 2022
117595c
feat: 내 스터디 목록 페이지 컴포넌트 수정
nan-noo Sep 11, 2022
cc5c121
feat: 링크 모음 페이지 컴포넌트 수정
nan-noo Sep 12, 2022
ed7c337
feat: layout 컴포넌트 수정
nan-noo Sep 12, 2022
8d7c8b4
refactor: 사용하지 않는 컴포넌트 삭제
nan-noo Sep 12, 2022
a6a8c5a
feat: 스터디 후기 탭 컴포넌트 수정
nan-noo Sep 12, 2022
b67de33
refactor: 사용하지 않는 컴포넌트 삭제
nan-noo Sep 12, 2022
4a98658
refactor: 상수 분리
nan-noo Sep 12, 2022
f244ac5
Merge branch 'develop' of https://github.com/nan-noo/2022-moamoa into…
nan-noo Sep 12, 2022
e3c1d60
refactor: hover 트랜지션 스타일 분리
nan-noo Sep 12, 2022
c20017e
feat: 스터디방 게시판 컴포넌트 수정
nan-noo Sep 13, 2022
d44857e
feat: 게시글 모킹 api 수정
nan-noo Sep 13, 2022
2366938
fix: 소개글 preview 에러 수정
nan-noo Sep 13, 2022
71d5399
feat: 스터디방 공지사항 컴포넌트 수정
nan-noo Sep 14, 2022
a3f1e05
feat: 공지사항 모킹 api 수정
nan-noo Sep 14, 2022
0f66fdf
refactor: 사용하지 않는 컴포넌트 삭제
nan-noo Sep 14, 2022
1c953f9
feat: article 수정
nan-noo Sep 14, 2022
300c583
refactor: 컴포넌트 폴더 변경
nan-noo Sep 14, 2022
9d7d474
chore: @design 경로 삭제
nan-noo Sep 14, 2022
8f631be
test: 테스트 수정
nan-noo Sep 14, 2022
dceea38
refactor: Style -> Styled
nan-noo Sep 15, 2022
35f2a75
refactor: 폰트크기 타입 분리
nan-noo Sep 15, 2022
a01ea7f
feat: BoxButton 수정
nan-noo Sep 15, 2022
889057e
refactor: Item -> UserInfoItem
nan-noo Sep 15, 2022
98921aa
refactor: StudyChip 수정
nan-noo Sep 15, 2022
1e0c689
feat: 모킹 api 에러 메세지 및 타입 수정
nan-noo Sep 15, 2022
da6cb81
refactor: Title -> SectionTitle, PageTitle로 분리
nan-noo Sep 15, 2022
13df906
feat: ButtonGroup ul -> div
nan-noo Sep 15, 2022
5da539b
fix: 탈퇴 버튼 클릭시 링크 이동되는 오류 수정
nan-noo Sep 15, 2022
95b72c7
refactor: ~tabIds -> tabMode
nan-noo Sep 15, 2022
937e673
refactor: 스타일에서 삼항 연산자 줄이기
nan-noo Sep 15, 2022
61b5c5d
feat: Image 컴포넌트 수정
nan-noo Sep 15, 2022
cf1609d
refactor: !important 삭제
nan-noo Sep 15, 2022
181e308
feat: end -> done
nan-noo Sep 15, 2022
3a8931f
refactor: rem -> px
nan-noo Sep 15, 2022
893c88d
refactor: is(.+?)Valid -> isValid
nan-noo Sep 15, 2022
ae6b400
refactor: hover 애니메이션 스타일 함수 이름 변경
nan-noo Sep 15, 2022
6221c99
refactor: 색상 상수 분리
nan-noo Sep 15, 2022
cc744e6
refactor: Divider props 이름 수정
nan-noo Sep 15, 2022
8f00133
refactor: state명 변경
nan-noo Sep 15, 2022
a33baa9
refactor: getToday, getNextYear 수정
nan-noo Sep 16, 2022
02f4e79
refactor: tsc, eslint, prettier 적용
nan-noo Sep 16, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/CreateStudyFormValidation.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe('스터디 개설 페이지 폼 유효성 테스트', () => {

const minText = 'a';
const maxText30 = 'abcdefghijklmnopqrstuvwxyzabcd';
const redBorderCss = '1px solid rgb(255, 0, 0)';
const redBorderCss = '1px solid rgb(239, 94, 81)';
nan-noo marked this conversation as resolved.
Show resolved Hide resolved
const border = 'border';

it(`스터디 제목은 최소 ${TITLE_LENGTH.MIN.VALUE}글자에서 최대 ${TITLE_LENGTH.MAX.VALUE}글자까지 입력할 수 있다.`, () => {
Expand Down
6 changes: 2 additions & 4 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@ import { Navigate, Route, Routes } from 'react-router-dom';

import { PATH } from '@constants';

import tw from '@utils/tw';

import { useAuth } from '@hooks/useAuth';

import { Footer, Header, Main } from '@layout';
Expand All @@ -24,7 +22,7 @@ const App = () => {

return (
<div>
<Header css={tw`fixed top-0 left-0 right-0 z-2`} />
<Header />
<Main>
<Routes>
<Route path={PATH.MAIN} element={<MainPage />} />
Expand Down Expand Up @@ -76,7 +74,7 @@ const App = () => {
<Route path="*" element={<ErrorPage />} />
</Routes>
</Main>
<Footer marginBottom={'0'} />
<Footer />
</div>
);
};
Expand Down
23 changes: 0 additions & 23 deletions frontend/src/components/arrow-button/ArrowButton.stories.tsx

This file was deleted.

28 changes: 0 additions & 28 deletions frontend/src/components/arrow-button/ArrowButton.style.tsx

This file was deleted.

22 changes: 0 additions & 22 deletions frontend/src/components/arrow-button/ArrowButton.tsx

This file was deleted.

13 changes: 4 additions & 9 deletions frontend/src/components/avatar/Avatar.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
import type { Story } from '@storybook/react';

import Avatar from '@components/avatar/Avatar';
import type { AvatarProps } from '@components/avatar/Avatar';
import Avatar, { type AvatarProps } from '@components/avatar/Avatar';

export default {
title: 'Components/Avatar',
component: Avatar,
argTypes: {
profileImg: { controls: 'text' },
profileAlt: { controls: 'text' },
},
};

const Template: Story<AvatarProps> = props => <Avatar {...props} />;

export const Default = Template.bind({});
Default.args = {
profileImg:
'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1770&q=80',
profileAlt: '프로필 이미지',
src: 'https://images.unsplash.com/photo-1438761681033-6461ffad8d80?ixlib=rb-1.2.1&ixid=MnwxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8&auto=format&fit=crop&w=1770&q=80',
name: '프로필 이미지',
size: 'sm',
};
54 changes: 9 additions & 45 deletions frontend/src/components/avatar/Avatar.style.tsx
Original file line number Diff line number Diff line change
@@ -1,52 +1,16 @@
import { SerializedStyles, css } from '@emotion/react';
import { css } from '@emotion/react';
import styled from '@emotion/styled';

import type { AvatarProps } from '@components/avatar/Avatar';
import type { CssLength } from '@custom-types';

const dynamicSize = {
xs: css`
width: 30px;
min-width: 30px;
height: 30px;
`,
sm: css`
width: 36px;
min-width: 36px;
height: 36px;
`,
md: css`
width: 42px;
min-width: 42px;
height: 42px;
`,
lg: css`
width: 65px;
min-width: 65px;
height: 65px;
`,
type StyledAvatarProps = {
size: CssLength;
};

type DynamicImageContainerFn = (props: Pick<AvatarProps, 'size'>) => SerializedStyles;

const dynamicImageContainer: DynamicImageContainerFn = props => css`
${dynamicSize[props.size]}
`;

export const Avatar = styled.div`
${({ theme }) => css`
width: 36px;
min-width: 36px;
height: 36px;
border-radius: ${theme.radius.circle};
box-shadow: 0 1px 5px 0 ${theme.colors.secondary.dark};
overflow: hidden;
transition: opacity 0.2s ease;

&:hover,
&:active {
opacity: 0.9;
}
export const Avatar = styled.div<StyledAvatarProps>`
${({ size }) => css`
width: ${size};
min-width: ${size};
height: ${size};
`}

${dynamicImageContainer}
`;
23 changes: 15 additions & 8 deletions frontend/src/components/avatar/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,27 @@
import type { MakeOptional } from '@custom-types';
import type { CssLength, MakeOptional } from '@custom-types';

import * as S from '@components/avatar/Avatar.style';
import CenterImage from '@components/center-image/CenterImage';
import Image from '@components/image/Image';

export type AvatarProps = {
profileImg: string;
profileAlt: string;
size: 'xs' | 'sm' | 'md' | 'lg';
src: string;
name: string;
size: keyof typeof AVATAR_SIZE;
};

export const AVATAR_SIZE: Record<'sm' | 'md' | 'lg' | 'xl', CssLength> = {
nan-noo marked this conversation as resolved.
Show resolved Hide resolved
sm: '30px',
md: '36px',
lg: '42px',
xl: '65px',
};

type OptionalAvatarProps = MakeOptional<AvatarProps, 'size'>;

const Avatar: React.FC<OptionalAvatarProps> = ({ size = 'sm', profileImg, profileAlt }) => {
const Avatar: React.FC<OptionalAvatarProps> = ({ size = 'md', src, name }) => {
nan-noo marked this conversation as resolved.
Show resolved Hide resolved
return (
<S.Avatar size={size}>
<CenterImage src={profileImg} alt={profileAlt} />
<S.Avatar size={AVATAR_SIZE[size]}>
<Image shape="circular" src={src} alt={name} width={AVATAR_SIZE[size]} height={AVATAR_SIZE[size]} />
nan-noo marked this conversation as resolved.
Show resolved Hide resolved
</S.Avatar>
);
};
Expand Down
30 changes: 30 additions & 0 deletions frontend/src/components/button-group/ButtonGroup.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { Story } from '@storybook/react';

import ButtonGroup, { type ButtonGroupProps } from '@components/button-group/ButtonGroup';
import BoxButton from '@components/button/box-button/BoxButton';

export default {
title: 'Components/ButtonGroup',
component: ButtonGroup,
};

const Template: Story<ButtonGroupProps> = props => (
<ButtonGroup {...props}>
<BoxButton type="button">hi</BoxButton>
<BoxButton type="button" fluid variant="secondary">
hi
</BoxButton>
<BoxButton type="button" disabled>
hi
</BoxButton>
</ButtonGroup>
);

export const Default = Template.bind({});
Default.args = {
orientation: 'vertical',
gap: '8px',
width: '200px',
height: '100px',
};
Default.parameters = { controls: { exclude: ['children'] } };
28 changes: 16 additions & 12 deletions frontend/src/components/button-group/ButtonGroup.style.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,24 @@
import { css } from '@emotion/react';
import styled from '@emotion/styled';

import type { ButtonGroupProps } from '@components/button-group/ButtonGroup';
import type { MakeRequired } from '@custom-types';

const dynamicStyle: Record<ButtonGroupProps['variation'], any> = {
'flex-start': css`
justify-content: flex-start;
`,
'flex-end': css`
justify-content: flex-end;
`,
};
import { ButtonGroupProps } from './ButtonGroup';

export const ButtonGroup = styled.div<ButtonGroupProps>`
${({ variation }) => css`
type StyledButtonGroupProps = MakeRequired<
Pick<ButtonGroupProps, 'orientation' | 'gap' | 'height' | 'width' | 'justifyContent' | 'alignItems'>,
'gap' | 'height' | 'orientation' | 'width'
>;

export const ButtonGroup = styled.div<StyledButtonGroupProps>`
${({ orientation, gap, width, height, justifyContent, alignItems }) => css`
display: flex;
${dynamicStyle[variation]}
${orientation === 'vertical' && 'flex-direction: column;'}
gap: ${gap};
${justifyContent && `justify-content: ${justifyContent};`}
${alignItems && `align-items: ${alignItems};`}

width: ${width};
height: ${height};
`}
`;
31 changes: 24 additions & 7 deletions frontend/src/components/button-group/ButtonGroup.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,35 @@
import type { MakeOptional } from '@custom-types';
import type { CssLength } from '@custom-types';

import * as S from '@components/button-group/ButtonGroup.style';

export type ButtonGroupProps = {
className?: string;
children: React.ReactNode;
variation: 'flex-start' | 'flex-end';
width?: CssLength;
height?: CssLength;
orientation?: 'vertical' | 'horizontal';
justifyContent?: 'flex-start' | 'flex-end' | 'center' | 'space-between';
alignItems?: 'flex-start' | 'flex-end' | 'center' | 'space-between';
gap?: CssLength;
};

type OptionalButtonGroupProps = MakeOptional<ButtonGroupProps, 'variation'>;

const ButtonGroup: React.FC<OptionalButtonGroupProps> = ({ className, children, variation = 'flex-end' }) => {
const ButtonGroup: React.FC<ButtonGroupProps> = ({
children,
width = '100%',
height = 'fit-content',
orientation = 'horizontal',
justifyContent,
alignItems,
gap = 0,
}) => {
return (
<S.ButtonGroup className={className} variation={variation}>
<S.ButtonGroup
width={width}
height={height}
orientation={orientation}
gap={gap}
justifyContent={justifyContent}
alignItems={alignItems}
>
{children}
</S.ButtonGroup>
);
Expand Down
16 changes: 0 additions & 16 deletions frontend/src/components/button/Button.stories.tsx

This file was deleted.

Loading