<script lang="ts">
    import { navigate } from "svelte-routing"
    import { fly } from "svelte/transition"
    export let col: Column
    export let siteId: string
    import { apiBaseURL } from "../../../config"
    import inView from "../../functions/observer"
    let visible = false
    let node
</script>

<main>
    <div
        class="wrapper"
        bind:this="{node}"
        use:inView="{{ threshold: 0 }}"
        on:enter="{() => {
            visible = true
        }}"
    >
        {#key visible}
            {#each col.iconBoard ?? [] as icon, i (i)}
                <div
                    class="img-container"
                    id="{'img-container' + i}"
                    in:fly="{{ duration: 1000, delay: i * 150, y: 130, opacity: 0 }}"
                >
                    <img alt="icon" src="{`${apiBaseURL}content/${siteId}/${icon.icon?.src}`}" class="icon" />

                    <div class="subText">{icon?.subText}</div>
                </div>
            {/each}
        {/key}
    </div>
</main>

<style lang="less">
    @import "../../assets/css/variables.less";
    main {
        display: flex;
        max-width: @body-small-maxwidth;
        justify-content: space-between;
        align-items: center;
        flex-wrap: wrap;
        width: 100%;
        padding: 15px;
        .wrapper {
            width: 100%;
            min-height: 400px;
            margin-top: 75px;
            display: flex;
            justify-content: start;
            align-items: center;
            flex-wrap: wrap;
            @media @mobile {
                margin-top: 10px;
            }
            @media @tablet {
                margin-top: 40px;
            }

            .img-container {
                display: flex;
                margin: 15px 0px;
                flex-direction: column;
                align-items: center;
                min-width: 25%;
                .subText {
                    text-align: center;
                    color: var(--heading-font-color);
                }
                @media @mobile {
                    width: 50%;
                }
                @media @tablet {
                    width: auto;
                }
            }
        }
    }
</style>
