summaryrefslogtreecommitdiffstats
path: root/src/objects/_table.scss
blob: 9f414b823d5ecc5195735f856fb8cefd9e9c844d (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
@use 'iro-sass/src/index' as iro;
@use '../functions' as fn;
@use '../mixins' as mx;

@include iro.props-namespace('table') {
    @include iro.props-store((
        --dims: (
            --pad-x:    fn.global-dim(--size --200),
            --pad-y:    fn.global-dim(--size --125),
            --rounding: 3px,
        ),
    ), 'dims');

    @include iro.props-store((
        --colors: (
            --bg:      fn.global-color(--bg-hi2),
            --border:  fn.global-color(--obj),
            --hover:   fn.global-color(--bg),
            --press:   fn.global-color(--obj-hi),
            --heading: fn.global-color(--fg-hi),
        )
    ), 'colors');

    @include iro.bem-object(iro.props-namespace()) {
        border-spacing:  0;
        border-collapse: separate;

        @include iro.bem-elem('head-cell') {
            @include mx.set-font(--standard, (
                --line-height: null,
                --size:        fn.global-dim(--font-size --50),
                --weight:      500,
                --transform:   uppercase,
                --spacing:     .5px
            ));

            padding:    fn.dim(--pad-y) fn.dim(--pad-x);
            color:      fn.color(--heading);
            text-align: left;
        }

        @include iro.bem-elem('cell') {
            padding:          fn.dim(--pad-y) fn.dim(--pad-x);
            border-width:     1px 0 0;
            border-style:     solid;
            border-color:     fn.color(--border);
            background-color: fn.color(--bg);
        
            &:first-child {
                border-left-width: 1px;
            }
        
            &:last-child {
                border-right-width: 1px;
            }
        }

        @include iro.bem-elem('row') {
            &:first-child {
                @include iro.bem-elem('cell') {
                    &:first-child {
                        border-top-left-radius: fn.dim(--rounding);
                    }
        
                    &:last-child {
                        border-top-right-radius: fn.dim(--rounding);
                    }
                }
            }

            &:last-child {
                @include iro.bem-elem('cell') {
                    border-bottom-width: 1px;

                    &:first-child {
                        border-bottom-left-radius: fn.dim(--rounding);
                    }
        
                    &:last-child {
                        border-bottom-right-radius: fn.dim(--rounding);
                    }
                }
            }

            @include iro.bem-next-twin-elem {
                @include iro.bem-elem('cell') {
                    border-top: 1px solid fn.color(--border);
                }
            }

            &:hover {
                @include iro.bem-elem('cell') {
                    background-color: fn.color(--hover);
                }
            }

            &:active {
                @include iro.bem-elem('cell') {
                    background-color: fn.color(--press);
                }
            }
        }
    }
}