summaryrefslogtreecommitdiffstats
path: root/assets/css/components/_card.scss
blob: 0a64f1f9a393e128eb0f88bb6743ce043170b336 (plain) (blame)
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
@include namespace('card') {
    @include store((
        --dims: (
            --pad-x:        1.1em,
            --pad-y:        .8em,
            --hover-offset: -.3rem,
            --indicator: (
                --width:  1em,
                --height: 4px,
            ),
        ),
        --colors: (
            --bg:     prop(--colors --bg-lo, $global: true),
            --fg:     prop(--colors --fg, $global: true),
            --unread: prop(--colors --bg, $global: true),
            --border: prop(--colors --obj-hi, $global: true),
            --hover: (
                --bg: prop(--colors --fg-lo, $global: true),
                --fg: prop(--colors --bg-hi, $global: true),
            ),
        )
    ));

    @include store((
        --colors: (
            --bg:     prop(--colors --bg-hi, $global: true),
            --unread: prop(--colors --bg-lo, $global: true),
            --border: prop(--colors --bg-lo, $global: true),
        )
    ), 'light');

    @include component(namespace()) {
        display:          flex;
        position:         relative;
        align-items:      center;
        padding-right:    calc(.5 * #{prop(--dims --pad-x)});
        padding-left:     calc(.5 * #{prop(--dims --pad-x)});
        transform:        translateY(0);
        transition:       transform .2s, background-color .2s, color .2s;
        background-color: prop(--colors --bg);
        box-shadow:       prop(--dims --obj-shadow, $global: true) prop(--colors --obj-shadow, $global: true);
        color:            prop(--colors --fg);
        line-height:      1.4;

        &::after {
            content:  '';
            display:  none;
            position: absolute;
            top:      100%;
            left:     0;
            width:    100%;
            height:   calc(-1 * #{prop(--dims --hover-offset)});
        }

        small,
        strong {
            transition: color .2s;
        }

        &:link,
        &:visited {
            text-decoration: none;

            &:hover,
            &:focus {
                transform:        translateY(#{prop(--dims --hover-offset)});
                background-color: prop(--colors --hover --bg);
                color:            prop(--colors --hover --fg);

                &::after {
                    display: block;
                }

                * {
                    color: currentColor;
                }

                @include element('block') {
                    @include modifier('indicator') {
                        color: prop(--colors --hover --fg);
                    }
                }
            }
        }

        &:visited {
            @include element('block') {
                @include modifier('indicator') {
                    color: prop(--colors --bg);
                }
            }
        }

        @include element('block') {
            flex:    0 0 auto;
            padding: prop(--dims --pad-y) calc(.5 * #{prop(--dims --pad-x)});

            @include modifier('main') {
                flex-shrink: 1;
                width:       100%;
            }

            /*@include modifier('separator') {
                align-self:     stretch;
                padding-top:    0;
                padding-bottom: 0;

                &::before {
                    content:          '';
                    display:          block;
                    width:            1px;
                    height:           100%;
                    background-color: prop(--colors --border);
                }
            }*/

            @include modifier('indicator') {
                transition: color .2s;
                color:      prop(--colors --unread);

                &::before {
                    content:          '';
                    display:          block;
                    width:            prop(--dims --indicator --width);
                    height:           prop(--dims --indicator --height);
                    border-radius:    prop(--dims --indicator --height);
                    background-color: currentColor;
                }
            }
        }
    }
}