summaryrefslogtreecommitdiff
path: root/assets/css/components/_toc.scss
blob: e84865579bda31f385e3a95ecdc6d0b000244be3 (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
#toc {
    ul {
        margin-block-start: 0;
        margin-block-end: 0;
        padding-inline-start: 1rem;

        overflow: hidden;
        position: relative;
        li {
            list-style: none;

            & > a {
                color: var(--secondary-text-color);
                text-decoration: none;
                transition: color .3s;
                display: inline-flex;
                align-items: center;
                gap: .5rem;
                text-overflow: ellipsis;
                white-space: nowrap;
                &::before {
                    content: '';
                    display: inline-block;
                    width: 1rem;
                    height: .3rem;
                    background-color: var(--block-background-color);
                    border-radius: .2rem;
                    transition: background .3s;
                    flex-shrink: 0;
                }
            }

            /* nested list */
            ul {
                max-height: 25rem;
                overflow-y: auto
            }

            /* active styles */
            &:not(.active) ul {
                max-height: 0
            }
            a:hover,
            &.active > a {
                color: var(--text-color);
            }

            &.active > a::before {
                background-color: var(--secondary-text-color);
            }
        }
    }
}