Skip to content

Commit 8e240f1

Browse files
Light mode polish 2 (#3162)
- Simplify message and toast with themes, fix incorrect error hover token - Bumps text underline opacity - Bumps ghost button text opacity - Tweak boolean cell colour on light mode - Brighter/more saturated light mode text colours
1 parent f9286b2 commit 8e240f1

7 files changed

Lines changed: 40 additions & 89 deletions

File tree

app/table/cells/BooleanCell.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,13 @@ import { Disabled12Icon, Success12Icon } from '@oxide/design-system/icons/react'
1212

1313
export const BooleanCell = ({ isTrue }: { isTrue: boolean }) =>
1414
isTrue ? (
15-
<Success12Icon className="text-accent mr-1" aria-label="true" />
15+
<Success12Icon
16+
className="text-accent light:text-accent-secondary mr-1"
17+
aria-label="true"
18+
/>
1619
) : (
17-
<Disabled12Icon className="text-notice mr-1" aria-label="false" />
20+
<Disabled12Icon
21+
className="text-notice light:text-notice-secondary mr-1"
22+
aria-label="false"
23+
/>
1824
)

app/ui/lib/Message.tsx

Lines changed: 12 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -37,32 +37,11 @@ const defaultIcon: Record<Variant, ReactElement> = {
3737
info: <Error12Icon className="rotate-180" />,
3838
}
3939

40-
const color: Record<Variant, string> = {
41-
success: 'bg-accent',
42-
error: 'bg-error',
43-
notice: 'bg-notice',
44-
info: 'bg-info',
45-
}
46-
47-
const textColor: Record<Variant, string> = {
48-
success: 'text-accent',
49-
error: 'text-error',
50-
notice: 'text-notice',
51-
info: 'text-info',
52-
}
53-
54-
const secondaryTextColor: Record<Variant, string> = {
55-
success: 'text-accent-secondary',
56-
error: 'text-error-secondary',
57-
notice: 'text-notice-secondary',
58-
info: 'text-info-secondary',
59-
}
60-
61-
const linkColor: Record<Variant, string> = {
62-
success: 'text-accent-secondary hover:text-accent',
63-
error: 'text-error-secondary hover:text-error',
64-
notice: 'text-notice-secondary hover:text-notice',
65-
info: 'text-info-secondary hover:text-info',
40+
const themeClass: Record<Variant, string> = {
41+
success: '',
42+
error: 'red-theme',
43+
notice: 'yellow-theme',
44+
info: 'blue-theme',
6645
}
6746

6847
export const Message = ({
@@ -77,40 +56,27 @@ export const Message = ({
7756
return (
7857
<div
7958
className={cn(
80-
'relative flex items-start gap-2 overflow-hidden rounded-md p-3 pr-5 ring ring-current/10',
81-
color[variant],
82-
textColor[variant],
59+
'relative flex items-start gap-2 overflow-hidden rounded-md p-3 pr-5 ring ring-inset ring-current/10',
60+
'bg-accent text-accent',
61+
themeClass[variant],
8362
className
8463
)}
8564
>
8665
{showIcon && (
87-
<div
88-
className={cn(
89-
'mt-0.5 flex [&>svg]:h-3 [&>svg]:w-3',
90-
`[&>svg]:${textColor[variant]}`
91-
)}
92-
>
66+
<div className="text-accent mt-0.5 flex [&>svg]:h-3 [&>svg]:w-3">
9367
{defaultIcon[variant]}
9468
</div>
9569
)}
9670
<div className="flex-1">
9771
{title && <div className="text-sans-semi-md">{title}</div>}
98-
<div
99-
className={cn(
100-
// group gives HL the right color
101-
'text-sans-md [&>a]:tint-underline group',
102-
secondaryTextColor[variant]
103-
)}
104-
>
72+
{/* group gives HL the right color */}
73+
<div className="text-sans-md text-accent-secondary [&>a]:tint-underline group">
10574
{content}
10675
</div>
10776

10877
{cta && (
10978
<Link
110-
className={cn(
111-
'text-sans-md mt-1 flex items-center underline',
112-
linkColor[variant]
113-
)}
79+
className="text-sans-md text-accent-secondary hover:text-accent mt-1 flex items-center underline"
11480
to={cta.link}
11581
>
11682
{cta.text}

app/ui/lib/Toast.tsx

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,14 @@ import cn from 'classnames'
1010
import { useEffect, type ReactElement, type ReactNode } from 'react'
1111
import { Link, type To } from 'react-router'
1212

13-
import {
14-
Close12Icon,
15-
Error12Icon,
16-
Success12Icon,
17-
Warning12Icon,
18-
} from '@oxide/design-system/icons/react'
13+
import { Close12Icon, Error12Icon, Success12Icon } from '@oxide/design-system/icons/react'
1914

2015
import { extractText } from '~/util/str'
2116

2217
import { TimeoutIndicator } from './TimeoutIndicator'
2318
import { Truncate } from './Truncate'
2419

25-
type Variant = 'success' | 'error' | 'info'
20+
type Variant = 'success' | 'error'
2621

2722
export interface ToastProps {
2823
title?: string
@@ -39,31 +34,16 @@ export interface ToastProps {
3934
const icon: Record<Variant, ReactElement> = {
4035
success: <Success12Icon />,
4136
error: <Error12Icon />,
42-
info: <Warning12Icon />,
4337
}
4438

4539
const defaultTitle: Record<Variant, string> = {
4640
success: 'Success',
4741
error: 'Error',
48-
info: 'Note',
4942
}
5043

51-
const color: Record<Variant, string> = {
52-
success: 'bg-accent',
53-
error: 'bg-error-secondary',
54-
info: 'bg-notice-secondary',
55-
}
56-
57-
const textColor: Record<Variant, string> = {
58-
success: 'text-accent *:text-accent',
59-
error: 'text-error *:text-error',
60-
info: 'text-notice *:text-notice',
61-
}
62-
63-
const secondaryTextColor: Record<Variant, string> = {
64-
success: 'text-accent-secondary',
65-
error: 'text-error-secondary',
66-
info: 'text-notice-secondary',
44+
const themeClass: Record<Variant, string> = {
45+
success: '',
46+
error: 'red-theme',
6747
}
6848

6949
export const Toast = ({
@@ -85,8 +65,8 @@ export const Toast = ({
8565
<div
8666
className={cn(
8767
'shadow-toast relative flex w-96 items-start overflow-hidden rounded-lg border border-current/10 p-4',
88-
color[variant],
89-
textColor[variant]
68+
'bg-accent text-accent *:text-accent',
69+
themeClass[variant]
9070
)}
9171
>
9272
<div className="mt-[2px] flex [&>svg]:h-3 [&>svg]:w-3">{icon[variant]}</div>
@@ -95,9 +75,7 @@ export const Toast = ({
9575
<div className="text-sans-semi-md">{title || defaultTitle[variant]}</div>
9676
)}
9777
{/* 'group' is necessary for HL color trick to work. see HL.tsx */}
98-
<div className={cn('text-sans-md group', secondaryTextColor[variant])}>
99-
{content}
100-
</div>
78+
<div className="text-sans-md group text-accent-secondary">{content}</div>
10179

10280
{cta && (
10381
<Link
@@ -112,10 +90,7 @@ export const Toast = ({
11290
<button
11391
type="button"
11492
aria-label="Dismiss notification"
115-
className={cn(
116-
'hover:bg-accent-hover -m-2 flex items-center rounded-md border-transparent! p-2',
117-
textColor[variant]
118-
)}
93+
className="hover:bg-accent-hover text-accent *:text-accent -m-2 flex items-center rounded-md border-transparent! p-2"
11994
onClick={onClose}
12095
>
12196
<Close12Icon />

app/ui/styles/components/button.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
}
3939

4040
&.btn-ghost {
41-
@apply text-secondary hover:bg-hover disabled:text-default/40 disabled:bg-transparent;
41+
@apply text-secondary hover:bg-hover disabled:text-default/50 disabled:bg-transparent;
4242
}
4343
&.btn-ghost:after {
4444
@apply border-current/20;

app/ui/styles/index.css

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@
3030
@import '@oxide/design-system/styles/preflight.css' layer(base);
3131
@import 'simplebar-react/dist/simplebar.min.css' layer(components);
3232

33+
@import '@oxide/design-system/styles/red.css';
34+
@import '@oxide/design-system/styles/yellow.css';
35+
@import '@oxide/design-system/styles/blue.css';
36+
3337
@import './fonts.css' layer(base);
3438
@import './vars.css' layer(base);
3539
@import './components/button.css' layer(components);
@@ -113,7 +117,7 @@
113117

114118
@utility tint-underline {
115119
text-decoration: underline;
116-
text-decoration-color: color-mix(in srgb, currentColor 50%, transparent);
120+
text-decoration-color: color-mix(in srgb, currentColor 60%, transparent);
117121

118122
&:hover {
119123
text-decoration-color: color-mix(in srgb, currentColor 80%, transparent);

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"@base-ui/react": "^1.1.0",
3838
"@floating-ui/react": "^0.26.23",
3939
"@headlessui/react": "^2.2.9",
40-
"@oxide/design-system": "~6.0.1",
40+
"@oxide/design-system": "^6.0.4",
4141
"@react-aria/live-announcer": "^3.3.4",
4242
"@tailwindcss/container-queries": "^0.1.1",
4343
"@tailwindcss/vite": "^4.1.17",

0 commit comments

Comments
 (0)