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 numberDiff line numberDiff 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 numberDiff line numberDiff 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

Copy link
Copy Markdown

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
Copy Markdown
CollaboratorAuthor

Choose a reason for hiding this comment

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

  • ํ˜„์žฌ ์ด๋Ÿฐ์‹์œผ๋กœ ์ƒ‰์ƒ ์ˆœ์„œ๋Œ€๋กœ ๋˜์–ด์žˆ๋Š” ๋ถ€๋ถ„์„
    2
constpalette={tagMain: '#f8f9fa',tagHover: '#66d9e8',// ...}exportdefaultpalette;
  • ์ด๋Ÿฐ์‹์œผ๋กœ ๊ฐ ์ƒ‰์ƒ์˜ ์˜๋ฏธ๋ฅผ ๋“œ๋Ÿฌ๋‚ด์„œ ์‚ฌ์šฉํ•˜๋ผ๋Š” ๋ง์”€์ด์‹ ๊ฑด๊ฐ€์š”?? ๐Ÿค”

}
`;

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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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 numberDiff line numberDiff 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