Refactor(SW-1669): Carousel Cards Enhancements * feat(SW-1669): Enhance Filters component with scroll shadows and heart icon * feat(SW-1669): Carousel peek next card * fix(SW-1669): carousel review comments * feat(SW-1669): Add left scroll shadow to TabFilters component * refactor(SW-1669): Simplify TabFilters shadow styling * refactor(SW-1669): Adjust TabFilters shadow width * refactor(SW-1699): Remove unused import from enter details store Approved-by: Christian Andolf
62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
"use client"
|
|
|
|
import { cx } from "class-variance-authority"
|
|
|
|
import { HeartIcon } from "@/components/Icons"
|
|
import useScrollShadows from "@/hooks/useScrollShadows"
|
|
|
|
import styles from "./tabFilters.module.css"
|
|
|
|
import type { CardGalleryFilter } from "@/types/enums/cardGallery"
|
|
import type { CarouselCardFilter } from "@/types/enums/carouselCards"
|
|
|
|
interface Filter {
|
|
identifier: CarouselCardFilter | CardGalleryFilter
|
|
label: string
|
|
}
|
|
|
|
interface TabFiltersProps {
|
|
categories: Array<Filter>
|
|
selectedFilter: Filter["identifier"]
|
|
onFilterSelect: (filter: Filter["identifier"]) => void
|
|
}
|
|
|
|
export default function TabFilters({
|
|
categories,
|
|
selectedFilter,
|
|
onFilterSelect,
|
|
}: TabFiltersProps) {
|
|
const { containerRef, showLeftShadow, showRightShadow } =
|
|
useScrollShadows<HTMLDivElement>()
|
|
|
|
return (
|
|
<div
|
|
className={cx(
|
|
styles.containerWrapper,
|
|
showLeftShadow && styles.showLeftShadow,
|
|
showRightShadow && styles.showRightShadow
|
|
)}
|
|
>
|
|
<div className={styles.container} ref={containerRef}>
|
|
{categories.map((category) => (
|
|
<button
|
|
key={category.identifier}
|
|
onClick={() => onFilterSelect(category.identifier)}
|
|
className={
|
|
selectedFilter === category.identifier
|
|
? styles.filterSelected
|
|
: styles.filter
|
|
}
|
|
type="button"
|
|
>
|
|
<HeartIcon
|
|
color={selectedFilter === category.identifier ? "white" : "black"}
|
|
/>
|
|
{category.label}
|
|
</button>
|
|
))}
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|