-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOutlinedButton.astro
More file actions
79 lines (69 loc) · 1.46 KB
/
Copy pathOutlinedButton.astro
File metadata and controls
79 lines (69 loc) · 1.46 KB
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
---
interface Props {
lightColor?: string;
darkColor?: string;
borderRadius?: string;
padding?: string;
href?: string;
}
const {
lightColor = "#715ec2",
darkColor = "#af60fa",
borderRadius = "clamp(4px, 1em, 20px)",
padding = "0.6em 1.5em",
href = "#",
} = Astro.props;
---
<a href={href} class="button-container">
<button class="button">
<slot />
</button>
</a>
<style
define:vars={{
lightColor,
darkColor,
padding,
borderRadius,
}}
>
.button-container {
display: inline-flex;
text-decoration: none;
width: fit-content;
}
.button {
--color: var(--lightColor); /* 基础重置 */
border: 0.15em solid var(--color);
outline: none;
cursor: pointer;
white-space: nowrap;
display: inline-flex;
align-items: center;
justify-content: center;
background: transparent;
padding: var(--padding);
border-radius: var(--borderRadius);
color: var(--color);
font-weight: bold;
width: auto;
height: auto;
font-size: 1vw;
transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
transform: scale(1);
}
[data-theme="dark"] {
.button {
--color: var(--darkColor);
}
}
.button:hover {
/* background: color-mix(in srgb, var(--color), white 15%); */
transform: scale(1.05);
}
.button:active {
transform: scale(0.96);
/* background: color-mix(in srgb, var(--color), black 10%); */
transition: all 0.1s ease;
}
</style>