mirror of
https://github.com/vercel/commerce.git
synced 2025-07-26 03:31:23 +00:00
Add random background color to product page
This commit is contained in:
@@ -6,25 +6,44 @@ import { ArrowLeft, ArrowRight } from '@components/icons'
|
||||
interface ProductSliderControl {
|
||||
onPrev: MouseEventHandler<HTMLButtonElement>
|
||||
onNext: MouseEventHandler<HTMLButtonElement>
|
||||
lighterColor: string
|
||||
darkerColor: string
|
||||
}
|
||||
|
||||
const ProductSliderControl: FC<ProductSliderControl> = ({ onPrev, onNext }) => (
|
||||
<div className={s.control}>
|
||||
<button
|
||||
className={cn(s.leftControl)}
|
||||
onClick={onPrev}
|
||||
aria-label="Previous Product Image"
|
||||
>
|
||||
<ArrowLeft />
|
||||
</button>
|
||||
<button
|
||||
className={cn(s.rightControl)}
|
||||
onClick={onNext}
|
||||
aria-label="Next Product Image"
|
||||
>
|
||||
<ArrowRight />
|
||||
</button>
|
||||
</div>
|
||||
const ProductSliderControl: FC<ProductSliderControl> = ({ onPrev, onNext, lighterColor, darkerColor }) => (
|
||||
<>
|
||||
<style jsx>
|
||||
{`
|
||||
#leftButtonSlider:hover,
|
||||
#rightButtonSlider:hover {
|
||||
background-color: ${lighterColor} !important;
|
||||
}
|
||||
|
||||
#leftButtonSlider,
|
||||
#rightButtonSlider {
|
||||
background-color: ${darkerColor} !important;
|
||||
}
|
||||
`}
|
||||
</style>
|
||||
<div className={s.control}>
|
||||
<button
|
||||
className={cn(s.leftControl)}
|
||||
id="leftButtonSlider"
|
||||
onClick={onPrev}
|
||||
aria-label="Previous Product Image"
|
||||
>
|
||||
<ArrowLeft />
|
||||
</button>
|
||||
<button
|
||||
className={cn(s.rightControl)}
|
||||
id="rightButtonSlider"
|
||||
onClick={onNext}
|
||||
aria-label="Next Product Image"
|
||||
>
|
||||
<ArrowRight />
|
||||
</button>
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
|
||||
export default memo(ProductSliderControl)
|
||||
|
Reference in New Issue
Block a user