File size: 3,203 Bytes
43a06dc
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<script lang="ts">
    import { page } from "$app/stores";

    import IconChevronRight from "@tabler/icons-svelte/IconChevronRight.svelte";

    export let path: string;
    export let title: string;
    export let icon: ConstructorOfATypedSvelteComponent;
    export let iconColor: "gray" | "blue" | "green" = "gray";

    $: isActive = $page.url.pathname === path;
</script>

<a
    class="subnav-tab"
    href={path}
    class:active={isActive}
    role="button"
>
    <div class="subnav-tab-left">
        <div class="tab-icon" style="background: var(--{iconColor})">
            <svelte:component this={icon} />
        </div>
        <div class="subnav-tab-text">
            {title}
        </div>
    </div>
    <div class="subnav-tab-chevron">
        <IconChevronRight />
    </div>
</a>

<style>
    .subnav-tab {
        --small-padding: 4px;
        --big-padding: 6px;
        display: flex;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        gap: calc(var(--small-padding) * 2);
        padding: var(--big-padding);
        font-weight: 500;
        background: var(--primary);
        color: var(--button-text);
        border-radius: var(--border-radius);
        overflow: hidden;

        text-decoration: none;
        text-decoration-line: none;

        cursor: pointer;
    }

    .subnav-tab-left {
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: calc(var(--big-padding) * 1.5);
        font-weight: 500;
    }

    .tab-icon {
        display: flex;
        justify-content: center;
        align-items: center;
        padding: var(--small-padding);
        border-radius: 5px;
    }

    .subnav-tab .tab-icon :global(svg) {
        stroke-width: 1.5px;
        stroke: var(--white);
        height: 20px;
        width: 20px;
    }

    .subnav-tab-chevron :global(svg) {
        display: none;
        stroke-width: 2px;
        stroke: var(--gray);
        height: 18px;
        width: 18px;
    }

    .subnav-tab-chevron:dir(rtl) {
        transform: scale(-1, 1);
    }

    @media (hover: hover) {
        .subnav-tab:hover {
            background: var(--button-hover-transparent);
        }
    }

    .subnav-tab:active {
        background: var(--button-hover-transparent);
    }

    .subnav-tab.active {
        background: var(--secondary);
        color: var(--primary);
        cursor: default;
    }

    .subnav-tab-text {
        font-size: 14.5px;
        line-height: 1.35;
    }

    @media screen and (max-width: 750px) {
        .subnav-tab {
            --big-padding: 7px;
            background: none;
            padding: var(--big-padding) 11px;
        }

        .subnav-tab:not(:last-child) {
            border-bottom-left-radius: 0;
            border-bottom-right-radius: 0;
            box-shadow: 48px 3px 0px -1.8px var(--button-stroke);
        }

        .subnav-tab:not(:first-child) {
            border-top-left-radius: 0;
            border-top-right-radius: 0;
        }

        .subnav-tab-left {
            gap: 10px;
        }

        .subnav-tab-chevron :global(svg) {
            display: block;
        }
    }
</style>