Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/carousel game info #425

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@
drop-shadow(2px 0px 40px rgba(61, 11, 111, 0.4))
drop-shadow(2px 0px 32px rgba(61, 11, 111, 0.7))
drop-shadow(2px 0px 8px rgba(61, 11, 111, 0.5));
display: flex;
justify-content: center;
align-items: center;
}
2 changes: 1 addition & 1 deletion src/components/Carousel/components/Controls/BaseButton.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PropsWithChildren } from 'react'
import { PropsWithChildren } from 'react'

import styles from './BaseButton.module.css'

Expand Down
2 changes: 0 additions & 2 deletions src/components/Carousel/components/Controls/LeftButton.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react'

import { ChevronLeft } from '@/assets/images'

import BaseButton, { BaseButtonProps } from './BaseButton'
Expand Down
10 changes: 5 additions & 5 deletions src/components/Carousel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import Controller from './components/Controller'
import styles from './index.module.scss'

export interface SlideData {
title: string
title?: string
slideElement: JSX.Element
thumbnail?: JSX.Element
disableGradient?: boolean
Expand All @@ -22,11 +22,13 @@ export interface Carouselv2Props {
controllerLayout?: 'attached' | 'detached'
canAutoRotate?: boolean
onThumbnailHandler?: (index: number) => void
onSlideChange?: (index: number) => void
}

const Carouselv2 = ({
canAutoRotate = true,
onThumbnailHandler,
onSlideChange,
...props
}: Carouselv2Props) => {
const [activeIndex, setActiveIndex] = useState(0)
Expand Down Expand Up @@ -54,7 +56,7 @@ const Carouselv2 = ({
>
{item.slideElement}
<div className={styles.title}>
<div className={styles.titleText}>{item.title}</div>
{item.title && <div className={styles.titleText}>{item.title}</div>}
{item.button ?? null}
</div>
</Carousel.Slide>
Expand All @@ -71,22 +73,20 @@ const Carouselv2 = ({
}}
plugins={[autoplay.current]}
onMouseEnter={() => {
console.log('canAutoRotate onMouseEnter', canAutoRotate)
if (canAutoRotate) {
autoplay.current.stop()
}
}}
onMouseLeave={() => {
console.log('canAutoRotate onMouseLeave', canAutoRotate)
if (canAutoRotate) {
// Internally it is checking if timer is set, and since it can be, it will make .reset() never work
autoplay.current.stop()
autoplay.current.play()
}
}}
onSlideChange={(index) => {
console.log('onSlideChange', index)
setActiveIndex(index)
onSlideChange?.(index)
}}
loop={true}
withControls={false}
Expand Down
Loading