Skip to content

Commit ac62085

Browse files
Merge pull request #542 from maiieul/to-css-vars
docs(colors): replace colors with css-vars for auto dark/light mode and single source of truth
2 parents 1d663c5 + be11f76 commit ac62085

File tree

100 files changed

+920
-1048
lines changed

Some content is hidden

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

100 files changed

+920
-1048
lines changed

apps/website/src/components/anatomy-table/anatomy-table.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,25 +13,27 @@ type AnatomyTableProps = {
1313
export const AnatomyTable = component$(
1414
({ firstColumnLabel = 'Component', propDescriptors }: AnatomyTableProps) => {
1515
return (
16-
<div class="overflow-auto">
17-
<table class="w-full max-w-full text-left">
18-
<tbody class="divide-y divide-slate-200 dark:divide-slate-800">
19-
<tr class="text-slate-950 dark:text-white">
20-
<td class="whitespace-nowrap py-2 pl-4 text-sm font-[700] font-medium sm:pl-0">
16+
<div class="prose prose-sm overflow-auto">
17+
<table class="mb-6 w-full min-w-[540px] text-left sm:min-w-full">
18+
<tbody class="divide-y">
19+
<tr class="text-foreground">
20+
<td class="w-2/6 whitespace-nowrap p-2 text-base font-semibold sm:pl-0">
2121
{firstColumnLabel}
2222
</td>
23-
<td class="whitespace-nowrap py-2 text-sm font-[600]">Description</td>
23+
<td class="w-4/6 whitespace-nowrap p-2 text-base font-semibold sm:pl-0">
24+
Description
25+
</td>
2426
</tr>
2527
{propDescriptors?.map((propDescriptor) => {
2628
return (
2729
<tr key={propDescriptor.name}>
2830
<td class="align-center py-3 pl-2 pr-2 sm:pl-0 md:align-baseline">
29-
<code class="border-qwikui-blue-500 bg-qwikui-blue-50 dark:bg-qwikui-purple-100 dark:border-qwikui-purple-500 mr-6 rounded-md rounded-md border-[1px] border-b-[2px] px-2 py-[2px] font-[400] text-slate-950">
31+
<code class="border-primary text-accent-foreground mr-6 rounded border border-b-2">
3032
{propDescriptor.name}
3133
</code>
3234
</td>
3335
<td class="py-3 align-baseline">
34-
<div class="prose prose-sm prose-docs-table">
36+
<div class="prose-docs-table">
3537
<p>{propDescriptor.description}</p>
3638
</div>
3739
</td>

apps/website/src/components/api-table/api-table.tsx

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -12,41 +12,39 @@ type APITableProps = {
1212
export const APITable = component$(({ propDescriptors }: APITableProps) => {
1313
return (
1414
<div class="overflow-auto">
15-
<table class="mb-6 w-full min-w-[540px] border-b border-slate-200 text-left dark:border-slate-800 sm:min-w-full">
16-
<tbody class="divide-y divide-slate-200 dark:divide-slate-800">
17-
<tr class="w-1/4 dark:text-white ">
18-
<th class="w-1/6 whitespace-nowrap py-2 pl-4 text-base font-[600] font-medium text-slate-700 dark:text-slate-300 sm:pl-0">
15+
<table class="mb-6 w-full min-w-[540px] border-b text-left sm:min-w-full">
16+
<tbody class="divide-y">
17+
<tr class="w-1/4">
18+
<th class="w-1/6 whitespace-nowrap py-2 pl-4 text-base font-semibold sm:pl-0">
1919
Prop
2020
</th>
21-
<th class="w-1/6 whitespace-nowrap py-2 text-base font-[600] text-slate-700 dark:text-slate-300">
22-
Type
23-
</th>
24-
<th class="w-2/3 whitespace-nowrap p-2 text-base font-[600] text-slate-700 dark:text-slate-300">
21+
<th class="w-1/6 whitespace-nowrap py-2 text-base font-semibold">Type</th>
22+
<th class="w-2/3 whitespace-nowrap p-2 text-base font-semibold">
2523
Description
2624
</th>
2725
</tr>
2826
{propDescriptors?.map((propDescriptor) => {
2927
return (
3028
<tr key={propDescriptor.name}>
3129
<td class="prose prose-sm py-3 pl-4 sm:pl-0 ">
32-
<code class="border-qwikui-blue-500 bg-qwikui-blue-50 dark:bg-qwikui-purple-100 dark:border-qwikui-purple-500 mr-6 rounded-md border-[1px] border-b-[2px] font-[400] text-slate-950">
30+
<code class="border-primary mr-6 rounded-md border border-b-[2px]">
3331
{propDescriptor.name}
3432
</code>
3533
</td>
3634
<td class="py-3">
3735
<span class="flex items-center">
38-
<code class="rounded-md border-[1px] border-b-2 border-slate-700 bg-slate-100 px-2 dark:border-slate-400 dark:bg-slate-700">
36+
<code class="rounded-md border border-b-2 px-2">
3937
{propDescriptor.type}
4038
</code>
4139
{propDescriptor.info && (
4240
<Popover placement="top">
4341
<PopoverContent>
44-
<div class="shadow-light-medium bg-qwikui-blue-50 dark:shadow-dark-high text-md border-qwikui-blue-500 dark:border-qwikui-purple-500 dark:bg-qwikui-purple-100 mb-2 max-w-xs rounded-lg border-[1px] border-b-2 px-3 py-2 font-[500] text-slate-950 sm:w-max">
42+
<div class="shadow-light-medium dark:shadow-dark-high bg-background text-md mb-2 max-w-xs rounded-lg border border-b-2 px-3 py-2 font-medium sm:w-max">
4543
{propDescriptor?.info}
4644
</div>
4745
</PopoverContent>
4846
<PopoverTrigger>
49-
<div class="mx-2 mt-2 rounded-md rounded-xl p-1 hover:bg-slate-500 hover:bg-opacity-50">
47+
<div class="mx-2 mt-2 rounded-xl p-1">
5048
<svg
5149
width="15"
5250
height="15"
@@ -63,7 +61,7 @@ export const APITable = component$(({ propDescriptors }: APITableProps) => {
6361
clip-rule="evenodd"
6462
></path>
6563
</svg>
66-
</div>{' '}
64+
</div>
6765
</PopoverTrigger>
6866
</Popover>
6967
)}

apps/website/src/components/code-copy/code-copy.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,10 @@ import { twMerge } from 'tailwind-merge';
77

88
export type CodeCopyProps = OmitSignalClass<QwikIntrinsicElements['button']> & {
99
code?: string;
10-
icon?: boolean;
1110
};
1211

1312
export const CodeCopy = component$(
14-
({ icon = false, code = '', class: outsideClass, ...restOfProps }: CodeCopyProps) => {
13+
({ code = '', class: outsideClass, ...restOfProps }: CodeCopyProps) => {
1514
const copied = useSignal(false);
1615

1716
return (
@@ -31,8 +30,7 @@ export const CodeCopy = component$(
3130
}, 4000);
3231
}}
3332
>
34-
{!icon && (!copied.value ? 'Copy' : 'Copied!')}
35-
{icon && (!copied.value ? <CopyIcon /> : <ClipboardCheck />)}
33+
{!copied.value ? <CopyIcon /> : <ClipboardCheck />}
3634
</Button>
3735
);
3836
},

apps/website/src/components/code-snippet/code-snippet.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const CodeSnippet = component$<CodeSnippetProps>(({ name }) => {
3434
});
3535

3636
return (
37-
<div class="shadow-3xl shadow-light-medium dark:shadow-dark-medium mx-[-24px] mb-6 rounded-xl border-2 border-slate-200 dark:border-slate-400 lg:mx-[-32px]">
37+
<div class="shadow-3xl shadow-light-medium dark:shadow-dark-medium -mx-6 mb-6 rounded-xl border lg:-mx-8">
3838
<Highlight code={codeSnippetSig.value || ''} />
3939
</div>
4040
);

apps/website/src/components/component-status-badge/component-status-badge.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,11 @@ export function getClassByStatus(status: ComponentStatus) {
1212
case ComponentStatus.Ready:
1313
return 'text-green-900 bg-green-300 tracking-wide';
1414
case ComponentStatus.Beta:
15-
return 'dark:text-slate-100 dark:bg-qwikui-purple-600 bg-qwikui-blue-600 text-white dark:border-qwikui-purple-600 border-[1px] border-qwikui-blue-700 tracking-wide shadow-dark-low dark:shadow-dark-low text-outline-beta';
15+
return 'border border-primary-foreground tracking-wide bg-primary text-primary-foreground';
1616
case ComponentStatus.Draft:
17-
return 'text-slate-200 bg-slate-700 dark:bg-slate-800 border-[1px] border-slate-400 shadow-dark-low tracking-wide dark:shadow-dark-low text-outline-draft';
17+
return 'border tracking-wide bg-muted text-foreground';
1818
case ComponentStatus.Planned:
19-
return 'text-white bg-slate-400 dark:bg-slate-600 border-[1px] border-slate-500 dark:border-slate-400 tracking-wide shadow-dark-low dark:shadow-dark-low text-outline-planned dark:text-outline-none';
19+
return 'text-white bg-slate-600 dark:bg-slate-500 border tracking-wide';
2020
default:
2121
return null;
2222
}
@@ -26,7 +26,7 @@ export const StatusBadge = component$<StatusBadgeProps>(({ status }) => {
2626
return (
2727
<Badge
2828
title={tooltipByStatus[status]}
29-
class={`rounded-lg p-3 text-lg font-medium leading-3 lg:px-2 lg:py-1 lg:text-xs
29+
class={`rounded-lg p-3 text-lg font-bold leading-3 shadow lg:px-2 lg:py-1 lg:text-xs
3030
${getClassByStatus(status)}`}
3131
>
3232
{status}

apps/website/src/components/footer/footer.tsx

Lines changed: 9 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,16 @@ import { DiscordIcon } from '../icons/discord';
44

55
export const Footer = component$(() => {
66
return (
7-
<footer class="border-t-[1px] border-slate-100 border-slate-300 bg-slate-50 dark:border-slate-800 dark:bg-slate-950">
7+
<footer class="border-t">
88
<div class="mx-auto max-w-7xl overflow-hidden px-4 py-12 sm:px-6 lg:px-8">
99
<nav class="-mx-5 -my-2 flex flex-wrap justify-center" aria-label="Footer">
1010
<div class="px-5 py-2">
11-
<a
12-
href="/about"
13-
class="text-base text-slate-800 hover:text-slate-900 dark:text-white dark:hover:text-slate-300"
14-
>
11+
<a href="/about" class="hover:text-muted-foreground">
1512
About
1613
</a>
1714
</div>
1815
<div class="px-5 py-2">
19-
<a
20-
href="/docs/headless/introduction"
21-
class="text-base text-slate-800 hover:text-slate-900 dark:text-white dark:hover:text-slate-300"
22-
>
16+
<a href="/docs/headless/introduction" class="hover:text-muted-foreground">
2317
Headless Kit
2418
</a>
2519
</div>
@@ -28,7 +22,7 @@ export const Footer = component$(() => {
2822
<a
2923
href="https://discord.gg/PVWUUejrez"
3024
target="_blank"
31-
class="text-base text-slate-800 hover:text-slate-900 dark:text-white dark:hover:text-slate-300"
25+
class="hover:text-muted-foreground"
3226
>
3327
Community
3428
</a>
@@ -38,7 +32,7 @@ export const Footer = component$(() => {
3832
<a
3933
href="https://www.w3.org/standards/webdesign/accessibility"
4034
target="_blank"
41-
class="text-base text-slate-800 hover:text-slate-900 dark:text-white dark:hover:text-slate-300"
35+
class="hover:text-muted-foreground"
4236
>
4337
Accessibility
4438
</a>
@@ -47,7 +41,7 @@ export const Footer = component$(() => {
4741
<a
4842
href="https://qwik.builder.io/docs"
4943
target="_blank"
50-
class="text-base text-slate-800 hover:text-slate-900 dark:text-white dark:hover:text-slate-300"
44+
class="hover:text-muted-foreground"
5145
>
5246
Qwik Documentation
5347
</a>
@@ -58,22 +52,20 @@ export const Footer = component$(() => {
5852
target="_blank"
5953
href="https://github.com/qwikifiers/qwik-ui"
6054
aria-label="Qwik-UI GitHub repository"
61-
class="text-slate-600 hover:text-slate-800 dark:text-slate-400 dark:hover:text-white"
55+
class="hover:text-accent-foreground text-muted-foreground"
6256
>
6357
<GitHubIcon />
6458
</a>
6559
<a
6660
target="_blank"
6761
href="https://discord.gg/PVWUUejrez"
6862
aria-label="Qwik-UI Discord server"
69-
class="text-slate-600 hover:text-slate-800 dark:text-slate-400 dark:hover:text-white"
63+
class="hover:text-accent-foreground text-muted-foreground"
7064
>
7165
<DiscordIcon />
7266
</a>
7367
</div>
74-
<p class="mt-8 text-center text-base text-slate-600 dark:text-slate-400">
75-
&copy; 2023 Qwik UI. All rights reserved.
76-
</p>
68+
<p class="mt-8 text-center">&copy; 2023 Qwik UI. All rights reserved.</p>
7769
</div>
7870
</footer>
7971
);

apps/website/src/components/header/header.tsx

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,14 @@ export default component$(
2727

2828
const isRouteActive = (href: string) => {
2929
const isLinkActive = location.url.pathname.startsWith(href);
30-
return `text-slate-600 dark:text-slate-400 hover:text-slate-950 focus:text-slate-950 dark:hover:text-white dark:focus:text-white
31-
transition-color ease-step duration-300 ${
32-
isLinkActive ? 'font-bold !text-slate-950 dark:!text-white' : ''
33-
}`;
30+
return `
31+
transition-color ease-step duration-300 ${isLinkActive ? 'font-bold' : ''}`;
3432
};
3533

3634
const isDocsActive = (baseHref: string) => {
3735
const isLinkActive = location.url.pathname.startsWith(baseHref);
38-
return `text-slate-600 dark:text-slate-400 hover:text-slate-950 focus:text-slate-950 dark:hover:text-white dark:focus:text-white
39-
transition-color ease-step duration-300 ${
40-
isLinkActive ? 'font-bold !text-slate-950 dark:!text-white' : ''
41-
}`;
36+
return `
37+
transition-color ease-step duration-300 ${isLinkActive ? 'font-bold' : ''}`;
4238
};
4339

4440
const kitSignal = useComputed$(() => {
@@ -60,15 +56,12 @@ export default component$(
6056
rootStore.mode = rootStore.mode === 'light' ? 'dark' : 'light';
6157
});
6258

63-
// we can add back the header animation if you'd like. Maybe something springy with motion?
6459
return (
6560
<header
6661
class={[
67-
`xs:gap-8 sticky top-0 z-20 flex h-20 w-full items-center gap-6 border-b-[1px] border-slate-200 bg-white p-4 dark:border-slate-800 dark:bg-slate-900 md:h-20`,
62+
`bg-background xs:gap-8 sticky top-0 z-20 flex h-20 w-full items-center gap-6 border-b-[1px] p-4 md:h-20`,
6863
`shadow-light-low dark:shadow-dark-medium`,
69-
rootStore.isSidebarOpened
70-
? 'bg-blue-200 brightness-75 dark:bg-indigo-900'
71-
: 'bg-[var(--color-bg)]',
64+
rootStore.isSidebarOpened ? '' : 'bg-[var(--color-bg)]',
7265
showBottomBorder ? `shadow-light-low dark:shadow-dark-medium` : ``,
7366
]}
7467
>

apps/website/src/components/highlight/highlight.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,15 +58,15 @@ export const Highlight = component$(
5858
<div class="code-example relative max-h-[31.25rem] rounded-b-xl">
5959
<CodeCopy
6060
class={[
61-
'copy-btn-bg-dark absolute right-4 top-4 bg-slate-200 text-white hover:bg-slate-600 hover:text-white',
61+
'absolute right-4 top-4 text-white hover:bg-slate-800 hover:text-white',
6262
copyCodeClass,
6363
]}
6464
code={code}
6565
/>
6666
<div
6767
{...props}
6868
class={[
69-
'tab-size max-h-[31.25rem] max-w-full overflow-auto rounded-xl bg-slate-800 p-6 text-sm dark:bg-slate-900',
69+
'tab-size max-h-[31.25rem] max-w-full overflow-auto rounded-xl bg-gradient-to-b from-slate-900 to-slate-800 p-6 text-sm',
7070
props.class,
7171
]}
7272
>

apps/website/src/components/icons/MoonIcon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const MoonIcon = () => (
33
viewBox="0 0 20 20"
44
fill="none"
55
aria-hidden="true"
6-
class="h-10 w-10 rounded-xl stroke-white p-1 hover:bg-slate-600"
6+
class="hover:bg-accent h-10 w-10 rounded-xl stroke-white p-1"
77
>
88
<path d="M15.224 11.724a5.5 5.5 0 0 1-6.949-6.949 5.5 5.5 0 1 0 6.949 6.949Z" />
99
</svg>

apps/website/src/components/icons/SunIcon.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export const SunIcon = () => (
33
viewBox="0 0 20 20"
44
fill="none"
55
aria-hidden="true"
6-
class="h-10 w-10 rounded-xl stroke-black p-1 hover:bg-gray-100"
6+
class="hover:bg-accent h-10 w-10 rounded-xl stroke-black p-1"
77
>
88
<path d="M12.5 10a2.5 2.5 0 1 1-5 0 2.5 2.5 0 0 1 5 0Z" />
99
<path

0 commit comments

Comments
 (0)