1
1
---
2
- import DIcon from ' @/components/DIcon.astro' ;
2
+ import DIcon from " @/components/DIcon.astro" ;
3
+ import TileButton from " @/components/TileButton.vue" ;
4
+
3
5
interface Props {
4
6
text? : string ;
5
7
href? : string ;
6
8
command? : string ;
7
9
}
8
10
9
11
const { text, href, command } = Astro .props as Props ;
10
-
11
12
---
12
13
13
14
<div class =" cta-block" >
14
- { href && text &&
15
- < a href = { href } class = " button " > { text } </ a >
16
- }
17
- { command &&
18
- < div class = " install-command " >
19
- < DIcon name = " console " / >
20
- < div > { command } </ div >
21
- <DIcon name = { [ ' copy ' , ' check ' ] } class = " install-command__copy " / >
22
- </ div >
15
+ { href && text && < TileButton href = { href } > { text } </ TileButton > }
16
+ {
17
+ command && (
18
+ < div class = " install-command " >
19
+ < DIcon name = " console " / >
20
+ < div > { command } </ div >
21
+ < DIcon name = { [ " copy " , " check " ] } class = " install-command__copy " / >
22
+ </ div >
23
+ )
23
24
}
24
25
</div >
25
26
26
27
<style lang =" less" >
28
+ @property --spin-angle {
29
+ syntax: "<angle>";
30
+ initial-value: 0deg;
31
+ inherits: true;
32
+ }
33
+ @keyframes spin {
34
+ 0% {
35
+ --spin-angle: 0deg;
36
+ }
37
+ 100% {
38
+ --spin-angle: 360deg;
39
+ }
40
+ }
41
+
27
42
.cta-block {
28
43
display: flex;
29
44
flex-wrap: wrap;
30
45
// flex-direction: column;
31
46
justify-content: center;
32
47
gap: 1rem;
33
48
34
-
35
49
@media (min-width: 50rem) {
36
50
flex-direction: row;
37
51
gap: 2rem;
38
52
}
39
-
40
- }
41
-
42
- a.button {
43
-
44
- @property --spin {
45
- syntax: '<angle>';
46
- initial-value: 35deg;
47
- inherits: false;
48
- }
49
-
50
- background: linear-gradient(var(--spin), var(--brand-purple) 0%, var(--brand-red) 100%);
51
- color: var(--brand-white);
52
-
53
- font-size: 18px;
54
- height: 48px;
55
- border-radius: 50px;
56
- padding: 0px 2rem;
57
- align-content: center;
58
- font-weight: bold;
59
- text-wrap: nowrap;
60
- text-decoration: none;
61
- text-align: center;
62
- display: flex;
63
- align-items: center;
64
- justify-content: center;
65
- ;
66
- &:hover {
67
- background: linear-gradient(var(--spin), var(--brand-pink) 0%, var(--brand-pink) 100%);
68
- background: var(--brand-pink);
69
-
70
- }
71
- &:hover {
72
- transform: translate3d(-2px, -2px, 0);
73
- background: var(--brand-pink);
74
- box-shadow: 2px 2px 0 var(--tile-drop-shadow);
75
- }
76
- &:focus {
77
- outline: 1px solid var(--brand-pink);
78
- }
79
- &:active {
80
- transform: translate3d(0, 0, 0);
81
- box-shadow: none;
82
- }
83
53
}
84
-
85
54
86
55
.install-command {
87
56
display: flex;
88
57
font-size: 18px;
89
58
height: 48px;
90
- border: 2px solid var(--brand-pink);
59
+ border: 1px solid var(--brand-pink);
60
+
91
61
align-items: center;
92
62
padding-right: 64px;
93
63
font-weight: bold;
94
64
background: black;
95
65
position: relative;
96
- html[data-theme='light'] & {
97
- background: rgba(0,0,0,.2);
98
- background: var(--brand-cyan--t2);
99
- color: black;
100
- }
101
-
102
66
font-family: var(--code-font);
103
67
text-wrap: nowrap;
104
68
105
- --border-gradient-color-1: var(--brand-green);
106
- --border-gradient-color-2: var(--brand-cyan);
107
- border: 2px solid var(--border-gradient-color-1);
108
- border-image-source: linear-gradient(90deg, var(--border-gradient-color-1), var(--border-gradient-color-2));
69
+ --glow-color: var(--brand-yellow);
70
+ animation: spin 5s linear infinite;
71
+ html[data-theme="light"] & {
72
+ // background: rgba(0, 0, 0, 0.2);
73
+ background: color-mix(in oklab, var(--brand-cyan) 10%, white);
74
+ color: black;
75
+ --glow-color: var(--brand-cyan);
76
+ }
77
+
78
+ border: 1px solid var(--brand-green);
79
+ border-image-source: conic-gradient(
80
+ from calc(var(--spin-angle) + 180deg),
81
+ var(--glow-color) 0deg,
82
+ var(--brand-green) 45deg,
83
+ var(--brand-green) 315deg,
84
+ var(--glow-color) 360deg
85
+ );
109
86
border-image-slice: 1;
110
-
87
+
88
+ // glow
89
+ &:before {
90
+ content: "";
91
+ inset: 0;
92
+ position: absolute;
93
+ background: red;
94
+ z-index: -1;
95
+ filter: blur(3px);
96
+ background: conic-gradient(
97
+ from var(--spin-angle),
98
+ var(--glow-color) 0deg,
99
+ transparent 45deg,
100
+ transparent 315deg,
101
+ var(--glow-color) 360deg
102
+ );
103
+ }
111
104
112
105
:global(.d-icon) {
113
106
height: 44px;
@@ -119,7 +112,7 @@ const { text, href, command } = Astro.props as Props;
119
112
width: 36px;
120
113
padding: 8px;
121
114
}
122
-
115
+
123
116
// copy icon
124
117
&:last-child {
125
118
position: absolute;
@@ -134,23 +127,26 @@ const { text, href, command } = Astro.props as Props;
134
127
}
135
128
.install-command__copy.--success {
136
129
color: var(--brand-green) !important;
137
- :global(svg:nth-child(1)) { display: none; }
138
- :global(svg:nth-child(2)) { display: block; }
130
+ :global(svg:nth-child(1)) {
131
+ display: none;
132
+ }
133
+ :global(svg:nth-child(2)) {
134
+ display: block;
135
+ }
139
136
}
140
-
141
-
142
137
}
143
138
</style >
144
139
145
140
<script >
146
- document.querySelector('.install-command__copy')?.addEventListener('click', async (e) => {
147
- await navigator.clipboard.writeText('npx dmno init');
148
- if (e.target instanceof Element) {
149
- e.target.classList.add('--success');
150
- setTimeout(() => {
151
- (e.target as Element).classList.remove('--success');
152
- }, 2000);
153
- }
154
- });
141
+ document
142
+ .querySelector(".install-command__copy")
143
+ ?.addEventListener("click", async (e) => {
144
+ await navigator.clipboard.writeText("npx dmno init");
145
+ if (e.target instanceof Element) {
146
+ e.target.classList.add("--success");
147
+ setTimeout(() => {
148
+ (e.target as Element).classList.remove("--success");
149
+ }, 2000);
150
+ }
151
+ });
155
152
</script >
156
-
0 commit comments