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

결과 페이지/사이드 메뉴 #12

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
21 changes: 21 additions & 0 deletions packages/dodam-components/src/components/Card/Card.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import React from 'react';
import { Story, Meta } from '@storybook/react/types-6-0';
import Card, { CardProps } from './Card';

export default {
title: 'Card',
component: Card,
} as Meta;

const Template: Story<CardProps> = (args) => <Card {...args} />;

const defaultParams = {
imageSrc:'image',
title:'title',
description:'수원 연합 창작 동아리 그 노래 회원모집',
};

export const Default = Template.bind({});
Default.args = defaultParams;


47 changes: 47 additions & 0 deletions packages/dodam-components/src/components/Card/Card.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
import React from 'react';
import classNames from 'classnames';
Copy link
Collaborator

Choose a reason for hiding this comment

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

classNames는 사용되지 않고 있어요!


export interface CardProps extends React.HTMLAttributes<HTMLDivElement> {
imageSrc?:string;
label?:string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

label은 어디세 사용되나요??

description?:string;
}
function Card({ label, imageSrc,description }: CardProps) {


return (
<div className="col">
<div className="card border-light">
<style jsx>
{`

.card {
width: 146px;
}

.card-body {
padding: 8px;
}
.card-text {
font-size: 12px;
}

.card-img-top {
width: 146px;
height: 146px;
background-color: #aaa;
cursor: pointer;
border-radius: 6px;
}
`}
</style>
Comment on lines +15 to +37
Copy link
Collaborator

Choose a reason for hiding this comment

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

style jsx가 html코드 앞에 있어서 스타일이 적용되지 않고있습니다😭 style jsx는 html 코드 아래 위치하게 변경해주세요!

<img src={imageSrc} className="card-img-top" alt="..." />
Copy link
Collaborator

Choose a reason for hiding this comment

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

alt는 ... 대신 다른걸로 정하는게 좋아보입니다!

<div className="card-body">
<p className="card-text">{description}</p>
Copy link
Collaborator

Choose a reason for hiding this comment

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

모든 웹 페이지에서 공통적인 텍스트를 유지할 수 있도록 텍스트는 Typography컴포넌트를 사용해주세요

</div>
</div>
</div>
);
}

export default Card;
2 changes: 2 additions & 0 deletions packages/dodam-components/src/components/Card/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from './Card';
export type { CardProps } from './Card';
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import React from 'react';
import { Story, Meta } from '@storybook/react/types-6-0';
import Sidebar, { SidebarProps } from './Sidebar';

export default {
title: 'Sidebar',
component: Sidebar,
} as Meta;

const Template: Story<SidebarProps> = (args) => <Sidebar {...args} />;

const defaultParams = {
title:'title',
};

export const Default = Template.bind({});
Default.args = defaultParams;


74 changes: 74 additions & 0 deletions packages/dodam-components/src/components/SideBar/Sidebar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
import React from 'react';

// TODO: 네비게이션에 맞는 이미지 설정 + background-color gui에 맞게 수정
Copy link
Collaborator

Choose a reason for hiding this comment

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

이 주석은 삭제해주세요..!

export interface SidebarProps extends React.HTMLAttributes<HTMLHeadElement> {
title: string;
Copy link
Collaborator

Choose a reason for hiding this comment

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

title이라는 props는 sidebar에서 사용되지않고 있어요ㅠ

}
Comment on lines +4 to +6
Copy link
Collaborator

Choose a reason for hiding this comment

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

sidebar는 Head 태그를 사용하고 있지 않아서 Head의 속성을 확장하는것보다는 HTMLDivElement의 속성을 확장하는게 좋아보여요

const Sidebar = React.forwardRef<HTMLHeadElement, SidebarProps>((props, ref) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

ref를 전달하는 재사용가능한 ui 컴포넌트를 만드는게 아니라면 fowardRef를 사용하지 않아도 됩니다

const { title, ...rest } = props;

return (
<div className="sidenav">
<style jsx>
{`
.sidenav {
width: 260px;
height: 640px;
position: fixed;
z-index: 1;
top: 0px;
left: 0px;
padding:15px;



}


.profile-image {
background: #EDEDED 0% 0% no-repeat padding-box;
opacity: 1;
width: 66px;

height: 66px;
border-radius: 50%;
margin: 10px;
}
.sidebar-line{
border: 1px solid #CDCDCD;
text-align:center;
margin:8px;
}
.list-group-item{
border:none;
margin:5px;
font-weight:bold;

}
span{
font-size:14px;

}
`}
</style>
Comment on lines +12 to +53
Copy link
Collaborator

Choose a reason for hiding this comment

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

card 컴포넌트와 마찬가지로 style jsx가 위에 위치하고 있어서 적용되지 않고 있어요

<img className="profile-image" />
<span>
로그인이 필요합니다
</span>
<i className='fas fa-angle-right'></i>

<hr className="sidebar-line"/>
<ul className="list-group">
<li className="list-group-item">홈</li>
<li className="list-group-item">맞춤 동아리 테스트</li>
<li className="list-group-item">동아리 등록</li>
<li className="list-group-item">등록한 게시물</li>
<li className="list-group-item">스크랩 동아리</li>
<li className="list-group-item">고객센터</li>
<li className="list-group-item">로그인</li>
</ul>
</div>
);
});

export default Sidebar;
2 changes: 2 additions & 0 deletions packages/dodam-components/src/components/SideBar/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from './Sidebar';
export type { SidebarProps } from './Sidebar';
4 changes: 4 additions & 0 deletions packages/dodam-components/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,7 @@ export type { NavigationProps } from './components/Navigation';

export { default as DatePicker } from './components/DatePicker';
export type { DateProps } from './components/DatePicker';


export { default as Card } from './components/Card';
export type { CardProps } from './components/Card';
5 changes: 5 additions & 0 deletions packages/dodam-server/routes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,9 @@ router.get('/', (req, res) => {
res.render('index', { title: 'Express' });
});

/* GET result page. */
router.get('/result', (req, res) => {
res.render('result', { title: 'Express' });
});

Comment on lines +10 to +14
Copy link
Collaborator

Choose a reason for hiding this comment

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

라우터를 추가한 이유가 있을까요? 🤔

module.exports = router;
5 changes: 5 additions & 0 deletions packages/dodam-server/routes/users.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,9 @@ router.get('/', function (req, res) {
res.send('respond with a resource');
});

/* GET result page. */
router.get('/result', (req, res) => {
res.render('result', { title: 'Express' });
});

module.exports = router;
95 changes: 95 additions & 0 deletions packages/dodam/pages/result.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
import { Typography, Button, Card } from '@dodam/components';

export default function Result() {
const mode = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

mode를 숫자로 구분하면 1이 어떤 모드를 나타내는지 알기 어려워요 아래 예시처럼 상수를 사용해주세요!

const READ_MODE = 1;
const WRITE_MODE = 2;

const mode = READ_MODE;

Copy link
Collaborator

Choose a reason for hiding this comment

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

그리고 함수 컴포넌트 내부에서 데이터는 useState을 사용해주셔야 해요. 지금 코드로는 mode의 값이 변경이 되도 render가 일어나지 않기 때문에 변화가 발생하지 않아요.
만약 mode의 값이 변해도 render가 발생하지 않기 원하면 useRef를 사용하는게 바람직해보입니다!

return (
<>
<div className="result">
<style jsx>
{`
.result-top {
background-color: #fff6d9;
padding: 50px;
text-align: center;

height: 289px;
}

.result-image {
background: #ffffff 0% 0% no-repeat padding-box;
box-shadow: 0px 10px 15px #0000001c;
opacity: 1;
width: 152px;
height: 152px;
border-radius: 50%;
margin: 20px;
}
.result-bottom {
padding: 50px 10px 20px 10px;
}

.row {
padding: 10px;
}

.recommendation {
padding: 30px 10px;
}
`}
</style>
Comment on lines +8 to +39
Copy link
Collaborator

Choose a reason for hiding this comment

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

styled jsx가 여기에서도 적용되지 않고 있어요!
그리고 padding이랑 margin값은 8px 배수에 맞게 수정부탁드립니다. xd에 있는 값과 달라도 괜찮습니다. 이유는 링크를 참고하면 도움이 될거에요

<div className="result-top">
<Typography className="header" align="center" variant="h5">
김도담님은
</Typography>
<Typography className="header" align="center" variant="h3" weight="bolder">
이상적인 세상을
</Typography>
<Typography className="header" align="center" variant="h3" weight="bolder">
만들어가시는군요!
</Typography>
<img className="result-image" />
Copy link
Collaborator

Choose a reason for hiding this comment

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

alt props를 추가해주세요

</div>
<div className="result-bottom">
<Typography weight="bolder">분석 결과</Typography>
<Typography>
상세 분석 결과입니다 상세분석 결과입니다. 상세 분석 결과입니다 상세분석 결과입니다. 상세분석 결과입니다
상세분석 결과입니다. 분석 결과입니다. 상세 분석 결과입니다 상세분석 결과입니다. 상세 분석 결과입니다
상세분석 결과입니다. 상세분석 결과입니다 상세분석 결과입니다. 분석 결과입니다. 상세 분석 결과입니다 상세분석
결과입니다. 상세분석 결과입니다 상세분석 결과입니다. 분석 결과입니다.
</Typography>
<div className="row">
<Button id="btn-1" outline fullWidth variant="secondary">
결과 공유
</Button>
</div>
{mode === 2 && (
<div className="row">
<Button id="btn-2" variant="secondary" fullWidth>
동아리 등록 완료
</Button>
</div>
)}
</div>
</div>
{mode === 1 && (
<>
<div className="result-line"></div>
Copy link
Collaborator

Choose a reason for hiding this comment

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

jsx에서는 <div />도 가능합니다

<div className="recommendation">
<Typography className="header" align="center" variant="h5" weight="bolder">
이 동아리를 추천드려요!
</Typography>

<div className="row">
<Card />
<Card />
<Card />
<Card />
</div>

<Button fullWidth>더보기</Button>
</div>
</>
)}
Comment on lines +40 to +92
Copy link
Collaborator

Choose a reason for hiding this comment

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

이부분을 컴포넌트 단위로 쪼개면 코드 가독성이 높아질것같아요!

</>
);
}