Skip to content

Commit 1fafacb

Browse files
committed
client download - buttons look tweaks
1 parent fb052ef commit 1fafacb

File tree

2 files changed

+65
-17
lines changed

2 files changed

+65
-17
lines changed

src/components/buttons/DownloadButton/DownloadButton.tsx

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,32 @@ export const DownloadButton = ({ platformType, owner, repo, version }: DownloadP
2424
const [isLinuxMenuClicked, setIsLinuxMenuClicked] = useState(false);
2525
const [isAppleMenuClicked, setIsAppleMenuClicked] = useState(false);
2626
const [platform, setPlatform] = useState(platformType);
27+
const [downloadName, setDownloadName] = useState("");
28+
29+
useEffect(() => {
30+
switch (platform) {
31+
case PlatformType.WINDOWS: {
32+
setDownloadName(`defguard-client_${version}_x64_en-US.exe`);
33+
break;
34+
}
35+
case PlatformType.MACOSARM: {
36+
setDownloadName(`defguard-aarch64-apple-darwin-${version}.pkg`);
37+
break;
38+
}
39+
case PlatformType.MACOSINTEL: {
40+
setDownloadName(`defguard-x86_64-apple-darwin-${version}.pkg`);
41+
break;
42+
}
43+
case PlatformType.DEBIAN: {
44+
setDownloadName(`defguard-client_${version}_amd64.deb`);
45+
break;
46+
}
47+
case PlatformType.ARCHLINUX: {
48+
setDownloadName(`defguard-client_${version}_amd64.deb`);
49+
break;
50+
}
51+
}
52+
}, [platform, version]);
2753

2854
const handleClick = () => {
2955
setIsButtonClicked(true);
@@ -160,7 +186,11 @@ export const DownloadButton = ({ platformType, owner, repo, version }: DownloadP
160186
</>
161187
)}
162188
</div>
163-
<div className="download-main">
189+
<a
190+
href={platform === PlatformType.ARCHLINUX ? ARCHLINK : `https://github.com/${owner}/${repo}/releases/download/v${version}/${downloadName}`}
191+
className="download-main"
192+
onClick={handleClick}
193+
>
164194
<div className="download-text">
165195
{(platform === PlatformType.DEBIAN ||
166196
platform === PlatformType.MACOSINTEL ||
@@ -171,7 +201,7 @@ export const DownloadButton = ({ platformType, owner, repo, version }: DownloadP
171201
{platform === PlatformType.MACOSINTEL && <p>Apple Intel</p>}
172202
{platform === PlatformType.MACOSARM && <p>Apple ARM</p>}
173203
</div>
174-
<div className="btn" onClick={handleClick}>
204+
<div className="btn">
175205
{isButtonClicked ? (
176206
<CheckIcon />
177207
) : platform !== PlatformType.ARCHLINUX ? (
@@ -182,12 +212,10 @@ export const DownloadButton = ({ platformType, owner, repo, version }: DownloadP
182212
version={version}
183213
/>
184214
) : (
185-
<h3>
186-
<a href={ARCHLINK}></a>
187-
</h3>
215+
<h3></h3>
188216
)}
189217
</div>
190-
</div>
218+
</a>
191219
<div className="download-footer">
192220
{(platform === PlatformType.DEBIAN || platform === PlatformType.ARCHLINUX) && (
193221
<>

src/components/buttons/DownloadButton/style.scss

Lines changed: 31 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,14 @@
3232

3333
.download-menu {
3434
position: absolute;
35-
border-radius: 0px 25px 25px 0px;
35+
border-radius: 0;
3636
border: 1px solid var(--text-body-primary);
37+
border-top: unset;
3738
background: var(--surface-frame-bg);
3839
text-align: center;
3940

4041
ul {
41-
padding: 0 40px;
42+
padding: 0 30px;
4243
line-height: 25px;
4344
list-style-type: none;
4445
}
@@ -47,6 +48,10 @@
4748
text-decoration: none;
4849
cursor: pointer;
4950
}
51+
52+
a:hover {
53+
color: #0c8ce0;
54+
}
5055
}
5156

5257
.closed {
@@ -62,44 +67,59 @@
6267
display: flex;
6368
height: 78px;
6469
padding: 0px 20px;
65-
6670
justify-content: space-between;
6771
align-items: center;
6872
align-self: stretch;
69-
7073
border: 1px solid var(--text-body-primary);
74+
text-decoration: none;
75+
color: inherit;
76+
cursor: pointer;
77+
transition: all 0.2s ease;
78+
79+
&:hover {
80+
background-color: var(--surface-frame-bg);
81+
border-color: #0c8ce0;
82+
83+
.download-text {
84+
color: #0c8ce0;
85+
}
86+
87+
svg {
88+
path,
89+
rect {
90+
stroke: #0c8ce0;
91+
}
92+
}
93+
}
7194

7295
.download-text {
7396
display: flex;
7497
flex-direction: column;
7598
justify-content: flex-start;
7699
align-items: flex-start;
77-
78100
@include typography(paragraph);
101+
transition: color 0.2s ease;
79102

80103
p {
81104
@include typography(footer);
82105
}
83106
}
84107

85-
& > .btn {
108+
.btn {
86109
all: unset;
110+
padding: 20px;
87111

88112
&:hover {
89113
cursor: pointer;
90114
}
91-
92-
a {
93-
text-decoration: none;
94-
padding: 20px;
95-
}
96115
}
97116

98117
svg {
99118
path,
100119
rect {
101120
fill: none;
102121
stroke: var(--text-body-primary);
122+
transition: stroke 0.2s ease;
103123
}
104124
}
105125
}

0 commit comments

Comments
 (0)