summaryrefslogtreecommitdiff
path: root/src/components/ButtonMenu.css
blob: 45d986a3dac1573c90f5a598b562882c876440e0 (plain)
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
@scope (.__ButtonMenu) {
	:scope {
		> button {
			position: relative;
			padding-left: 2.5rem;

			&::before {
				content: '';
				width: 1rem;
				height: 1rem;
				left: 0.75rem;
				position: absolute;
				background: url('../icons/chevron-right.svg');
				background-position: left 2px center;
				background-repeat: no-repeat;
			}

			&:has(+ :popover-open)::before {
				transform: rotate(90deg);
			}

			@media not (prefers-reduced-motion) {
				&::before {
					transition: transform 0.2s;
				}
			}
		}

		[popover] {
			inset: unset;
			top: var(--anchor-y);
			left: var(--anchor-x);

			@media not (prefers-reduced-motion) {
				transform: translate(0, -100%);
				clip-path: xywh(0 100% 100% 100%);

				transition-property: transform, clip-path, overlay, display;
				transition-duration: 0.2s;
				transition-behavior: allow-discrete;
	
				&:popover-open {
					transform: none;
					clip-path: xywh(0 0 100% 100%);
	
					@starting-style {
						transform: translate(0, -100%);
						clip-path: xywh(0 100% 100% 100%);
					}
				}
			}
		}
	}
}