add accordtion
This commit is contained in:
@@ -1,16 +1,16 @@
|
||||
---
|
||||
import { ChevronLeftIcon, ChevronRightIcon } from '@heroicons/react/24/solid'
|
||||
import { Icon } from 'astro-icon/components'
|
||||
|
||||
const { items = [] } = Astro.props
|
||||
---
|
||||
|
||||
<div id="carousel" class="relative">
|
||||
<button id="prev" class="inset-y-0 left-0 px-1.5 bg-white/10 absolute cursor-pointer lg:hidden z-10">
|
||||
<ChevronLeftIcon className="w-6" />
|
||||
<button id="prev" class="inset-y-0 left-0 px-1.5 bg-white/10 absolute cursor-pointer lg:hidden z-1">
|
||||
<Icon name="chevron-left" class="size-6" />
|
||||
</button>
|
||||
|
||||
<button id="next" class="inset-y-0 right-0 px-1.5 bg-white/10 absolute cursor-pointer lg:hidden z-10">
|
||||
<ChevronRightIcon className="w-6" />
|
||||
<button id="next" class="inset-y-0 right-0 px-1.5 bg-white/10 absolute cursor-pointer lg:hidden z-1">
|
||||
<Icon name="chevron-right" class="size-6" />
|
||||
</button>
|
||||
|
||||
<div
|
||||
@@ -18,7 +18,7 @@ const { items = [] } = Astro.props
|
||||
>
|
||||
{
|
||||
items.map((Component, idx) => (
|
||||
<div class="snap-center flex-shrink-0 max-lg:w-full flex justify-center itens-center z-0">
|
||||
<div class="snap-center flex-shrink-0 max-lg:w-full flex justify-center itens-center">
|
||||
<Component class="size-48 lg:size-38 fill-white" id={`slide${idx + 1}`} />
|
||||
</div>
|
||||
))
|
||||
@@ -31,7 +31,7 @@ const { items = [] } = Astro.props
|
||||
const slides = carousel.querySelectorAll('.snap-center')
|
||||
let currentIndex = 0
|
||||
|
||||
const scrollToSlide = (index) => {
|
||||
const scrollToSlide = (index: number) => {
|
||||
if (index >= 0 && index < slides.length) {
|
||||
slides[index].scrollIntoView({
|
||||
behavior: 'smooth',
|
||||
|
||||
Reference in New Issue
Block a user