Skip to content

Commit 0632545

Browse files
authored
Merge pull request #149 from saseungmin/apply-to-responsive-main-page
[Improve] Apply to responsive in main page
2 parents f6c76fc + b3e7b16 commit 0632545

File tree

5 files changed

+77
-25
lines changed

5 files changed

+77
-25
lines changed

package-lock.json

Lines changed: 34 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
"d2coding": "^1.3.2",
3131
"draft-js": "^0.11.7",
3232
"draftjs-to-html": "^0.9.1",
33+
"facepaint": "^1.2.1",
3334
"firebase": "^8.1.1",
3435
"html-to-draftjs": "^1.5.0",
3536
"immer": "^8.0.0",
@@ -44,6 +45,7 @@
4445
"react-icons": "^4.1.0",
4546
"react-moment": "^1.0.0",
4647
"react-redux": "^7.2.2",
48+
"react-responsive": "^8.2.0",
4749
"react-router-dom": "^5.2.0",
4850
"react-star-ratings": "^2.3.0",
4951
"react-use": "^15.3.4",

src/components/main/StudyGroup.jsx

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,29 @@ import sanitize from 'sanitize-html';
66

77
import Moment from 'react-moment';
88

9+
import facepaint from 'facepaint';
910
import styled from '@emotion/styled';
1011

1112
import Tags from '../common/Tags';
1213
import palette from '../../styles/palette';
1314
import DateTimeChange from '../common/DateTimeChange';
1415

15-
const StudyGroupWrapper = styled.div`
16-
display: flex;
17-
flex-direction: column;
18-
overflow: hidden;
19-
margin: 1rem;
20-
border-radius: 4px;
21-
border: 2px solid ${palette.gray[4]};
22-
width: 19rem;
23-
box-shadow: rgba(0, 0, 0, 0.04) 0px 4px 16px 0px;
24-
background: rgb(248, 249, 250);
25-
`;
16+
const mq = facepaint([
17+
'@media(min-width: 767px)',
18+
'@media(min-width: 1024px)',
19+
]);
20+
21+
const StudyGroupWrapper = styled.div(() => mq({
22+
display: 'flex',
23+
flexDirection: 'column',
24+
overflow: 'hidden',
25+
margin: ['1rem 0px 0px 0px', '.5rem', '1rem'],
26+
borderRadius: '4px',
27+
border: `2px solid ${palette.gray[4]}`,
28+
width: ['100%', 'calc(50% - 2rem)', '19rem'],
29+
boxShadow: 'rgba(0, 0, 0, 0.08) 0px 4px 16px 0px',
30+
background: 'rgb(248, 249, 250)',
31+
}));
2632

2733
const HeaderLink = styled(Link)`
2834
display: block;

src/styles/Button.jsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,25 @@ import React from 'react';
33

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

6+
import facepaint from 'facepaint';
67
import styled from '@emotion/styled';
78
import { css } from '@emotion/react';
89

910
import palette from './palette';
1011

12+
const mq = facepaint([
13+
'@media(min-width: 1024px)',
14+
]);
15+
16+
const fontSizeButton = css(
17+
mq({
18+
fontSize: ['2vw', '1rem'],
19+
}),
20+
);
21+
1122
const ButtonWrapper = ({ warn, success }) => css`
1223
cursor: pointer;
13-
font-size: 1rem;
24+
${fontSizeButton};
1425
font-weight: bold;
1526
font-family: 'Noto Sans KR', sans-serif;
1627
outline: none;

src/styles/Responsive.jsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
/* eslint-disable react/jsx-props-no-spreading */
22
import React from 'react';
33

4+
import facepaint from 'facepaint';
45
import styled from '@emotion/styled';
56

6-
const ResponsiveContainer = styled.div`
7-
margin: 0 auto;
8-
padding-left: 1rem;
9-
padding-right: 1rem;
10-
width: 1024px;
7+
const mq = facepaint([
8+
'@media(min-width: 1024px)',
9+
'@media(min-width: 1150px)',
10+
]);
1111

12-
@media (max-width: 1024px) {
13-
width: 768px;
14-
}
15-
16-
@media (max-width: 768px) {
17-
width: 100%;
18-
}
19-
`;
12+
const ResponsiveContainer = styled.div(() => mq({
13+
marginLeft: 'auto',
14+
marginRight: 'auto',
15+
paddingLeft: '1rem',
16+
paddingRight: '1rem',
17+
width: ['calc(100% - 2rem)', '680px', '1024px'],
18+
}));
2019

2120
const Responsive = ({ children, ...rest }) => (
2221
<ResponsiveContainer {...rest}>

0 commit comments

Comments
 (0)