Skip to content
Merged
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
2 changes: 1 addition & 1 deletion src/App.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ describe('App', () => {
it('renders the study list page', () => {
const { container } = renderApp({ path: '/' });

expect(container).toHaveTextContent('스터디 목록');
expect(container).toHaveTextContent('지금 바로 시작하세요!');
});
});

Expand Down
32 changes: 30 additions & 2 deletions src/components/common/Tags.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,29 @@ import React from 'react';

import styled from '@emotion/styled';

const TagsWrapper = styled.div``;
import { Link } from 'react-router-dom';

import palette from '../../styles/palette';

const TagsWrapper = styled.div`
margin-top: 1rem;
.lang {
display: inline-flex;
align-items: center;
padding-left: .6em;
padding-right: .6em;
height: 3em;
font-weight: bold;
font-size: .6em;
border-radius: .6em;
margin-right: 0.5rem;
color: ${palette.teal[7]};
background:${palette.gray[1]};
&:hover {
color: ${palette.teal[5]};
}
Comment on lines +21 to +25

Choose a reason for hiding this comment

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

색깔 목록을 만들어 놓고 색깔을 사용하신 것 같아요 ㅎㅎ 왜 TagsWrapper의 색깔이 teal[7]인지는 이해하기 어려운 것 같아요. 이 색상이 어떤 이유로 이 색으로 결정되었는지 의미를 드러내주면 좋을 것 같아요. 그래야 다른 곳에서 색깔을 사용할 때 더 좋을 거 같아요.

디자인을 할 때 무분별하게 색깔을 사용하는 것이 아닌 정해진 색깔들을 정의를 하는데 main 색깔 sub색깔 등등을 정하는데
메인 색깔이라던지 혹은 강조 색깔이라던지 더 의미를 드러내면 좋을 것 같아요

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

  • 현재 이런식으로 색상 순서대로 되어있는 부분을
    2
const palette = {
  tagMain: '#f8f9fa',
  tagHover: '#66d9e8',
  // ...
}

export default palette;
  • 이런식으로 각 색상의 의미를 드러내서 사용하라는 말씀이신건가요?? 🤔

}
`;

const Tags = ({ tags }) => {
if (!tags || !tags.length) {
Expand All @@ -12,7 +34,13 @@ const Tags = ({ tags }) => {
return (
<TagsWrapper>
{tags.map((tag) => (
<small key={tag}>{`#${tag}`}</small>
<Link
key={tag}
to="/#"
className="lang"
>
{`#${tag}`}
</Link>
))}
</TagsWrapper>
);
Expand Down
10 changes: 7 additions & 3 deletions src/components/common/Tags.test.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import React from 'react';

import { MemoryRouter } from 'react-router-dom';

import { render } from '@testing-library/react';

import Tags from './Tags';

describe('Tags', () => {
const renderTags = (tags) => render((
<Tags
tags={tags}
/>
<MemoryRouter>
<Tags
tags={tags}
/>
</MemoryRouter>
));

context('with tags', () => {
Expand Down
10 changes: 7 additions & 3 deletions src/components/introduce/StudyIntroduceForm.test.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import React from 'react';

import { MemoryRouter } from 'react-router-dom';

import { render } from '@testing-library/react';

import StudyIntroduceForm from './StudyIntroduceForm';

describe('StudyIntroduceForm', () => {
const renderStudyIntroduceForm = ({ group }) => render((
<StudyIntroduceForm
group={group}
/>
<MemoryRouter>
<StudyIntroduceForm
group={group}
/>
</MemoryRouter>
));

it('renders study group title and contents', () => {
Expand Down
59 changes: 48 additions & 11 deletions src/components/main/StudyGroup.jsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,55 @@
import React from 'react';

import { Link } from 'react-router-dom';

import styled from '@emotion/styled';

import Tags from '../common/Tags';
import palette from '../../styles/palette';

const StudyGroupWrapper = styled.div``;
const StudyGroupWrapper = styled.div`
margin: 1em .5em 1em .5em;
padding: 2em 0 1em 1em;
width: 28%;
border: 2px solid ${palette.gray[4]};
border-radius: 1rem;
`;

const HeaderLink = styled(Link)`
font-size: 1.5em;
margin-bottom: 0;
margin-top: 0;
font-weight: bold;
display: flex;
align-items: center;
justify-content: center;
font-size: 2rem;
font-weight: 500;
font-family: 'Nanum Pen Script', cursive;
&:hover {
color: gray;
color: ${palette.gray[6]};
}
`;

const StudyInfoWrapper = styled.div`
margin: 1rem 0 1rem 0;
.moderator{
margin-bottom: 1rem;
color: ${palette.gray[5]};
font-weight: bold;
}
`;

const DateTimeChange = styled.div`
margin-left: 1.5rem;
font-weight: 600;
font-size: 1.1rem;
font-family: 'Gamja Flower', cursive;
padding: .1rem .5rem .1rem .5rem;
display: inline-flex;
color: white;
border-radius: 0.5rem;
margin-top: 1rem;
margin-bottom: 1rem;
background: ${palette.cyan[4]};
`;

const StudyGroup = ({ group }) => {
const {
id, moderatorId, title, personnel, applyEndDate, tags, participants,
Expand All @@ -26,14 +60,17 @@ const StudyGroup = ({ group }) => {
<HeaderLink to={`/introduce/${id}`}>
{title}
</HeaderLink>
<div>
<small>{moderatorId}</small>
<div>{`모집 인원: ${participants.length} / ${personnel}`}</div>
<StudyInfoWrapper>
<div className="moderator">{moderatorId}</div>
<div>
{`모집 인원: ${participants.length} / ${personnel}`}
<DateTimeChange>모집중</DateTimeChange>
</div>
<div>
<div>{`마감 일자: ${applyEndDate}`}</div>
{`마감 일자: ${applyEndDate}`}
</div>
<Tags tags={tags} />
</div>
</StudyInfoWrapper>
</StudyGroupWrapper>
);
};
Expand Down
7 changes: 6 additions & 1 deletion src/components/main/StudyGroups.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import styled from '@emotion/styled';

import StudyGroup from './StudyGroup';

const StudyGroupsWrapper = styled.div``;
const StudyGroupsWrapper = styled.div`
display: flex;
flex-direction: row;
flex-wrap: wrap;
align-content: space-between;
`;

const StudyGroups = ({ groups }) => (
<StudyGroupsWrapper>
Expand Down
8 changes: 1 addition & 7 deletions src/containers/groups/StudyGroupsContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ import React from 'react';

import { useSelector } from 'react-redux';

import styled from '@emotion/styled';

import StudyGroups from '../../components/main/StudyGroups';
import { get } from '../../../utils';

const StudyGroupsContainerBlock = styled.div``;

const StudyGroupsContainer = () => {
const groups = useSelector(get('groups'));

Expand All @@ -17,9 +13,7 @@ const StudyGroupsContainer = () => {
}

return (
<StudyGroupsContainerBlock>
<StudyGroups groups={groups} />
</StudyGroupsContainerBlock>
<StudyGroups groups={groups} />
);
};

Expand Down
9 changes: 6 additions & 3 deletions src/containers/introduce/IntroduceContainer.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { useDispatch, useSelector } from 'react-redux';

import { render } from '@testing-library/react';

import { MemoryRouter } from 'react-router-dom';
import IntroduceContainer from './IntroduceContainer';

describe('IntroduceContainer', () => {
Expand All @@ -19,9 +20,11 @@ describe('IntroduceContainer', () => {
}));
});

const renderIntroduceContainer = ({ id }) => render(
<IntroduceContainer groupId={id} />,
);
const renderIntroduceContainer = ({ id }) => render((
<MemoryRouter>
<IntroduceContainer groupId={id} />
</MemoryRouter>
));

context('with group', () => {
given('group', () => ({
Expand Down
10 changes: 10 additions & 0 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
@import url('https://fonts.googleapis.com/css2?family=Gamja+Flower&family=Nanum+Pen+Script&display=swap');
/*
font-family: 'Gamja Flower', cursive;
font-family: 'Nanum Pen Script', cursive;
*/

* {
box-sizing: inherit;
}
Expand All @@ -6,3 +12,7 @@ a {
color: inherit;
text-decoration: none;
}

body {
margin: 0;
}
1 change: 1 addition & 0 deletions src/pages/IntroducePage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import React from 'react';
import { useParams } from 'react-router-dom';

import styled from '@emotion/styled';

import IntroduceContainer from '../containers/introduce/IntroduceContainer';

const IntroducePageWrapper = styled.div``;
Expand Down
8 changes: 5 additions & 3 deletions src/pages/IntroducePage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,11 @@ describe('IntroducePage', () => {
it('renders title', () => {
const params = { id: '1' };

const { container } = render(
<IntroducePage params={params} />,
);
const { container } = render((
<MemoryRouter>
<IntroducePage params={params} />
</MemoryRouter>
));

expect(container).toHaveTextContent('스터디를 소개합니다. 1');
});
Expand Down
7 changes: 5 additions & 2 deletions src/pages/MainPage.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@ import styled from '@emotion/styled';

import { loadStudyGroups } from '../reducers/slice';
import StudyGroupsContainer from '../containers/groups/StudyGroupsContainer';
import Responsive from '../styles/Responsive';

const MainPageWrapper = styled.div``;
const MainPageWrapper = styled(Responsive)`

`;

const MainPage = () => {
const dispatch = useDispatch();
Expand All @@ -18,7 +21,7 @@ const MainPage = () => {

return (
<MainPageWrapper>
<h2>스터디 목록</h2>
<h2>지금 바로 시작하세요!</h2>
<StudyGroupsContainer />
</MainPageWrapper>
);
Expand Down
2 changes: 1 addition & 1 deletion src/pages/MainPage.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('MainPage', () => {
it('renders Main Page Title', () => {
const { container } = renderMainPage();

expect(container).toHaveTextContent('스터디 목록');
expect(container).toHaveTextContent('지금 바로 시작하세요!');
});

it('calls dispatch with loadStudyGroups action', () => {
Expand Down
26 changes: 26 additions & 0 deletions src/styles/Responsive.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* eslint-disable react/jsx-props-no-spreading */
import React from 'react';

import styled from '@emotion/styled';

const ResponsiveContainer = styled.div`
padding-left: 1rem;
padding-right: 1rem;
width: 1024px;
margin: 0 auto;

@media (max-width: 1024px) {
width: 768px;
}
@media (max-width: 768px) {
width: 100%;
}
`;

const Responsive = ({ children, ...rest }) => (
<ResponsiveContainer {...rest}>
{children}
</ResponsiveContainer>
);

export default Responsive;
Loading