Skip to content

Commit 4384da7

Browse files
authored
Merge pull request #97 from Stack-Knowledge/hotfix/responsive
[Hotfix] Update responsive
2 parents d3e07ce + 3a5990f commit 4384da7

File tree

4 files changed

+29
-31
lines changed

4 files changed

+29
-31
lines changed

packages/common/src/components/MainContents/style.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const MissionText = styled.h4`
1616
color: ${({ theme }) => theme.color.black};
1717
font-weight: 600;
1818
margin: 4.0625rem 0 1.25rem;
19-
width: 80rem;
19+
width: 100%;
2020
`;
2121

2222
export const ContentWrapper = styled.div`

projects/client/src/PageContainer/MissionListPage/style.ts

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,22 @@ export const PageWrapper = styled.div`
1111

1212
export const ScoringTextContainer = styled.div`
1313
@media ${({ theme }) => theme.breakPoint[1024]} {
14-
width: calc(100vw - 20rem);
14+
width: calc(100vw - 12.5rem);
1515
}
16-
@media (max-width: 750px) {
17-
width: calc(100vw - 18.5rem);
16+
17+
@media ${({ theme }) => theme.breakPoint[600]} {
18+
width: calc(100vw - 3rem);
1819
}
1920
`;
2021

2122
export const ScoringText = styled.h2`
2223
${({ theme }) => theme.typo.h2}
2324
color: ${({ theme }) => theme.color.black};
2425
font-weight: 600;
25-
width: 82rem;
26+
width: 80rem;
2627
margin: 3.75rem 0 1.75rem;
28+
29+
@media (max-width: 1240px) {
30+
width: calc(100vw - 12.5rem);
31+
}
2732
`;

projects/client/src/components/MissionCarousel/index.tsx

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -30,37 +30,36 @@ const MissionCarousel = () => {
3030
push(`/mission/resolve/${missionId}`);
3131
};
3232

33-
const widthHandle = () => {
34-
if (852 <= width && width <= 1920) {
35-
setCount(10);
36-
} else if (610 <= width && width < 852) {
37-
setCount(8);
38-
} else if (525 <= width && width < 610) {
39-
setCount(6);
40-
} else if (281 <= width && width < 525) {
41-
setCount(4);
42-
} else {
43-
setCount(2);
44-
}
33+
const resetCount = async () => {
34+
let cnt: number;
35+
if (width > 1480) cnt = 10;
36+
else if (width > 1020) cnt = 8;
37+
else if (width > 515) cnt = 6;
38+
else if (width > 380) cnt = 4;
39+
else cnt = 2;
40+
await setCount(cnt);
41+
return cnt;
4542
};
4643

47-
useEffect(() => {
48-
widthHandle();
49-
}, [width]);
44+
const setArray = async () => {
45+
const cnt = await resetCount();
5046

51-
useEffect(() => {
5247
const newMissionList: MissionListItemType[][] = [];
5348
let temp: MissionListItemType[] = [];
5449
data?.forEach((item, index) => {
5550
temp.push(item);
56-
if ((index + 1) % count === 0) {
51+
if ((index + 1) % cnt === 0) {
5752
newMissionList.push(temp);
5853
temp = [];
5954
}
6055
});
6156
if (data)
62-
newMissionList.push(data.slice(newMissionList.length * 10, data.length));
57+
newMissionList.push(data.slice(newMissionList.length * cnt, data.length));
6358
setMissionList(newMissionList);
59+
};
60+
61+
useEffect(() => {
62+
setArray();
6463
}, [data, width]);
6564

6665
const moveLeft = () => {

projects/client/src/components/MissionCarousel/style.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,8 @@ export const ContentWrapper = styled.div<{ taskCard?: number }>`
1010
display: grid;
1111
grid-template-columns: repeat(${(props) => props.taskCard}, 1fr);
1212
grid-template-rows: repeat(2, 1fr);
13-
gap: 4.125rem 3rem;
14-
15-
@media ${({ theme }) => theme.breakPoint[1024]} {
16-
width: calc(100vw - 20rem);
17-
}
18-
@media (max-width: 750px) {
19-
width: calc(100vw - 18.5rem);
20-
}
13+
gap: 4.125rem 2.5rem;
14+
width: fit-content;
2115
`;
2216

2317
export const PointerWrapper = styled.div`

0 commit comments

Comments
 (0)