summaryrefslogtreecommitdiffstats
path: root/src/scopes/_tables.scss
blob: 5b6430134a6907ed497cecee0dff4eca0d6ae40f (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
@use 'sass:meta';
@use 'iro-sass/src/bem';
@use 'iro-sass/src/props';
@use '../props' as *;
@use '../objects/table.vars' as table;

@forward 'tables.vars';
@use 'tables.vars' as vars;

@mixin styles {
	@include materialize-at-root(meta.module-variables('vars'));

	@include bem.scope('tables') {
		table {
			margin-block-start: props.get(vars.$margin-bs);
			border-spacing:     0;
			border-collapse:    separate;
		}

		th {
			padding-block:  props.get(table.$pad-b);
			padding-inline: props.get(table.$pad-i);
			font-family:    props.get(table.$heading--font-family);
			font-size:      props.get(table.$heading--font-size);
			font-weight:    props.get(table.$heading--font-weight);
			color:          props.get(table.$heading-color);
			text-align:     start;
			text-transform: props.get(table.$heading--text-transform);
			letter-spacing: props.get(table.$heading--letter-spacing);
		}

		td {
			padding-block:            props.get(table.$pad-b);
			padding-inline:           props.get(table.$pad-i);
			border-color:             props.get(table.$border-color);
			border-style:             solid;
			border-width:             0;
			border-block-start-width: props.get(table.$border-width);
		}

		tr {
			&:last-child {
				td {
					border-block-end-width: props.get(table.$border-width);
				}
			}
		}

		@include bem.modifier('flush') {
			th,
			td {
				&:first-child {
					padding-inline-start: 0;
				}

				&:last-child {
					padding-inline-end: 0;
				}
			}
		}

		@include bem.modifier('box') {
			td {
				background-color: props.get(table.$box--bg-color);
            
				&:first-child {
					border-inline-start-width: props.get(table.$border-width);
				}
            
				&:last-child {
					border-inline-end-width: props.get(table.$border-width);
				}
			}
    
			tr {
				&:first-child {
					td {
						&:first-child {
							border-start-start-radius: props.get(table.$rounding);
						}
            
						&:last-child {
							border-start-end-radius: props.get(table.$rounding);
						}
					}
				}
    
				&:last-child {
					td {
						&:first-child {
							border-end-start-radius: props.get(table.$rounding);
						}
            
						&:last-child {
							border-end-end-radius: props.get(table.$rounding);
						}
					}
				}
			}
		}
	}
}