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
@@ -31,25 +32,26 @@ const { text, href, command } = Astro.props as Props;
31
32
justify-content: center;
32
33
gap: 1rem;
33
34
34
-
35
35
@media (min-width: 50rem) {
36
36
flex-direction: row;
37
37
gap: 2rem;
38
38
}
39
-
40
39
}
41
40
42
41
a.button {
43
-
44
42
@property --spin {
45
- syntax: ' <angle>' ;
43
+ syntax: " <angle>" ;
46
44
initial-value: 35deg;
47
45
inherits: false;
48
46
}
49
47
50
- background: linear-gradient(var(--spin), var(--brand-purple) 0%, var(--brand-red) 100%);
48
+ background: linear-gradient(
49
+ var(--spin),
50
+ var(--brand-purple) 0%,
51
+ var(--brand-red) 100%
52
+ );
51
53
color: var(--brand-white);
52
-
54
+
53
55
font-size: 18px;
54
56
height: 48px;
55
57
border-radius: 50px;
@@ -62,11 +64,13 @@ const { text, href, command } = Astro.props as Props;
62
64
display: flex;
63
65
align-items: center;
64
66
justify-content: center;
65
- ;
66
67
&:hover {
67
- background: linear-gradient(var(--spin), var(--brand-pink) 0%, var(--brand-pink) 100%);
68
+ background: linear-gradient(
69
+ var(--spin),
70
+ var(--brand-pink) 0%,
71
+ var(--brand-pink) 100%
72
+ );
68
73
background: var(--brand-pink);
69
-
70
74
}
71
75
&:hover {
72
76
transform: translate3d(-2px, -2px, 0);
@@ -81,7 +85,6 @@ const { text, href, command } = Astro.props as Props;
81
85
box-shadow: none;
82
86
}
83
87
}
84
-
85
88
86
89
.install-command {
87
90
display: flex;
@@ -93,8 +96,8 @@ const { text, href, command } = Astro.props as Props;
93
96
font-weight: bold;
94
97
background: black;
95
98
position: relative;
96
- html[data-theme=' light' ] & {
97
- background: rgba(0,0,0, .2);
99
+ html[data-theme=" light" ] & {
100
+ background: rgba(0, 0, 0, 0 .2);
98
101
background: var(--brand-cyan--t2);
99
102
color: black;
100
103
}
@@ -105,9 +108,12 @@ const { text, href, command } = Astro.props as Props;
105
108
--border-gradient-color-1: var(--brand-green);
106
109
--border-gradient-color-2: var(--brand-cyan);
107
110
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));
111
+ border-image-source: linear-gradient(
112
+ 90deg,
113
+ var(--border-gradient-color-1),
114
+ var(--border-gradient-color-2)
115
+ );
109
116
border-image-slice: 1;
110
-
111
117
112
118
:global(.d-icon) {
113
119
height: 44px;
@@ -119,7 +125,7 @@ const { text, href, command } = Astro.props as Props;
119
125
width: 36px;
120
126
padding: 8px;
121
127
}
122
-
128
+
123
129
// copy icon
124
130
&:last-child {
125
131
position: absolute;
@@ -134,23 +140,26 @@ const { text, href, command } = Astro.props as Props;
134
140
}
135
141
.install-command__copy.--success {
136
142
color: var(--brand-green) !important;
137
- :global(svg:nth-child(1)) { display: none; }
138
- :global(svg:nth-child(2)) { display: block; }
143
+ :global(svg:nth-child(1)) {
144
+ display: none;
145
+ }
146
+ :global(svg:nth-child(2)) {
147
+ display: block;
148
+ }
139
149
}
140
-
141
-
142
150
}
143
151
</style >
144
152
145
153
<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
- });
154
+ document
155
+ .querySelector(".install-command__copy")
156
+ ?.addEventListener("click", async (e) => {
157
+ await navigator.clipboard.writeText("npx dmno init");
158
+ if (e.target instanceof Element) {
159
+ e.target.classList.add("--success");
160
+ setTimeout(() => {
161
+ (e.target as Element).classList.remove("--success");
162
+ }, 2000);
163
+ }
164
+ });
155
165
</script >
156
-
0 commit comments