parent
cf9d49be70
commit
1b617b5aa8
@ -0,0 +1,39 @@
|
|||||||
|
<script>
|
||||||
|
import { onMount } from "svelte";
|
||||||
|
|
||||||
|
export let title;
|
||||||
|
export let open = "";
|
||||||
|
export let id;
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
if(open == "true") {
|
||||||
|
openAccordion();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function openAccordion() {
|
||||||
|
let content = document.querySelector("#content");
|
||||||
|
content.classList.toggle("block");
|
||||||
|
content.classList.toggle("hidden");
|
||||||
|
|
||||||
|
let trigger = document.querySelector("#trigger");
|
||||||
|
if(content.classList.contains("block")) {
|
||||||
|
trigger.innerHTML = "⬇️";
|
||||||
|
} else {
|
||||||
|
trigger.innerHTML = "➡️";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<section class="container bg-gray-800 rounded-lg shadow-lg p-5 flex flex-col gap-5" id="icon">
|
||||||
|
<div class="flex justify-between items-center">
|
||||||
|
<h2 class="text-2xl font-bold">{title}</h2>
|
||||||
|
<button type="none" id="trigger" on:click={openAccordion} class="text-2xl">➡️</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="hidden" id="content">
|
||||||
|
<hr class="mb-5" />
|
||||||
|
|
||||||
|
<slot />
|
||||||
|
</div>
|
||||||
|
</section>
|
@ -0,0 +1,13 @@
|
|||||||
|
<script>
|
||||||
|
export let name;
|
||||||
|
export let price;
|
||||||
|
export let picture;
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<div class="flex flex-col justify-between items-center gap-2">
|
||||||
|
<span class="w-full flex justify-between">
|
||||||
|
<h3 class="text-xl font-bold">{name}</h3>
|
||||||
|
<span class="bg-green-500 py-1 text-sm px-5 rounded-lg">{price}</span>
|
||||||
|
</span>
|
||||||
|
<img src={picture} alt={name} class="w-full rounded-xl shadow" />
|
||||||
|
</div>
|
After Width: | Height: | Size: 38 KiB |
After Width: | Height: | Size: 19 KiB |
After Width: | Height: | Size: 34 KiB |
After Width: | Height: | Size: 28 KiB |
After Width: | Height: | Size: 36 KiB |
After Width: | Height: | Size: 32 KiB |
Loading…
Reference in new issue