Skip to content

Commit f589430

Browse files
committed
sleeker project button shadow
1 parent 95d0533 commit f589430

File tree

2 files changed

+30
-10
lines changed

2 files changed

+30
-10
lines changed

blocks/button/ButtonAbstract.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@ export default class ButtonAbstract {
4343
];
4444

4545
return {
46-
'--button--mouse-shadow-left': hover[0] + 'px',
47-
'--button--mouse-shadow-top': hover[1] + 'px'
46+
'--button--mouse-shadow-left': hover[0],
47+
'--button--mouse-shadow-top': hover[1],
48+
'--button--width': rect.width
4849
};
4950
}
5051

blocks/button/button.css

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,20 +64,39 @@
6464

6565
.button:hover,
6666
.button:focus {
67+
--a: calc(var(--button--mouse-shadow-left) - (0.5 * var(--button--width)));
68+
6769
background-image:
6870
var(--_add-background),
6971
radial-gradient(
70-
circle at
72+
ellipse at
7173
calc(
72-
var(--button--mouse-shadow-left, -100%)
74+
var(--button--mouse-shadow-left, -10000) * 1px
7375
/ var(--_hover-scale)
7476
)
77+
bottom,
78+
var(--_c1) 0,
79+
transparent calc(0.12 * var(--_w))
80+
),
81+
radial-gradient(
82+
ellipse at
7583
calc(
76-
var(--button--mouse-shadow-top, -100%) /
77-
var(--_hover-scale)
78-
),
84+
var(--button--mouse-shadow-left, -10000) * 1px
85+
/ var(--_hover-scale)
86+
)
87+
top,
88+
var(--_c1) 0,
89+
transparent calc(0.12 * var(--_w))
90+
),
91+
radial-gradient(
92+
circle at
93+
calc(
94+
calc(var(--button--mouse-shadow-left, -10000) * 1px)
95+
/ var(--_hover-scale)
96+
)
97+
center,
7998
var(--_c1) 0,
80-
transparent calc(0.5 * var(--_w))
99+
transparent calc(0.007 * var(--a) * var(--a) * 1px + 0.1 * var(--_w))
81100
);
82101
box-shadow: 0 0 calc(0.015 * var(--_w)) 0 var(--_c0);
83102
outline: none;
@@ -128,11 +147,11 @@
128147
radial-gradient(
129148
circle at
130149
calc(
131-
var(--button--mouse-shadow-left, -100%)
150+
var(--button--mouse-shadow-left, -100%) * 1px
132151
/ var(--_hover-scale)
133152
)
134153
calc(
135-
var(--button--mouse-shadow-top, -100%) /
154+
var(--button--mouse-shadow-top, -100%) * 1px /
136155
var(--_hover-scale)
137156
),
138157
var(--_c1) 0,

0 commit comments

Comments
 (0)