Skip to content

Commit b760e0d

Browse files
committed
tarball separator
1 parent cc6322e commit b760e0d

File tree

1 file changed

+56
-20
lines changed

1 file changed

+56
-20
lines changed

src/components/GithubReleases/GithubReleases.astro

Lines changed: 56 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -76,23 +76,36 @@ function getPlatformType(assetName: string): PlatformType {
7676
{latestRelease.assets && latestRelease.assets.length > 0 && (
7777
<div class="assets-container">
7878
<ul class="assets-list">
79-
{latestRelease.assets.map((asset: any) => (
80-
<li class="asset-item">
81-
<a
82-
href={asset.browser_download_url}
83-
target="_blank"
84-
rel="noopener noreferrer"
85-
class="download-button-wrapper"
86-
title={`Size: ${(asset.size / 1024 / 1024).toFixed(2)} MB`}
87-
>
88-
<div class="download-text-wrapper">
89-
<span class="download-filename">Download now</span>
90-
{getAssetDescription(asset.name) && <p>{getAssetDescription(asset.name)}</p>}
91-
</div>
92-
<DownloadIcon />
93-
</a>
94-
</li>
95-
))}
79+
{(() => {
80+
const assets = latestRelease.assets;
81+
const tarGzIndex = assets.findIndex((a: any) => a.name.includes('.tar.gz'));
82+
return assets.map((asset: any, idx: number) => [
83+
(idx === tarGzIndex && tarGzIndex !== 0) ? (
84+
<li class="asset-separator">
85+
<div class="download-separator">
86+
<hr />
87+
<p>compressed archives</p>
88+
<hr />
89+
</div>
90+
</li>
91+
) : null,
92+
<li class="asset-item">
93+
<a
94+
href={asset.browser_download_url}
95+
target="_blank"
96+
rel="noopener noreferrer"
97+
class="download-button-wrapper"
98+
title={`Size: ${(asset.size / 1024 / 1024).toFixed(2)} MB`}
99+
>
100+
<div class="download-text-wrapper">
101+
<span class="download-filename">Download now</span>
102+
{getAssetDescription(asset.name) && <p>{getAssetDescription(asset.name)}</p>}
103+
</div>
104+
<DownloadIcon />
105+
</a>
106+
</li>
107+
]).flat();
108+
})()}
96109
</ul>
97110
</div>
98111
)}
@@ -114,9 +127,6 @@ function getPlatformType(assetName: string): PlatformType {
114127
text-align: center;
115128
}
116129

117-
.release-container {
118-
padding-top: 1rem;
119-
}
120130

121131
.release-header {
122132
margin-bottom: 0.5rem;
@@ -224,10 +234,36 @@ function getPlatformType(assetName: string): PlatformType {
224234
}
225235
}
226236

237+
.download-separator {
238+
display: flex;
239+
align-items: center;
240+
gap: 40px;
241+
align-self: stretch;
242+
text-align: center;
243+
@include typography(footer);
244+
padding-top: 1.5rem;
245+
padding-bottom: 1.5rem;
246+
247+
hr {
248+
flex: 1;
249+
height: 1px;
250+
background-color: var(--border-separator);
251+
border: none;
252+
margin: 0;
253+
}
254+
255+
p {
256+
width: 30%;
257+
}
258+
}
259+
227260
@include break-down(sm) {
228261
P {
229262
font-size: 12px;
230263
font-weight: 300;
231264
}
265+
.download-separator p {
266+
width: 30%;
267+
}
232268
}
233269
</style>

0 commit comments

Comments
 (0)