import React, { useState } from 'react' import Carousel from 'nuka-carousel' import { Head, router } from '@inertiajs/react' import { HiChevronLeft } from 'react-icons/hi2' import CustomerLayout from '@/Layouts/CustomerLayout' export default function Index(props) { const { levels, auth: { user }, } = props const levelIndex = levels.findIndex((l) => l.id === user.level.id) const [selectedIndex] = useState(levelIndex) const [index, setIndex] = useState(selectedIndex) return (
{ router.get(route('home.index', { direct: 1 })) }} >
{ setIndex(index) }} > {levels.map((level, index) => (
{level.name}
{levelIndex === index && (
Level kamu saat ini
)}
))}
{/* */} {levels.map((level) => (
))}
) }