wm-fontis-tibi-2023/frontend/src/lib/components/widgets/iconCycleBox.svelte

80 lines
2.2 KiB
Svelte
Raw Normal View History

2023-07-16 13:50:53 +02:00
<script lang="ts">
import { apiBaseURL } from "../../../config"
export let col: Column
export let pageId: string
let active = -1
setInterval(() => {
active += 1
if (active == col.iconCycleSquare.boxes.length) active = 0
}, 1000)
</script>
<div class="iconCycleSquares">
2023-07-16 23:31:08 +02:00
{#each col?.iconCycleSquare?.boxes as box, i}
2023-07-16 13:50:53 +02:00
<div class="box" id="box{i}" class:active="{i == active}">
<div class="content">
<div class="icon">
2023-09-01 14:09:35 +02:00
<svg
stroke="{i == active ? 'black' : 'white'}"
fill="{i == active ? 'black' : 'white'}"
data-src="{apiBaseURL}page/{pageId}/{box.icon?.src}"></svg>
2023-07-16 13:50:53 +02:00
</div>
<div class="text">
{box.text}
</div>
</div>
</div>
{/each}
</div>
<style lang="less">
@import "../../assets/css/main.less";
.iconCycleSquares {
display: flex;
flex-wrap: wrap;
2023-09-01 14:09:35 +02:00
justify-content: center;
2023-07-16 13:50:53 +02:00
gap: 10px;
2023-07-17 09:24:08 +02:00
font-size: 0.8rem;
2023-09-01 14:09:35 +02:00
transition: all 600ms;
2023-07-16 13:50:53 +02:00
@media @tablet {
gap: 20px;
2023-07-17 09:24:08 +02:00
font-size: 1rem;
2023-07-16 13:50:53 +02:00
}
.box {
border: 4px solid @bg-color-secondary;
background-color: @bg-color-secondary;
display: flex;
align-items: center;
justify-content: center;
color: @font-color-secondary;
2023-09-01 14:09:35 +02:00
2023-07-16 13:50:53 +02:00
&.active {
background-color: @bg-color;
color: @font-color;
}
2023-07-19 17:22:20 +02:00
width: 140px;
2023-07-16 13:50:53 +02:00
height: 150px;
.content {
display: flex;
flex-direction: column;
align-items: center;
2023-09-01 14:09:35 +02:00
2023-07-16 13:50:53 +02:00
.text {
width: 100%;
display: flex;
justify-content: center;
text-align: center;
2023-09-01 14:09:35 +02:00
font-family: "Libre Caslon Text", serif;
2023-07-16 13:50:53 +02:00
}
}
@media @tablet {
2023-09-01 14:09:35 +02:00
width: 270px;
height: 270px;
gap: 30px;
2023-07-16 13:50:53 +02:00
}
}
}
</style>