aboutsummaryrefslogtreecommitdiff
path: root/apps/website/src/components/base/Header.astro
blob: ad8267be04cc170a394868afc197371017999a44 (plain)
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
---
import type { HTMLAttributes } from "astro/types"

const sizes = {
    "xl": "h1",
    "lg": "h2",
    "md": "h3",
    "sm": "h4",
    "xs": "h5",
    "xxs": "h6"  
};

type Headers = "h1" | "h2" | "h3" | "h4" | "h5" | "h6";

interface Props extends HTMLAttributes<Headers> {
    size: keyof typeof sizes;
}

const { size, ...attr } = Astro.props;
const Element = sizes[size] as any; // Unfortunately gotta do this
---

<Element {...attr}>
    <slot />
</Element>

<style>
    h1 {
        font-size: theme("fontSize.header-lg");
        font-weight: 700;
    }

    h2 {
        font-size: theme("fontSize.header");
        font-weight: 700;
    }

    h3 {
        font-size: theme("fontSize.header-sm");
        font-weight: 600;
    }

    h4 {
        font-size: theme("fontSize.body-lg");
        font-weight: 500;
    }

    h5 {
        font-size: theme("fontSize.body");
        font-weight: 500;
    }

    h6 {
        font-size: theme("fontSize.body-sm");
        font-weight: 500;
    }
</style>