balibabu
commited on
Commit
·
9ba804f
1
Parent(s):
12b6347
feat: Add background colors such as inverse-strong #3221 (#3346)
Browse files### What problem does this PR solve?
feat: Add background colors such as inverse-strong #3221
### Type of change
- [x] New Feature (non-breaking change which adds functionality)
- web/src/components/ui/segmented .tsx +14 -4
- web/src/pages/home/header.tsx +9 -2
- web/tailwind.config.js +13 -5
- web/tailwind.css +10 -1
web/src/components/ui/segmented .tsx
CHANGED
@@ -25,9 +25,19 @@ export interface SegmentedProps
|
|
25 |
motionName?: string;
|
26 |
}
|
27 |
|
28 |
-
export function Segmented({
|
|
|
|
|
|
|
|
|
|
|
29 |
return (
|
30 |
-
<div
|
|
|
|
|
|
|
|
|
|
|
31 |
{options.map((option) => {
|
32 |
const isObject = typeof option === 'object';
|
33 |
const actualValue = isObject ? option.value : option;
|
@@ -36,9 +46,9 @@ export function Segmented({ options, value, onChange }: SegmentedProps) {
|
|
36 |
<div
|
37 |
key={actualValue}
|
38 |
className={cn(
|
39 |
-
'inline-flex items-center px-
|
40 |
|
41 |
-
{ 'bg-
|
42 |
)}
|
43 |
onClick={() => onChange?.(actualValue)}
|
44 |
>
|
|
|
25 |
motionName?: string;
|
26 |
}
|
27 |
|
28 |
+
export function Segmented({
|
29 |
+
options,
|
30 |
+
value,
|
31 |
+
onChange,
|
32 |
+
className,
|
33 |
+
}: SegmentedProps) {
|
34 |
return (
|
35 |
+
<div
|
36 |
+
className={cn(
|
37 |
+
'flex items-center rounded-sm p-1 gap-2 bg-zinc-200',
|
38 |
+
className,
|
39 |
+
)}
|
40 |
+
>
|
41 |
{options.map((option) => {
|
42 |
const isObject = typeof option === 'object';
|
43 |
const actualValue = isObject ? option.value : option;
|
|
|
46 |
<div
|
47 |
key={actualValue}
|
48 |
className={cn(
|
49 |
+
'inline-flex items-center px-3 py-2 text-sm font-medium rounded-sm cursor-pointer',
|
50 |
|
51 |
+
{ 'bg-backgroundCoreStandard': value === actualValue },
|
52 |
)}
|
53 |
onClick={() => onChange?.(actualValue)}
|
54 |
>
|
web/src/pages/home/header.tsx
CHANGED
@@ -5,6 +5,7 @@ import { Segmented, SegmentedValue } from '@/components/ui/segmented ';
|
|
5 |
import { useTranslate } from '@/hooks/common-hooks';
|
6 |
import { useNavigateWithFromState } from '@/hooks/route-hook';
|
7 |
import {
|
|
|
8 |
Cpu,
|
9 |
Github,
|
10 |
Library,
|
@@ -63,7 +64,7 @@ export function HomeHeader() {
|
|
63 |
}, [navigate]);
|
64 |
|
65 |
return (
|
66 |
-
<section className="px-[60px] py-[12px] flex justify-between">
|
67 |
<div className="flex items-center gap-4">
|
68 |
<img
|
69 |
src={'/logo.svg'}
|
@@ -82,11 +83,17 @@ export function HomeHeader() {
|
|
82 |
options={options}
|
83 |
value={currentPath}
|
84 |
onChange={handleChange}
|
|
|
85 |
></Segmented>
|
86 |
</div>
|
87 |
<div className="flex items-center gap-4">
|
88 |
-
<Button variant="secondary">V 0.13.0</Button>
|
89 |
<Container>
|
|
|
|
|
|
|
|
|
|
|
|
|
90 |
<Avatar className="w-[30px] h-[30px]">
|
91 |
<AvatarImage src="https://github.com/shadcn.png" />
|
92 |
<AvatarFallback>CN</AvatarFallback>
|
|
|
5 |
import { useTranslate } from '@/hooks/common-hooks';
|
6 |
import { useNavigateWithFromState } from '@/hooks/route-hook';
|
7 |
import {
|
8 |
+
ChevronDown,
|
9 |
Cpu,
|
10 |
Github,
|
11 |
Library,
|
|
|
64 |
}, [navigate]);
|
65 |
|
66 |
return (
|
67 |
+
<section className="px-[60px] py-[12px] flex justify-between items-center">
|
68 |
<div className="flex items-center gap-4">
|
69 |
<img
|
70 |
src={'/logo.svg'}
|
|
|
83 |
options={options}
|
84 |
value={currentPath}
|
85 |
onChange={handleChange}
|
86 |
+
className="bg-backgroundInverseStandard text-backgroundInverseStandard-foreground"
|
87 |
></Segmented>
|
88 |
</div>
|
89 |
<div className="flex items-center gap-4">
|
|
|
90 |
<Container>
|
91 |
+
V 0.13.0
|
92 |
+
<Button variant="secondary" className="size-8">
|
93 |
+
<ChevronDown />
|
94 |
+
</Button>
|
95 |
+
</Container>
|
96 |
+
<Container className="px-3 py-2">
|
97 |
<Avatar className="w-[30px] h-[30px]">
|
98 |
<AvatarImage src="https://github.com/shadcn.png" />
|
99 |
<AvatarFallback>CN</AvatarFallback>
|
web/tailwind.config.js
CHANGED
@@ -22,15 +22,15 @@ module.exports = {
|
|
22 |
border: 'hsl(var(--border))',
|
23 |
input: 'hsl(var(--input))',
|
24 |
ring: 'hsl(var(--ring))',
|
25 |
-
background: '
|
26 |
foreground: 'hsl(var(--foreground))',
|
27 |
primary: {
|
28 |
DEFAULT: 'hsl(var(--primary))',
|
29 |
foreground: 'hsl(var(--primary-foreground))',
|
30 |
},
|
31 |
secondary: {
|
32 |
-
DEFAULT: '
|
33 |
-
foreground: '
|
34 |
},
|
35 |
destructive: {
|
36 |
DEFAULT: 'hsl(var(--destructive))',
|
@@ -49,13 +49,21 @@ module.exports = {
|
|
49 |
foreground: 'hsl(var(--popover-foreground))',
|
50 |
},
|
51 |
card: {
|
52 |
-
DEFAULT: '
|
53 |
-
foreground: '
|
54 |
},
|
55 |
backgroundInverseStandard: {
|
56 |
DEFAULT: 'var(--background-inverse-standard)',
|
57 |
foreground: 'var(--background-inverse-standard-foreground)',
|
58 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
},
|
60 |
borderRadius: {
|
61 |
lg: `var(--radius)`,
|
|
|
22 |
border: 'hsl(var(--border))',
|
23 |
input: 'hsl(var(--input))',
|
24 |
ring: 'hsl(var(--ring))',
|
25 |
+
background: 'var(--background)',
|
26 |
foreground: 'hsl(var(--foreground))',
|
27 |
primary: {
|
28 |
DEFAULT: 'hsl(var(--primary))',
|
29 |
foreground: 'hsl(var(--primary-foreground))',
|
30 |
},
|
31 |
secondary: {
|
32 |
+
DEFAULT: 'var(--background-inverse-strong)',
|
33 |
+
foreground: 'var(--background-inverse-strong-foreground)',
|
34 |
},
|
35 |
destructive: {
|
36 |
DEFAULT: 'hsl(var(--destructive))',
|
|
|
49 |
foreground: 'hsl(var(--popover-foreground))',
|
50 |
},
|
51 |
card: {
|
52 |
+
DEFAULT: 'var(--background-inverse-standard)',
|
53 |
+
foreground: 'var(--background-inverse-standard-foreground)',
|
54 |
},
|
55 |
backgroundInverseStandard: {
|
56 |
DEFAULT: 'var(--background-inverse-standard)',
|
57 |
foreground: 'var(--background-inverse-standard-foreground)',
|
58 |
},
|
59 |
+
backgroundInverseWeak: {
|
60 |
+
DEFAULT: 'var(--background-inverse-weak)',
|
61 |
+
foreground: 'var(--background-inverse-weak-foreground)',
|
62 |
+
},
|
63 |
+
backgroundCoreStandard: {
|
64 |
+
DEFAULT: 'var(--background-core-standard)',
|
65 |
+
foreground: 'var(--background-core-standard-foreground)',
|
66 |
+
},
|
67 |
},
|
68 |
borderRadius: {
|
69 |
lg: `var(--radius)`,
|
web/tailwind.css
CHANGED
@@ -40,7 +40,7 @@
|
|
40 |
}
|
41 |
|
42 |
.dark {
|
43 |
-
--background:
|
44 |
--foreground: 213 31% 91%;
|
45 |
|
46 |
--muted: 223 47% 11%;
|
@@ -73,6 +73,15 @@
|
|
73 |
|
74 |
--background-inverse-standard: rgba(230, 227, 246, 0.15);
|
75 |
--background-inverse-standard-foreground: rgba(255, 255, 255, 1);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
76 |
}
|
77 |
}
|
78 |
|
|
|
40 |
}
|
41 |
|
42 |
.dark {
|
43 |
+
--background: rgba(11, 10, 18, 1);
|
44 |
--foreground: 213 31% 91%;
|
45 |
|
46 |
--muted: 223 47% 11%;
|
|
|
73 |
|
74 |
--background-inverse-standard: rgba(230, 227, 246, 0.15);
|
75 |
--background-inverse-standard-foreground: rgba(255, 255, 255, 1);
|
76 |
+
|
77 |
+
--background-inverse-weak: rgba(184, 181, 203, 0.15);
|
78 |
+
--background-inverse-weak-foreground: rgba(255, 255, 255, 1);
|
79 |
+
|
80 |
+
--background-core-standard: rgba(137, 126, 255, 1);
|
81 |
+
--background-core-standard-foreground: rgba(255, 255, 255, 1);
|
82 |
+
|
83 |
+
--background-inverse-strong: rgba(255, 255, 255, 0.15);
|
84 |
+
--background-inverse-strong-foreground: rgba(255, 255, 255, 1);
|
85 |
}
|
86 |
}
|
87 |
|