summaryrefslogtreecommitdiffstats
path: root/src/objects/_emoji.scss
blob: 0257b32b9b11d3dbfbccb31268ba436f96eae1e6 (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
@use "sass:meta";
@use "pkg:iro-sass/bem";
@use "pkg:iro-sass/props";
@use "../props" as *;
@use "icon.vars" as icon;

@forward "emoji.vars";
@use "emoji.vars" as vars;

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

	@include bem.object("emoji") {
		position: relative;
		display: inline-block;
		inline-size: calc(props.get(vars.$size));
		block-size: calc(props.get(vars.$size));
		padding: calc(props.get(vars.$pad));
		margin: calc(-1 * props.get(vars.$pad));
		vertical-align: props.get(vars.$valign);
		object-fit: contain;

		@include bem.modifier("icon") {
			margin: calc(
				-1 * props.get(vars.$pad) - 0.5 * (props.get(vars.$size) - props.get(icon.$size))
			);
			vertical-align: props.get(icon.$valign);
		}

		@each $mod, $size, $valign in vars.$sizes {
			@include bem.modifier($mod) {
				inline-size: props.get($size);
				block-size: props.get($size);
				vertical-align: props.get($valign);

				@include bem.modifier("icon") {
					margin: calc(
						-1 * props.get(vars.$pad) - 0.5 * (props.get($size) - props.get(icon.$size))
					);
				}
			}
		}

		@include bem.modifier("zoomable") {
			border-radius: calc(props.get(vars.$rounding) / props.get(vars.$zoom));
			transition:
				transform 0.2s ease,
				background-color 0.2s ease;

			&:hover {
				background-color: props.get(vars.$bg-color);
				transform: scale(props.get(vars.$zoom));
			}
		}
	}
}