diff options
author | Volpeon <git@volpeon.ink> | 2024-10-18 18:08:24 +0200 |
---|---|---|
committer | Volpeon <git@volpeon.ink> | 2024-10-18 18:08:24 +0200 |
commit | 365c56edcc36b5b92902bac01ce44b43d01e8685 (patch) | |
tree | 644611792591a76e605068d0c9e230fad6a633e7 /src/objects/_table.scss | |
parent | Revamped variable management (diff) | |
download | iro-design-365c56edcc36b5b92902bac01ce44b43d01e8685.tar.gz iro-design-365c56edcc36b5b92902bac01ce44b43d01e8685.tar.bz2 iro-design-365c56edcc36b5b92902bac01ce44b43d01e8685.zip |
Refactoring
Diffstat (limited to 'src/objects/_table.scss')
-rw-r--r-- | src/objects/_table.scss | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/src/objects/_table.scss b/src/objects/_table.scss new file mode 100644 index 0000000..5b16d66 --- /dev/null +++ b/src/objects/_table.scss | |||
@@ -0,0 +1,168 @@ | |||
1 | @use 'iro-sass/src/iro-sass' as iro; | ||
2 | @use '../functions' as fn; | ||
3 | @use '../mixins' as mx; | ||
4 | |||
5 | @include iro.props-namespace('table') { | ||
6 | @include iro.props-store(( | ||
7 | --dims: ( | ||
8 | --pad-i: fn.global-dim(--size --175), | ||
9 | --pad-b: fn.global-dim(--size --125), | ||
10 | --rounding: fn.global-dim(--rounding), | ||
11 | --border: fn.global-dim(--border --thin), | ||
12 | |||
13 | --sm: ( | ||
14 | --pad-b: fn.global-dim(--size --75), | ||
15 | ) | ||
16 | ), | ||
17 | --colors: ( | ||
18 | --border: fn.global-color(--border), | ||
19 | --heading: fn.global-color(--heading), | ||
20 | --hover: fn.global-color(--border-mute), | ||
21 | --active: fn.global-color(--border), | ||
22 | --box: ( | ||
23 | --bg: fn.global-color(--base --50), | ||
24 | --hover: fn.global-color(--bg-base), | ||
25 | --active: fn.global-color(--border-mute), | ||
26 | ) | ||
27 | ) | ||
28 | )); | ||
29 | |||
30 | @include iro.bem-object(iro.props-namespace()) { | ||
31 | border-spacing: 0; | ||
32 | border-collapse: separate; | ||
33 | |||
34 | @include iro.bem-modifier('fixed') { | ||
35 | table-layout: fixed; | ||
36 | } | ||
37 | |||
38 | @include iro.bem-elem('head-cell') { | ||
39 | @include mx.set-font(--standard, ( | ||
40 | --line-height: null, | ||
41 | --size: fn.global-dim(--font-size --50), | ||
42 | --weight: bold, | ||
43 | --transform: uppercase, | ||
44 | --spacing: .5px | ||
45 | )); | ||
46 | padding-block: fn.dim(--pad-b); | ||
47 | |||
48 | padding-inline: fn.dim(--pad-i); | ||
49 | color: fn.color(--heading); | ||
50 | text-align: start; | ||
51 | } | ||
52 | |||
53 | @include iro.bem-elem('cell') { | ||
54 | padding-block: fn.dim(--pad-b); | ||
55 | padding-inline: fn.dim(--pad-i); | ||
56 | border-color: fn.color(--border); | ||
57 | border-style: solid; | ||
58 | border-width: 0; | ||
59 | border-block-start-width: fn.dim(--border); | ||
60 | |||
61 | @include iro.bem-modifier('divider') { | ||
62 | border-inline-end-width: fn.dim(--border); | ||
63 | } | ||
64 | } | ||
65 | |||
66 | @include iro.bem-elem('row') { | ||
67 | &:last-child { | ||
68 | @include iro.bem-elem('cell') { | ||
69 | border-block-end-width: fn.dim(--border); | ||
70 | } | ||
71 | } | ||
72 | } | ||
73 | |||
74 | @include iro.bem-modifier('flush') { | ||
75 | @include iro.bem-elem('head-cell', 'cell') { | ||
76 | &:first-child { | ||
77 | padding-inline-start: 0; | ||
78 | } | ||
79 | |||
80 | &:last-child { | ||
81 | padding-inline-end: 0; | ||
82 | } | ||
83 | } | ||
84 | } | ||
85 | |||
86 | @include iro.bem-modifier('box') { | ||
87 | @include iro.bem-elem('cell') { | ||
88 | background-color: fn.color(--box --bg); | ||
89 | |||
90 | &:first-child { | ||
91 | border-inline-start-width: fn.dim(--border); | ||
92 | } | ||
93 | |||
94 | &:last-child { | ||
95 | border-inline-end-width: fn.dim(--border); | ||
96 | } | ||
97 | } | ||
98 | |||
99 | @include iro.bem-elem('row') { | ||
100 | &:first-child { | ||
101 | @include iro.bem-elem('cell') { | ||
102 | &:first-child { | ||
103 | border-start-start-radius: fn.dim(--rounding); | ||
104 | } | ||
105 | |||
106 | &:last-child { | ||
107 | border-start-end-radius: fn.dim(--rounding); | ||
108 | } | ||
109 | } | ||
110 | } | ||
111 | |||
112 | &:last-child { | ||
113 | @include iro.bem-elem('cell') { | ||
114 | &:first-child { | ||
115 | border-end-start-radius: fn.dim(--rounding); | ||
116 | } | ||
117 | |||
118 | &:last-child { | ||
119 | border-end-end-radius: fn.dim(--rounding); | ||
120 | } | ||
121 | } | ||
122 | } | ||
123 | } | ||
124 | } | ||
125 | |||
126 | @include iro.bem-modifier('interactive') { | ||
127 | @include iro.bem-elem('row') { | ||
128 | @include iro.bem-elem('cell') { | ||
129 | cursor: pointer; | ||
130 | } | ||
131 | |||
132 | &:hover { | ||
133 | @include iro.bem-elem('cell') { | ||
134 | background-color: fn.color(--hover); | ||
135 | } | ||
136 | } | ||
137 | |||
138 | &:active { | ||
139 | @include iro.bem-elem('cell') { | ||
140 | background-color: fn.color(--active); | ||
141 | } | ||
142 | } | ||
143 | } | ||
144 | |||
145 | @include iro.bem-modifier('box') { | ||
146 | @include iro.bem-elem('row') { | ||
147 | &:hover { | ||
148 | @include iro.bem-elem('cell') { | ||
149 | background-color: fn.color(--box --hover); | ||
150 | } | ||
151 | } | ||
152 | |||
153 | &:active { | ||
154 | @include iro.bem-elem('cell') { | ||
155 | background-color: fn.color(--box --active); | ||
156 | } | ||
157 | } | ||
158 | } | ||
159 | } | ||
160 | } | ||
161 | |||
162 | @include iro.bem-modifier('sm') { | ||
163 | @include iro.bem-elem('head-cell', 'cell') { | ||
164 | padding-block: fn.dim(--sm --pad-b); | ||
165 | } | ||
166 | } | ||
167 | } | ||
168 | } | ||