refactor: simplify Carousel component and update news data structure for clarity

This commit is contained in:
Ardeman
2025-02-25 04:48:13 +08:00
parent 7e82768423
commit fe9b8bc97a
7 changed files with 58 additions and 60 deletions
+2 -2
View File
@@ -10,8 +10,8 @@ import { Button } from './button'
export const Carousel = (properties: TNews) => {
const [currentIndex, setCurrentIndex] = useState(0)
const location = useLocation()
const hasCategory = location.pathname.includes('/category/')
const { pathname } = useLocation()
const hasCategory = pathname.includes('/category/')
const { title, description, items, type } = properties
const itemsPerPage = type === 'hero' ? 1 : 3