Skip to content

Commit 6a4c4cc

Browse files
authored
chore: use better colours for channels (#163)
1 parent 31c34b5 commit 6a4c4cc

File tree

5 files changed

+46
-25
lines changed

5 files changed

+46
-25
lines changed

src/components/data/SoftwareBuilds.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@ const SoftwareBuilds = ({ project, version, builds, eol }: SoftwareBuildsProps)
2424
href={build.downloads["server:default"].url}
2525
target="_blank"
2626
className={clsx(
27-
"text-gray-100 text-sm text-center font-medium rounded-full p-2 min-w-16 mr-4 inline-flex items-center gap-1",
27+
"text-sm text-center font-medium rounded-full p-2 min-w-16 mr-4 inline-flex items-center gap-1",
28+
eol ? "bg-channel-eol-primary" : `bg-channel-${build?.channel?.toLowerCase()}-primary`,
29+
eol ? "text-channel-eol-secondary" : `text-channel-${build?.channel?.toLowerCase()}-secondary`,
2830
)}
29-
style={{
30-
backgroundColor: `var(${eol ? "--channel-eol" : `--channel-${build.channel.toLowerCase()}`})`,
31-
}}
3231
>
3332
<DownloadIcon className="w-4 h-4" />#{build.id}
3433
</a>

src/components/data/SoftwareBuildsTable.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,11 @@ const SoftwareBuildsTable = ({ project, version, builds, eol }: SoftwareBuildsTa
3131
<tr key={build.id}>
3232
<td>
3333
<span
34-
className={clsx("text-sm font-medium text-gray-100 rounded-full py-2 px-3 min-w-16")}
35-
style={{
36-
backgroundColor: `var(${eol ? "--channel-eol" : `--channel-${build.channel.toLowerCase()}`})`,
37-
}}
34+
className={clsx(
35+
"text-sm font-medium text-gray-100 rounded-full py-2 px-3 min-w-16",
36+
eol ? "bg-channel-eol-primary" : `bg-channel-${build?.channel?.toLowerCase()}-primary`,
37+
eol ? "text-channel-eol-secondary" : `text-channel-${build?.channel?.toLowerCase()}-secondary`,
38+
)}
3839
>
3940
#{build.id}
4041
</span>

src/components/input/SoftwareDownloadButton.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,11 @@ const SoftwareDownloadButton = ({ projectId, project, build, version, compact, e
3535
<Menu as="div" className="relative w-max">
3636
<div
3737
className={clsx(
38-
"rounded-lg flex flex-row ransition-shadow text-white transition-color hover:shadow-lg",
38+
"rounded-lg flex flex-row ransition-shadow transition-color hover:shadow-lg",
3939
!compact && "w-full md:w-100",
40+
eol ? "bg-channel-eol-primary" : `bg-channel-${build?.channel?.toLowerCase()}-primary`,
41+
eol ? "text-channel-eol-secondary" : `text-channel-${build?.channel?.toLowerCase()}-secondary`,
4042
)}
41-
style={{
42-
backgroundColor: `var(${eol ? "--channel-eol" : `--channel-${build?.channel.toLowerCase()}`})`,
43-
}}
4443
>
4544
{/* eslint-disable-next-line react/jsx-no-target-blank */}
4645
<a
@@ -62,7 +61,7 @@ const SoftwareDownloadButton = ({ projectId, project, build, version, compact, e
6261
<span className="font-medium text-lg">
6362
{project?.name ?? projectId} {version}
6463
</span>
65-
<p className="text-gray-100">{build && `Build #${build.id}`}</p>
64+
<p>{build && `Build #${build.id}`}</p>
6665
</>
6766
) : (
6867
<>

src/components/layout/SoftwareDownload.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ const SoftwareDownload = ({
6464
<h2 className="font-medium leading-normal lg:text-5xl lg:leading-normal text-4xl">
6565
Get {project.name}&nbsp;
6666
<span
67-
style={{
68-
color: `var(${eol ? "--channel-eol" : `--channel-${latestBuild?.channel.toLowerCase()}`})`,
69-
}}
67+
className={clsx(
68+
eol ? "text-channel-eol-primary" : `text-channel-${latestBuild?.channel?.toLowerCase()}-primary`,
69+
)}
7070
>
7171
{version}
7272
</span>

styles/globals.css

Lines changed: 31 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
@custom-variant dark (@media (prefers-color-scheme: dark));
44

5+
@source inline("bg-channel-alpha-primary bg-channel-alpha-secondary bg-channel-beta-primary bg-channel-beta-secondary bg-channel-stable-primary bg-channel-stable-secondary bg-channel-recommended-primary bg-channel-recommended-secondary bg-channel-eol-primary bg-channel-eol-secondary");
6+
@source inline("text-channel-alpha-primary text-channel-alpha-secondary text-channel-beta-primary text-channel-beta-secondary text-channel-stable-primary text-channel-stable-secondary text-channel-recommended-primary text-channel-recommended-secondary text-channel-eol-primary text-channel-eol-secondary");
7+
58
@theme {
69
--font-sans: Poppins, Roboto, Open Sans, ui-sans-serif, system-ui, sans-serif;
710

@@ -47,6 +50,34 @@
4750
--scale-120: 1.2;
4851
}
4952

53+
@theme {
54+
/* These colours come from Fill - changes must be synchronized. */
55+
--color-channel-alpha-primary: #ea5b6f;
56+
--color-channel-alpha-secondary: var(--color-white);
57+
--color-channel-beta-primary: #ffc859;
58+
--color-channel-beta-secondary: var(--color-black);
59+
--color-channel-stable-primary: var(--color-blue-500);
60+
--color-channel-stable-secondary: var(--color-white);
61+
--color-channel-recommended-primary: #4ecb8b;
62+
--color-channel-recommended-secondary: var(--color-white);
63+
--color-channel-eol: #374151;
64+
--color-channel-eol: #374151;
65+
}
66+
67+
@variant dark {
68+
:root {
69+
/* These colours come from Fill - changes must be synchronized. */
70+
--color-channel-alpha-primary: #e42e47;
71+
--color-channel-alpha-secondary: var(--color-white);
72+
--color-channel-beta-primary: #f9da22;
73+
--color-channel-beta-secondary: var(--color-black);
74+
--color-channel-stable-primary: var(--color-blue-500);
75+
--color-channel-stable-secondary: var(--color-white);
76+
--color-channel-recommended-primary: #4ecb8b;
77+
--color-channel-recommended-secondary: var(--color-white);
78+
}
79+
}
80+
5081
/*
5182
The default border color has changed to `currentcolor` in Tailwind CSS v4,
5283
so we've added these compatibility styles to make sure everything still
@@ -80,12 +111,3 @@ body {
80111
#__next {
81112
@apply flex flex-col h-screen;
82113
}
83-
84-
/* Add our channel colors to the global CSS */
85-
:root {
86-
--channel-alpha: #ea1500;
87-
--channel-beta: #d8c200;
88-
--channel-stable: #0a9ada;
89-
--channel-recommended: #409c93;
90-
--channel-eol: #374151;
91-
}

0 commit comments

Comments
 (0)