summaryrefslogtreecommitdiffstats
path: root/src/layouts/_hlist.scss
blob: 00787db7a1c546bc8d7839ba53be8717a8f54d9a (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
@use "sass:meta";
@use "pkg:iro-sass/bem";
@use "pkg:iro-sass/props";
@use "../props" as *;

@forward "hlist.vars";
@use "hlist.vars" as vars;
@use "../objects/button.vars" as button;

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

	@include bem.layout("hlist") {
		display: inline-flex;
		flex-wrap: wrap;
		gap: props.get(vars.$gap);

		@each $mod, $size in vars.$sizes {
			@include bem.modifier($mod) {
				gap: props.get($size);

				@include bem.modifier("separated") {
					@include bem.elem("item") {
						@include bem.next-twin-elem {
							&::before {
								content: "·";
								margin-inline: calc(0.65 * props.get($size));
							}
						}
					}
				}
			}
		}

		@include bem.modifier("separated") {
			gap: 0;

			@include bem.elem("item") {
				@include bem.next-twin-elem {
					&::before {
						content: "·";
						margin-inline: calc(0.65 * props.get(vars.$gap));
					}
				}
			}
		}

		@include bem.modifier("buttons") {
			margin-inline: calc(-1 * props.get(button.$pad-i) - props.get(button.$border-width));

			@include bem.modifier("pill") {
				margin-inline: calc(
					-1 * props.get(button.$pad-i-pill) - props.get(button.$border-width)
				);
			}

			@include bem.modifier("icon") {
				margin-inline: calc(
					-1 * props.get(button.$pad-b) - props.get(button.$border-width) - 0.5em *
						(props.get(button.$line-height) - 1)
				);
			}

			@each $mod, $pad-i, $pad-i-label, $pad-i-pill, $pad-b, $font-size in button.$fixed-sizes
			{
				@include bem.modifier("buttons-#{$mod}") {
					margin-inline: calc(-1 * props.get($pad-i) - props.get(button.$border-width));

					@include bem.modifier("pill") {
						margin-inline: calc(
							-1 * props.get($pad-i-pill) - props.get(button.$border-width)
						);
					}

					@include bem.modifier("icon") {
						margin-inline: calc(
							-1 * props.get($pad-b) - props.get(button.$border-width) - 0.5em *
								(props.get(button.$line-height) - 1)
						);
					}
				}
			}
		}
	}
}