@@ -9,6 +9,7 @@ import styled from "styled-components";
99import Image from "next/image" ;
1010import Link from "next/link" ;
1111import useEmblaCarousel from "embla-carousel-react" ;
12+ import { MaxScreenSize } from "./tokens" ;
1213
1314type Edition = {
1415 url : string ;
@@ -23,8 +24,9 @@ type PropType = {
2324const Embla = styled . div `
2425 position: relative;
2526 display: flex;
26- max-width: 100%;
27- margin: 0 auto;
27+ justify-content: center;
28+ align-items: center;
29+ width: 100%;
2830 padding-top: 20px;
2931 background-color: #65936d;
3032 --slide-spacing: 1rem;
@@ -37,6 +39,8 @@ const Embla = styled.div`
3739
3840const EmblaViewport = styled . div `
3941 overflow: hidden;
42+ max-width: ${ MaxScreenSize } ;
43+ width: 100%;
4044` ;
4145
4246const EmblaContainer = styled . div `
@@ -80,6 +84,16 @@ const ArrowButton = styled.button`
8084 justify-content: center;
8185` ;
8286
87+ const RightArrowButton = styled ( ArrowButton ) `
88+ margin-left: 10px;
89+ margin-right: 20px;
90+ ` ;
91+
92+ const LeftArrowButton = styled ( ArrowButton ) `
93+ margin-left: 20px;
94+ margin-right: 10px;
95+ ` ;
96+
8397const EmblaCarousel : React . FC < PropType > = ( { slides, options } ) => {
8498 const [ emblaRef , emblaApi ] = useEmblaCarousel ( options , [ ] ) ;
8599
@@ -112,14 +126,14 @@ const EmblaCarousel: React.FC<PropType> = ({ slides, options }) => {
112126
113127 return (
114128 < Embla >
115- < ArrowButton className = "embla__prev" onClick = { scrollPrev } >
129+ < LeftArrowButton className = "embla__prev" onClick = { scrollPrev } >
116130 < Image
117131 src = "/ThroughTheYears/LeftArrow.svg"
118132 alt = "Previous"
119133 width = "100"
120134 height = "75"
121135 />
122- </ ArrowButton >
136+ </ LeftArrowButton >
123137 < EmblaViewport ref = { emblaRef } >
124138 < EmblaContainer >
125139 { slides . map ( ( edition , index ) => (
@@ -147,14 +161,14 @@ const EmblaCarousel: React.FC<PropType> = ({ slides, options }) => {
147161 ) ) }
148162 </ EmblaContainer >
149163 </ EmblaViewport >
150- < ArrowButton className = "embla__next" onClick = { scrollNext } >
164+ < RightArrowButton className = "embla__next" onClick = { scrollNext } >
151165 < Image
152166 src = "/ThroughTheYears/RightArrow.svg"
153167 alt = "Next"
154168 width = "100"
155169 height = "75"
156170 />
157- </ ArrowButton >
171+ </ RightArrowButton >
158172 </ Embla >
159173 ) ;
160174} ;
0 commit comments