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

[Design] 그룹 참여/가입 신청 페이지 UI 작성 #506

Closed
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
b2677e4
💄 그룹 참여 페이지 기본 레이아웃 작성
js43o Jan 21, 2024
c49b337
💄 참여 단계별 완료/비활성화 스타일 추가
js43o Jan 21, 2024
ce5e577
✨ 현재 참여 스텝 변경 기능 추가
js43o Jan 21, 2024
a8c7fe7
💄 그룹 확인 스텝 스타일 수정
js43o Jan 21, 2024
93bc07b
💄 그룹 리스트 페이지 최대 너비를 80rem으로 변경
js43o Jan 21, 2024
709d44d
🚚 그룹 가입 페이지 경로 변경 (-> pages/Group/Join)
js43o Jan 22, 2024
ed32d2c
♻️ 그룹 정보 UI 컴포넌트 분리
js43o Jan 22, 2024
3f21270
💄 그룹 링크 참여 페이지 작성
js43o Jan 22, 2024
e95d658
💄 GroupInfo 컴포넌트 스타일 수정
js43o Jan 22, 2024
8b623f8
✏️ 잘못된 그룹 관련 안내 텍스트 수정
js43o Jan 22, 2024
2922361
♻️ 구조 분해 할당 코드를 컴포넌트 바깥으로 이동
js43o Jan 26, 2024
fd4cdc0
♻️ GroupJoin/GroupLink 페이지 컴포넌트에 대한 index 파일 추가
js43o Jan 26, 2024
4d50707
♻️ 그룹 참여 페이지 각 단계별 동적 클래스 제거
js43o Jan 26, 2024
5428488
💄 Stepper 컴포넌트 추가
js43o Jan 26, 2024
df811cf
💄 Stepper 트랜지션 효과 추가
js43o Jan 26, 2024
f0568ba
✨ 그룹 참여 페이지에 Stepper 컴포넌트 추가
js43o Jan 26, 2024
ecaae26
♻️ 컴포넌트 인덱스 파일 목록에 GroupInfo 추가
js43o Jan 26, 2024
9902de9
🔥 그룹 가입 절차 페이지 삭제
js43o Jan 28, 2024
2ca7fc7
💄 그룹 참여/가입 신청 페이지 수정
js43o Jan 28, 2024
a1e0e14
✨ 그룹 참여 동작을 그룹 참여 페이지에서 처리하도록 코드 이동
js43o Jan 28, 2024
df896bc
🔥 Stepper 컴포넌트 삭제
js43o Jan 28, 2024
9d440ca
🍱 lock 아이콘 추가
js43o Jan 28, 2024
659830c
💄 Group, GroupInfo 컴포넌트에 비공개 여부 props 추가
js43o Jan 28, 2024
5ecc253
🐛 GroupInfo 컴포넌트에 누락된 closed props 추가
js43o Jan 28, 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
28 changes: 28 additions & 0 deletions app/frontend/src/components/GroupInfo/index.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import { style } from '@vanilla-extract/css';

import { vars } from '@/styles';
import { sansRegular16 } from '@/styles/font.css';

export const container = style({
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
gap: '0.8rem',
width: '100%',
padding: '1.6rem',
border: `1px solid ${vars.color.morakGreen}`,
borderRadius: '0.8rem',
textAlign: 'center',
wordBreak: 'break-all',
color: vars.color.morakGreen,
});

export const participants = style([
sansRegular16,
{
display: 'flex',
gap: '0.4rem',
alignItems: 'center',
color: vars.color.grayscale200,
},
]);
24 changes: 24 additions & 0 deletions app/frontend/src/components/GroupInfo/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ReactComponent as People } from '@/assets/icons/people.svg';
import { fontStyle, vars } from '@/styles';

import * as styles from './index.css';

type GroupInfoProps = {
title: string;
participantsCount: number;
};

export function GroupInfo({ title, participantsCount }: GroupInfoProps) {
const { grayscale200 } = vars.color;
const { sansBold20 } = fontStyle;

return (
<div className={styles.container}>
<span className={sansBold20}>{title}</span>
<span className={styles.participants}>
<People width={24} height={24} fill={grayscale200} />
{participantsCount}
</span>
</div>
);
}
10 changes: 10 additions & 0 deletions app/frontend/src/hooks/useRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
ProfilePage,
NotFound,
} from '@/pages';
import { GroupJoinPage } from '@/pages/Group/Join';
import { GroupLinkPage } from '@/pages/Group/Link';
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3 : 이 부분도 '@pages'에서 바로 import 해오도록 수정해도 좋을 것 같습니다.

Copy link
Collaborator Author

@js43o js43o Jan 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=> fd4cdc0, ecaae26 반영했습니다!


export const useRouter = () =>
createBrowserRouter([
Expand Down Expand Up @@ -50,6 +52,14 @@ export const useRouter = () =>
path: 'groups',
element: <Groups />,
},
{
path: 'group/join',
element: <GroupJoinPage />,
},
{
path: 'group/:id',
element: <GroupLinkPage />,
},
],
},
{
Expand Down
50 changes: 50 additions & 0 deletions app/frontend/src/pages/Group/Join/index.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import { style } from '@vanilla-extract/css';

import { vars } from '@/styles';

export const confirmButtons = style({
display: 'flex',
gap: '1.6rem',
});

export const container = style({
display: 'flex',
flexDirection: 'column',
gap: '3.6rem',
maxWidth: '80rem',
margin: '0 auto',
});

export const navLinkButton = style({
width: '100%',
});

export const section = style({
display: 'flex',
flexDirection: 'column',
gap: '2.4rem',
position: 'relative',
opacity: 1,
transition: 'opacity 0.5s, transform 0.5s',

selectors: {
'& + &': {
paddingTop: '2.4rem',
borderTop: `1px solid ${vars.color.grayscale100}`,
},
'&.completed::before': {
position: 'absolute',
zIndex: 10,
width: '100%',
height: '100%',
background: vars.color.grayscaleWhite,
opacity: 0.75,
content: '',
},
'&.disabled': {
transform: 'translateY(-0.8rem)',
visibility: 'hidden',
opacity: 0,
},
},
});
103 changes: 103 additions & 0 deletions app/frontend/src/pages/Group/Join/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
import { useState } from 'react';
import { NavLink } from 'react-router-dom';

import { Button, Input } from '@morak/ui';

import { GroupInfo } from '@/components/GroupInfo';
import { fontStyle } from '@/styles';

import * as styles from './index.css';

export function GroupJoinPage() {
const { sansBold36, sansBold24, sansRegular18 } = fontStyle;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

function 안에서 정의하는 것보다 외부에서 정의하는 게 좋을 것 같아요.
리렌더링될 때마다 구조분해할당도 일어나지 않을까? 싶은...

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

=> 2922361 반영했습니다!


const [currentStep, setCurrentStep] = useState(1);

const getCurrentState = (step: number) => {
if (step > currentStep) {
return 'disabled';
}

if (step < currentStep) {
return 'completed';
}

return '';
};

return (
<div className={styles.container}>
<h2 className={sansBold36}>그룹 참여</h2>
<section className={`${styles.section} ${getCurrentState(1)}`}>
<h3 className={sansBold24}>1. 참여 방법 선택</h3>
<p className={sansRegular18}>어떤 방법으로 그룹에 참여할까요?</p>
<div className={styles.confirmButtons}>
<Button
theme="primary"
shape="line"
size="large"
fullWidth
onClick={() => setCurrentStep(2)}
>
참여 코드로 참여할래요
</Button>
<NavLink to="/groups" className={styles.navLinkButton}>
<Button
type="button"
theme="primary"
shape="line"
size="large"
fullWidth
>
공개된 그룹을 둘러볼래요
</Button>
</NavLink>
</div>
</section>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

css로 컴포넌트의 렌더링을 조정하는 것보다 js로 이렇게 쓰는 게 나을 것 같아요.
혹시 다음과 같은 코드를 작성한 이유가 있다면 알려 주세요!

Suggested change
<section className={`${styles.section} ${getCurrentState(1)}`}>
<h3 className={sansBold24}>1. 참여 방법 선택</h3>
<p className={sansRegular18}>어떤 방법으로 그룹에 참여할까요?</p>
<div className={styles.confirmButtons}>
<Button
theme="primary"
shape="line"
size="large"
fullWidth
onClick={() => setCurrentStep(2)}
>
참여 코드로 참여할래요
</Button>
<NavLink to="/groups" className={styles.navLinkButton}>
<Button
type="button"
theme="primary"
shape="line"
size="large"
fullWidth
>
공개된 그룹을 둘러볼래요
</Button>
</NavLink>
</div>
</section>
{currentStep === 1 && (
<section className={styles.section}>
<h3 className={sansBold24}>1. 참여 방법 선택</h3>
<p className={sansRegular18}>어떤 방법으로 그룹에 참여할까요?</p>
<div className={styles.confirmButtons}>
<Button
theme="primary"
shape="line"
size="large"
fullWidth
onClick={() => setCurrentStep(2)}
>
참여 코드로 참여할래요
</Button>
<NavLink to="/groups" className={styles.navLinkButton}>
<Button
type="button"
theme="primary"
shape="line"
size="large"
fullWidth
>
공개된 그룹을 둘러볼래요
</Button>
</NavLink>
</div>
</section>
)}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

특별한 이유는 아니지만 뭔가 사용자에게 세 단계의 입력 과정이 연속적으로 이루어지고 있다는 느낌을 주고 싶었던 것 같아요.
말씀하신 방법이 더 맞는 방법인 것 같아서 코드에 반영하였고, 대신 Stepper 컴포넌트를 추가해서 연속적인 느낌을 주도록 했습니다..!

bandicam.2024-01-26.18-33-06-250.mp4

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아 이거 미처 놓치고 지나간 부분인데 지나간 부분은 opacity가 낮아지면서 노출이 되는 거였군요...
두 방법 다 아이디어는 좋은 것 같아요 👍

<section className={`${styles.section} ${getCurrentState(2)}`}>
<h3 className={sansBold24}>2. 참여 코드 입력</h3>
<p className={sansRegular18}>참여 코드를 입력해 주세요.</p>
<Input />
<div className={styles.confirmButtons}>
<Button
theme="primary"
shape="line"
size="large"
fullWidth
onClick={() => setCurrentStep(1)}
>
이전으로
</Button>
<Button
theme="primary"
shape="fill"
size="large"
fullWidth
onClick={() => setCurrentStep(3)}
>
확인
</Button>
</div>
</section>
<section className={`${styles.section} ${getCurrentState(3)}`}>
<h3 className={sansBold24}>3. 그룹 확인 및 가입 신청</h3>
<GroupInfo title="부스트캠프 웹·모바일 9기" participantsCount={160} />
<p className={sansRegular18}>이 그룹에 가입 신청할까요?</p>
<div className={styles.confirmButtons}>
<Button
theme="primary"
shape="line"
size="large"
fullWidth
onClick={() => setCurrentStep(2)}
>
이전으로
</Button>
<Button theme="primary" shape="fill" size="large" fullWidth>
가입 신청
</Button>
</div>
</section>
</div>
);
}
22 changes: 22 additions & 0 deletions app/frontend/src/pages/Group/Link/index.css.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { style } from '@vanilla-extract/css';

export const buttons = style({
display: 'flex',
gap: '0.8rem',
});

export const container = style({
display: 'flex',
flexDirection: 'column',
gap: '3.6rem',
margin: '0 auto',
maxWidth: '80rem',
});

export const group = style({
display: 'flex',
flexDirection: 'column',
alignItems: 'center',
justifyContent: 'center',
gap: '1.6rem',
});
30 changes: 30 additions & 0 deletions app/frontend/src/pages/Group/Link/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Button } from '@morak/ui';

import { GroupInfo } from '@/components/GroupInfo';
import { fontStyle } from '@/styles';

import * as styles from './index.css';

export function GroupLinkPage() {
const { sansBold36, sansRegular16 } = fontStyle;

const goBack = () => window.history.back();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3; 뒤로 가기는 window 객체 사용할 건지 react-router-dom 사용할 건지 정하면 좋을 것 같아요.


return (
<div className={styles.container}>
<h2 className={sansBold36}>그룹 참여</h2>
<div className={styles.group}>
<GroupInfo title="부스트캠프 웹·모바일 9기" participantsCount={160} />
<span className={sansRegular16}>이 그룹에 참여할까요?</span>
<div className={styles.buttons}>
<Button theme="primary" shape="line" size="large" onClick={goBack}>
취소
</Button>
<Button theme="primary" shape="fill" size="large">
참여하기
</Button>
</div>
</div>
</div>
);
}
2 changes: 1 addition & 1 deletion app/frontend/src/pages/Groups/index.css.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { style } from '@vanilla-extract/css';

export const container = style({
maxWidth: '72rem',
maxWidth: '80rem',
margin: '0 auto',
});

Expand Down
36 changes: 25 additions & 11 deletions app/frontend/src/pages/Profile/MyGroup/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { NavLink } from 'react-router-dom';

import { Button } from '@morak/ui';
import { useQuery } from '@tanstack/react-query';

import { ReactComponent as ArrowLeft } from '@/assets/icons/arrow_left.svg';
import { Error, Group, LoadingIndicator } from '@/components';
import { queryKeys } from '@/queries';
import { vars } from '@/styles';
Expand Down Expand Up @@ -40,16 +40,30 @@ export function MyGroup() {
<Error message="현재 속한 그룹이 없습니다. 그룹에 참여해 주세요." />
)}
</ul>
<NavLink to="/groups" className={styles.navLinkButton}>
<ArrowLeft
fill={vars.color.morakGreen}
width={24}
height={24}
className={styles.rotateArrow}
/>
그룹 리스트 보기
</NavLink>
<div className={styles.groupButtons}>{/* <Button /> */}</div>
<div className={styles.groupButtons}>
<NavLink to="/group/join" className={styles.navLinkButton}>
<Button
type="button"
theme="primary"
shape="line"
size="large"
fullWidth
>
그룹 참여
</Button>
</NavLink>
<NavLink to="." className={styles.navLinkButton}>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NavLink의 to에 '.'를 할당하면 어떤 동작이 발생하나요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

현재 페이지를 (새로고침 없이) 다시 불러오는 것 같아요. 아직 그룹 생성 페이지에 대한 경로가 정해지지 않아서 일단 임시로 이렇게 작성했습니다!

<Button
type="button"
theme="primary"
shape="line"
size="large"
fullWidth
>
새 그룹 생성
</Button>
</NavLink>
</div>
</section>
);
}
16 changes: 3 additions & 13 deletions app/frontend/src/pages/Profile/index.css.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
import { style } from '@vanilla-extract/css';

import { vars } from '@/styles';
import { sansBold16 } from '@/styles/font.css';

export const container = style({
display: 'flex',
flexDirection: 'column',
Expand All @@ -26,16 +23,9 @@ export const loading = style({
justifyContent: 'center',
});

export const navLinkButton = style([
sansBold16,
{
display: 'flex',
gap: 0,
alignItems: 'center',
alignSelf: 'end',
color: vars.color.morakGreen,
},
]);
export const navLinkButton = style({
width: '100%',
});

export const rotateArrow = style({
transform: 'rotate(180deg)',
Expand Down