File tree Expand file tree Collapse file tree 4 files changed +29
-31
lines changed
packages/common/src/components/MainContents
PageContainer/MissionListPage
components/MissionCarousel Expand file tree Collapse file tree 4 files changed +29
-31
lines changed Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export const MissionText = styled.h4`
16
16
color: ${ ( { theme } ) => theme . color . black } ;
17
17
font-weight: 600;
18
18
margin: 4.0625rem 0 1.25rem;
19
- width: 80rem ;
19
+ width: 100% ;
20
20
` ;
21
21
22
22
export const ContentWrapper = styled . div `
Original file line number Diff line number Diff line change @@ -11,17 +11,22 @@ export const PageWrapper = styled.div`
11
11
12
12
export const ScoringTextContainer = styled . div `
13
13
@media ${ ( { theme } ) => theme . breakPoint [ 1024 ] } {
14
- width: calc(100vw - 20rem );
14
+ width: calc(100vw - 12.5rem );
15
15
}
16
- @media (max-width: 750px) {
17
- width: calc(100vw - 18.5rem);
16
+
17
+ @media ${ ( { theme } ) => theme . breakPoint [ 600 ] } {
18
+ width: calc(100vw - 3rem);
18
19
}
19
20
` ;
20
21
21
22
export const ScoringText = styled . h2 `
22
23
${ ( { theme } ) => theme . typo . h2 }
23
24
color: ${ ( { theme } ) => theme . color . black } ;
24
25
font-weight: 600;
25
- width: 82rem ;
26
+ width: 80rem ;
26
27
margin: 3.75rem 0 1.75rem;
28
+
29
+ @media (max-width: 1240px) {
30
+ width: calc(100vw - 12.5rem);
31
+ }
27
32
` ;
Original file line number Diff line number Diff line change @@ -30,37 +30,36 @@ const MissionCarousel = () => {
30
30
push ( `/mission/resolve/${ missionId } ` ) ;
31
31
} ;
32
32
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 ;
45
42
} ;
46
43
47
- useEffect ( ( ) => {
48
- widthHandle ( ) ;
49
- } , [ width ] ) ;
44
+ const setArray = async ( ) => {
45
+ const cnt = await resetCount ( ) ;
50
46
51
- useEffect ( ( ) => {
52
47
const newMissionList : MissionListItemType [ ] [ ] = [ ] ;
53
48
let temp : MissionListItemType [ ] = [ ] ;
54
49
data ?. forEach ( ( item , index ) => {
55
50
temp . push ( item ) ;
56
- if ( ( index + 1 ) % count === 0 ) {
51
+ if ( ( index + 1 ) % cnt === 0 ) {
57
52
newMissionList . push ( temp ) ;
58
53
temp = [ ] ;
59
54
}
60
55
} ) ;
61
56
if ( data )
62
- newMissionList . push ( data . slice ( newMissionList . length * 10 , data . length ) ) ;
57
+ newMissionList . push ( data . slice ( newMissionList . length * cnt , data . length ) ) ;
63
58
setMissionList ( newMissionList ) ;
59
+ } ;
60
+
61
+ useEffect ( ( ) => {
62
+ setArray ( ) ;
64
63
} , [ data , width ] ) ;
65
64
66
65
const moveLeft = ( ) => {
Original file line number Diff line number Diff line change @@ -10,14 +10,8 @@ export const ContentWrapper = styled.div<{ taskCard?: number }>`
10
10
display: grid;
11
11
grid-template-columns: repeat(${ ( props ) => props . taskCard } , 1fr);
12
12
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;
21
15
` ;
22
16
23
17
export const PointerWrapper = styled . div `
You can’t perform that action at this time.
0 commit comments