Skip to content

Commit 30b79bb

Browse files
committed
Establish consistent theme system
1 parent 6d459b1 commit 30b79bb

File tree

66 files changed

+899
-383
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+899
-383
lines changed

dev-dist/registerSW.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
if ('serviceWorker' in navigator)
2+
navigator.serviceWorker.register('/dev-sw.js?dev-sw', { scope: '/', type: 'classic' });

dev-dist/sw.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,13 @@ define(['./workbox-5357ef54'], function (workbox) {
7979
*/
8080
workbox.precacheAndRoute(
8181
[
82+
{
83+
url: 'registerSW.js',
84+
revision: '3ca0b8505b4bec776b69afdba2768812',
85+
},
8286
{
8387
url: 'index.html',
84-
revision: '0.4hfq3gsql8',
88+
revision: '0.0mqaa5vqso8',
8589
},
8690
],
8791
{},

src/components/ActivityRow/ActivityRow.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,14 +31,14 @@ export function ActivityRow({ activity, stage, timeZone, showRoom = true }: Acti
3131
<Link
3232
key={activity.id}
3333
className={classNames(
34-
'flex flex-col w-full p-2 text-gray-900 dark:text-white even:bg-slate-50 even:dark:bg-gray-800 hover:bg-slate-100 dark:hover:bg-gray-700 even:hover:bg-slate-200 even:dark:hover:bg-gray-600',
34+
'flex flex-col w-full p-2 type-body even:bg-slate-50 even:dark:bg-gray-800 hover:bg-slate-100 dark:hover:bg-gray-700 even:hover:bg-slate-200 even:dark:hover:bg-gray-600',
3535
{
3636
'opacity-50': isOver,
3737
},
3838
)}
3939
to={`/competitions/${competitionId}/activities/${activity.id}`}>
40-
<span>{activityName}</span>
41-
<span className="flex justify-between text-xs font-light md:text-sm">
40+
<span className="type-body">{activityName}</span>
41+
<span className="flex justify-between type-meta">
4242
{showRoom && stage && (
4343
<RoomPill
4444
className="px-1 mr-2 rounded"

src/components/AssignmentCodeCell/AssignmentCodeCell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ export function AssignmentCodeCell<T extends React.ElementType = 'td'>({
7979
{count ? (
8080
<>
8181
{' '}
82-
<span className="text-sm">({count})</span>
82+
<span className="type-body-sm">({count})</span>
8383
</>
8484
) : null}
8585
</Component>

src/components/AssignmentLabel/AssignmentLabel.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export function AssignmentLabel({ assignmentCode }: AssignmentLabelProps) {
1111

1212
if (assignmentCode.match(/judge/i)) {
1313
return (
14-
<BaseAssignmentPill className="bg-blue-200 dark:bg-blue-900">
14+
<BaseAssignmentPill className="bg-primary">
1515
{t('common.assignments.staff-judge.noun', {
1616
defaultValue: assignmentCode.replace('staff-', ''),
1717
})}
@@ -63,8 +63,6 @@ export function AssignmentLabel({ assignmentCode }: AssignmentLabelProps) {
6363
<BaseAssignmentPill className="bg-amber-500 dark:bg-amber-900">{name}</BaseAssignmentPill>
6464
);
6565
default:
66-
return (
67-
<BaseAssignmentPill className="bg-blue-100 dark:bg-blue-900">{name}</BaseAssignmentPill>
68-
);
66+
return <BaseAssignmentPill className="bg-primary">{name}</BaseAssignmentPill>;
6967
}
7068
}

src/components/Breadcrumbs/Breadcrumbs.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ export const Breadcrumbs = ({ breadcrumbs }: BreadcrumbsProps) => {
2222
<div className="flex items-center space-x-1">
2323
{breadcrumbs.map(({ label, ...breadcrumb }, index) => (
2424
<Fragment key={label}>
25-
{index > 0 && <span className="text-gray-500 dark:text-gray-400">·</span>}
25+
{index > 0 && <span className="text-muted">·</span>}
2626
{'href' in breadcrumb ? (
2727
<Link to={breadcrumb.href}>
2828
<BreadcrumbPill

src/components/Button/Button.tsx

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,20 @@
11
import classNames from 'classnames';
22
import { ButtonHTMLAttributes, PropsWithChildren } from 'react';
33

4+
export type ButtonVariant = 'blue' | 'green' | 'gray' | 'light';
5+
46
export interface ButtonProps extends PropsWithChildren<ButtonHTMLAttributes<HTMLButtonElement>> {
57
className?: string;
6-
variant?: 'blue' | 'green' | 'gray' | 'light';
8+
variant?: ButtonVariant;
79
}
810

9-
export const Button = ({ className, variant = 'blue', ...props }: ButtonProps) => {
10-
const variantClasses = {
11-
blue: 'bg-blue-200 hover:bg-blue-300 dark:bg-blue-700 dark:hover:bg-blue-600 text-gray-900 dark:text-white border border-blue-300 dark:border-blue-600',
12-
green:
13-
'bg-green-200 hover:bg-green-400 dark:bg-green-700 dark:hover:bg-green-600 text-gray-900 dark:text-white border border-green-300 dark:border-green-600',
14-
gray: 'bg-gray-200 hover:bg-gray-300 dark:bg-gray-700 dark:hover:bg-gray-600 text-gray-900 dark:text-white border border-gray-300 dark:border-gray-600',
15-
light:
16-
'bg-gray-100 hover:bg-gray-200 dark:bg-gray-800 dark:hover:bg-gray-700 text-gray-900 dark:text-white border border-gray-300 dark:border-gray-600',
17-
};
11+
const variantClasses: Record<ButtonVariant, string> = {
12+
blue: 'btn-blue',
13+
green: 'btn-green',
14+
gray: 'btn-gray',
15+
light: 'btn-light',
16+
};
1817

19-
return (
20-
<button
21-
className={classNames(
22-
'px-4 py-2 rounded-md transition-colors',
23-
variantClasses[variant],
24-
className,
25-
)}
26-
{...props}
27-
/>
28-
);
18+
export const Button = ({ className, variant = 'blue', ...props }: ButtonProps) => {
19+
return <button className={classNames('btn', variantClasses[variant], className)} {...props} />;
2920
};

src/components/CompetitionList/CompetitionList.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export function CompetitionListFragment({
3131

3232
return (
3333
<div className="w-full p-2">
34-
<span className="text-sm text-blue-800 dark:text-blue-400">{title}</span>
34+
<span className="type-body-sm text-blue-800 dark:text-blue-400">{title}</span>
3535
{loading ? <BarLoader width="100%" /> : <div style={{ height: '4px' }} />}
3636
{!!competitions.length && (
3737
<ul className="px-0">
@@ -47,9 +47,7 @@ export function CompetitionListFragment({
4747
)}
4848
{!!lastFetchedAt && <LastFetchedAt lastFetchedAt={new Date(lastFetchedAt)} />}
4949
{!loading && !competitions.length && (
50-
<div className="text-center text-gray-500 dark:text-gray-400">
51-
{t('common.competitionList.noneFound')}
52-
</div>
50+
<div className="text-center text-muted">{t('common.competitionList.noneFound')}</div>
5351
)}
5452
</div>
5553
);

src/components/CompetitionListItem/CompetitionListItem.tsx

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,30 +33,33 @@ export const CompetitionListItem = ({
3333
<Link to={`/competitions/${id}`}>
3434
<li
3535
className={classNames(
36-
'border bg-white dark:bg-gray-800 dark:border-gray-700 list-none rounded-md px-2 py-2 flex cursor-pointer hover:bg-slate-100 dark:hover:bg-gray-700 group transition-colors my-1 flex-row',
36+
'link-card list-none flex flex-row cursor-pointer group transition-colors my-1 type-body',
3737
{
3838
'opacity-50': endDate < new Date(Date.now() - 1000 * 60 * 60 * 24),
3939
},
4040
)}>
4141
{hasFlag(country_iso2) && (
42-
<div className="flex flex-shrink mr-2 text-2xl"> {getUnicodeFlagIcon(country_iso2)} </div>
42+
<div className="flex flex-shrink mr-2 type-title">
43+
{' '}
44+
{getUnicodeFlagIcon(country_iso2)}{' '}
45+
</div>
4346
)}
4447
<div className="flex-1">
45-
<p className="font-normal leading-1 dark:text-white"> {name} </p>{' '}
46-
<p className="text-gray-600 dark:text-gray-400 text-sm leading-1">
48+
<p className="type-heading leading-1 dark:text-white"> {name} </p>{' '}
49+
<p className="type-body-sm text-muted leading-1">
4750
{formatDateRange(start_date, end_date)}
4851
{' '}&#8211;{' '}
4952
{city}
5053
</p>
5154
</div>
5255
{isLive && (
53-
<div className="flex flex-shrink text-2xl items-center px-2">
54-
<span className="fa fa-tower-broadcast text-green-500" />
56+
<div className="flex items-center flex-shrink px-2 type-title">
57+
<span className="text-green-500 fa fa-tower-broadcast" />
5558
</div>
5659
)}
5760
{isBookmarked && !isLive && (
58-
<div className="flex flex-shrink text-2xl items-center px-2">
59-
<span className="fa fa-bookmark text-yellow-500" />
61+
<div className="flex items-center flex-shrink px-2 type-title">
62+
<span className="text-yellow-500 fa fa-bookmark" />
6063
</div>
6164
)}
6265
</li>

src/components/CompetitionListItem/__snapshots__/CompetitionListItem.test.tsx.snap

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@ exports[`CompetitionListItem matches snapshot (default) 1`] = `
77
href="/competitions/123"
88
>
99
<li
10-
class="border bg-white dark:bg-gray-800 dark:border-gray-700 list-none rounded-md px-2 py-2 flex cursor-pointer hover:bg-slate-100 dark:hover:bg-gray-700 group transition-colors my-1 flex-row opacity-50"
10+
class="link-card list-none flex flex-row cursor-pointer group transition-colors my-1 type-body opacity-50"
1111
>
1212
<div
13-
class="flex flex-shrink mr-2 text-2xl"
13+
class="flex flex-shrink mr-2 type-title"
1414
>
1515
1616
🇺🇸
@@ -20,15 +20,15 @@ exports[`CompetitionListItem matches snapshot (default) 1`] = `
2020
class="flex-1"
2121
>
2222
<p
23-
class="font-normal leading-1 dark:text-white"
23+
class="type-heading leading-1 dark:text-white"
2424
>
2525
2626
Test Competition
2727
2828
</p>
2929
3030
<p
31-
class="text-gray-600 dark:text-gray-400 text-sm leading-1"
31+
class="type-body-sm text-muted leading-1"
3232
>
3333
Jan 1 – 2, 2024
3434
@@ -50,10 +50,10 @@ exports[`CompetitionListItem renders with all props (live and bookmarked) 1`] =
5050
href="/competitions/123"
5151
>
5252
<li
53-
class="border bg-white dark:bg-gray-800 dark:border-gray-700 list-none rounded-md px-2 py-2 flex cursor-pointer hover:bg-slate-100 dark:hover:bg-gray-700 group transition-colors my-1 flex-row opacity-50"
53+
class="link-card list-none flex flex-row cursor-pointer group transition-colors my-1 type-body opacity-50"
5454
>
5555
<div
56-
class="flex flex-shrink mr-2 text-2xl"
56+
class="flex flex-shrink mr-2 type-title"
5757
>
5858
5959
🇺🇸
@@ -63,15 +63,15 @@ exports[`CompetitionListItem renders with all props (live and bookmarked) 1`] =
6363
class="flex-1"
6464
>
6565
<p
66-
class="font-normal leading-1 dark:text-white"
66+
class="type-heading leading-1 dark:text-white"
6767
>
6868
6969
Test Competition
7070
7171
</p>
7272
7373
<p
74-
class="text-gray-600 dark:text-gray-400 text-sm leading-1"
74+
class="type-body-sm text-muted leading-1"
7575
>
7676
Jan 1 – 2, 2024
7777
@@ -81,10 +81,10 @@ exports[`CompetitionListItem renders with all props (live and bookmarked) 1`] =
8181
</p>
8282
</div>
8383
<div
84-
class="flex flex-shrink text-2xl items-center px-2"
84+
class="flex items-center flex-shrink px-2 type-title"
8585
>
8686
<span
87-
class="fa fa-tower-broadcast text-green-500"
87+
class="text-green-500 fa fa-tower-broadcast"
8888
/>
8989
</div>
9090
</li>

0 commit comments

Comments
 (0)