{moderatorId}
- {`모집 인원: ${participants.length} / ${personnel}`}
- 모집중
+
- {`마감 일자: ${applyEndDate}`}
+ {'마감 일자: '}
+ {applyEndDate}
diff --git a/src/components/main/StudyGroup.test.jsx b/src/components/main/StudyGroup.test.jsx
index 97f5318..d7a8c30 100644
--- a/src/components/main/StudyGroup.test.jsx
+++ b/src/components/main/StudyGroup.test.jsx
@@ -15,20 +15,43 @@ describe('StudyGroup', () => {
));
- it('renders study group text contents', () => {
+ describe('renders study group text contents', () => {
const group = {
id: 1,
- moderatorId: 'user1',
- title: '스터디를 소개합니다. 1',
- personnel: 5,
- participants: [],
- applyEndDate: null,
- tags: [],
+ title: '스터디를 소개합니다.2',
+ moderatorId: 'user2',
+ applyEndDate: '2020-12-23',
+ participants: [
+ 'user2',
+ ],
+ personnel: 2,
+ tags: [
+ 'JavaScript',
+ 'React',
+ 'Algorithm',
+ ],
};
+ it('renders title, moderatorId, tags', () => {
+ const { container } = renderStudyGroup({ group });
- const { container } = renderStudyGroup({ group });
+ expect(container).toHaveTextContent('스터디를 소개합니다.2');
+ expect(container).toHaveTextContent('user2');
+ group.tags.forEach((tag) => {
+ expect(container).toHaveTextContent(`#${tag}`);
+ });
+ expect(container).toHaveTextContent('2020년 12월 23일');
+ });
- expect(container).toHaveTextContent('스터디를 소개합니다. 1');
- expect(container).toHaveTextContent('user1');
+ it('renders changed applyEndDate format', () => {
+ const { container } = renderStudyGroup({ group });
+
+ expect(container).toHaveTextContent('2020년 12월 23일');
+ });
+
+ it('renders study status is Recruiting', () => {
+ const { container } = renderStudyGroup({ group });
+
+ expect(container).toHaveTextContent('모집중');
+ });
});
});
diff --git a/src/styles/DateTimeStatus.jsx b/src/styles/DateTimeStatus.jsx
new file mode 100644
index 0000000..b8e38a5
--- /dev/null
+++ b/src/styles/DateTimeStatus.jsx
@@ -0,0 +1,50 @@
+import React from 'react';
+
+import styled from '@emotion/styled';
+import { css } from '@emotion/react';
+
+import palette from './palette';
+
+const DateTimeStatusWrapper = 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;
+
+ ${(props) => props.status === 'recruit'
+ && css`
+ background: ${palette.cyan[4]};
+ animation: blink-animation 1.5s steps(5, start) infinite;
+ -webkit-animation: blink-animation 1.5s steps(5, start) infinite;
+ @keyframes blink-animation {
+ to {
+ visibility: hidden;
+ }
+ }
+ @-webkit-keyframes blink-animation {
+ to {
+ visibility: hidden;
+ }
+ }
+ `}
+
+
+ ${(props) => props.status === 'deadline'
+ && css`
+ background: #ff6b6b;
+ `}
+`;
+
+const DateTimeStatus = ({ children, status }) => (
+