Update FAQ accordion and button
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
<button
|
<button
|
||||||
class="bg-ecsess-600 hover:bg-ecsess-400 active:bg-ecsess-800
|
class="bg-ecsess-600 hover:bg-ecsess-400 active:bg-ecsess-800
|
||||||
m-1 inline-block rounded-lg border-none px-4
|
inline-block rounded-lg border-none px-4
|
||||||
py-2 text-white transition-all
|
py-2 text-white transition-all
|
||||||
duration-200 ease-out
|
duration-200 ease-out
|
||||||
hover:shadow-2xl"
|
hover:shadow-2xl"
|
||||||
|
|||||||
@@ -1,16 +1,12 @@
|
|||||||
<script>
|
<script lang="ts">
|
||||||
// import { slide } from 'svelte/transition';
|
import type { FAQ } from '$lib/schemas';
|
||||||
import { Accordion } from '@skeletonlabs/skeleton-svelte';
|
import { Accordion } from '@skeletonlabs/skeleton-svelte';
|
||||||
|
|
||||||
// FAQ closed by default
|
|
||||||
let isOpen = $state(false);
|
|
||||||
// const toggle = () => (isOpen = !isOpen);
|
|
||||||
|
|
||||||
// Variable to be included into the component
|
// Variable to be included into the component
|
||||||
let { /** @type {String} */ entries } = $props();
|
let { entries }: { entries: FAQ[] } = $props();
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Accordion classes="w-[500px] max-w-[500px] transition-all ease-in-out" multiple>
|
<Accordion multiple>
|
||||||
{#snippet iconClosed()}
|
{#snippet iconClosed()}
|
||||||
<svg
|
<svg
|
||||||
width="20"
|
width="20"
|
||||||
@@ -24,6 +20,7 @@
|
|||||||
><path d="M9 5l7 7-7 7" />
|
><path d="M9 5l7 7-7 7" />
|
||||||
</svg>
|
</svg>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
|
|
||||||
{#snippet iconOpen()}
|
{#snippet iconOpen()}
|
||||||
<svg
|
<svg
|
||||||
class="rotate-90"
|
class="rotate-90"
|
||||||
@@ -38,21 +35,22 @@
|
|||||||
><path d="M9 5l7 7-7 7" />
|
><path d="M9 5l7 7-7 7" />
|
||||||
</svg>
|
</svg>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
|
|
||||||
{#each entries as entry, index}
|
{#each entries as entry, index}
|
||||||
<Accordion.Item
|
<Accordion.Item
|
||||||
value={index.toString()}
|
value={index.toString()}
|
||||||
classes="border-ecsess-200 mb-4 overflow-hidden rounded-xl border-2"
|
classes="border-ecsess-200 mb-4 rounded-xl border-2 hover:bg-ecsess-black-hover"
|
||||||
leadClasses="text-xl font-bold"
|
leadClasses="text-lg font-bold"
|
||||||
controlClasses="hover:bg-ecsess-black-hover
|
controlClasses="
|
||||||
flex w-inherit cursor-pointer items-center justify-between
|
flex cursor-pointer justify-between
|
||||||
py-4 transition-colors ease-in-out"
|
py-4 ease-in-out"
|
||||||
panelClasses=" border-t-ecsess-200 max-h-fit border-t-2 bg-transparent p-4 bg-ecsess-400"
|
panelClasses=" border-t-ecsess-200 border-t-2 bg-transparent p-4 bg-ecsess-400"
|
||||||
>
|
>
|
||||||
<!-- Control -->
|
<!-- Control -->
|
||||||
{#snippet lead()}
|
{#snippet lead()}
|
||||||
{entry.question}
|
{entry.question}
|
||||||
{/snippet}
|
{/snippet}
|
||||||
|
|
||||||
{#snippet control()}{/snippet}
|
{#snippet control()}{/snippet}
|
||||||
|
|
||||||
<!-- Panel -->
|
<!-- Panel -->
|
||||||
@@ -61,54 +59,4 @@
|
|||||||
{/each}
|
{/each}
|
||||||
</Accordion>
|
</Accordion>
|
||||||
|
|
||||||
<!--
|
<!-- -->
|
||||||
<div class="accordion-wrapper w-full max-w-[500px]">
|
|
||||||
<div
|
|
||||||
class="accordion-item
|
|
||||||
border-ecsess-200 mb-4 overflow-hidden rounded-xl border-2
|
|
||||||
{isOpen ? '' : 'open'}"
|
|
||||||
>
|
|
||||||
<button
|
|
||||||
class="accordion-header hover:bg-ecsess-black-hover
|
|
||||||
flex h-16 w-full cursor-pointer items-center justify-between
|
|
||||||
px-4 transition-colors ease-in-out"
|
|
||||||
onclick={toggle}
|
|
||||||
aria-expanded={isOpen}
|
|
||||||
>
|
|
||||||
<span class="text-xl font-bold">{question}</span>
|
|
||||||
<svg
|
|
||||||
class="accordion-icon transform-cpu transition-all ease-in-out"
|
|
||||||
width="20"
|
|
||||||
height="20"
|
|
||||||
fill="none"
|
|
||||||
stroke-linecap="round"
|
|
||||||
stroke-linejoin="round"
|
|
||||||
stroke-width="2"
|
|
||||||
viewBox="0 0 24 24"
|
|
||||||
stroke="currentColor"
|
|
||||||
>
|
|
||||||
<path d="M9 5l7 7-7 7" />
|
|
||||||
</svg>
|
|
||||||
</button>
|
|
||||||
|
|
||||||
{#if isOpen}
|
|
||||||
<div
|
|
||||||
class="accordion-content border-t-ecsess-200 max-h-fit border-t-2 bg-transparent p-4 transition-all ease-in"
|
|
||||||
transition:slide={{ duration: 300 }}
|
|
||||||
>
|
|
||||||
<p>{answer}</p>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div> -->
|
|
||||||
|
|
||||||
<!-- <style>
|
|
||||||
[aria-expanded='true'] .accordion-icon {
|
|
||||||
transform: rotate(90deg);
|
|
||||||
}
|
|
||||||
|
|
||||||
.accordion-item.open .accordion-header,
|
|
||||||
.accordion-item.open .accordion-content {
|
|
||||||
background-color: var(--color-ecsess-black-hover);
|
|
||||||
}
|
|
||||||
</style> -->
|
|
||||||
|
|||||||
@@ -34,13 +34,15 @@
|
|||||||
|
|
||||||
<!-- Picture, FAQ -->
|
<!-- Picture, FAQ -->
|
||||||
<Section black>
|
<Section black>
|
||||||
<div>
|
<div class="md:grid md:grid-cols-3 md:gap-6">
|
||||||
<h1>Our Student Council</h1>
|
<div class="col-span-2">
|
||||||
<img src={data.councilPhoto} alt="ECSESS Council" />
|
<h1>Our Student Council</h1>
|
||||||
</div>
|
<img src={data.councilPhoto} alt="ECSESS Council" />
|
||||||
<div>
|
</div>
|
||||||
<h1>FAQ</h1>
|
<div class="col-span-1 place-self-center md:place-content-around m-6 w-full">
|
||||||
<FaqAccordion entries={data.faqs} />
|
<h1>FAQ</h1>
|
||||||
|
<FaqAccordion entries={data.faqs} />
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</Section>
|
</Section>
|
||||||
<!-- Office Hours Calendar -->
|
<!-- Office Hours Calendar -->
|
||||||
|
|||||||
Reference in New Issue
Block a user