### 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)tags/v0.14.0
| motionName?: string; | motionName?: string; | ||||
| } | } | ||||
| export function Segmented({ options, value, onChange }: SegmentedProps) { | |||||
| export function Segmented({ | |||||
| options, | |||||
| value, | |||||
| onChange, | |||||
| className, | |||||
| }: SegmentedProps) { | |||||
| return ( | return ( | ||||
| <div className="flex items-center rounded-sm p-1 gap-2 bg-zinc-200"> | |||||
| <div | |||||
| className={cn( | |||||
| 'flex items-center rounded-sm p-1 gap-2 bg-zinc-200', | |||||
| className, | |||||
| )} | |||||
| > | |||||
| {options.map((option) => { | {options.map((option) => { | ||||
| const isObject = typeof option === 'object'; | const isObject = typeof option === 'object'; | ||||
| const actualValue = isObject ? option.value : option; | const actualValue = isObject ? option.value : option; | ||||
| <div | <div | ||||
| key={actualValue} | key={actualValue} | ||||
| className={cn( | className={cn( | ||||
| 'inline-flex items-center px-2 py-1 text-sm font-medium rounded-sm cursor-pointer', | |||||
| 'inline-flex items-center px-3 py-2 text-sm font-medium rounded-sm cursor-pointer', | |||||
| { 'bg-indigo-400': value === actualValue }, | |||||
| { 'bg-backgroundCoreStandard': value === actualValue }, | |||||
| )} | )} | ||||
| onClick={() => onChange?.(actualValue)} | onClick={() => onChange?.(actualValue)} | ||||
| > | > |
| import { useTranslate } from '@/hooks/common-hooks'; | import { useTranslate } from '@/hooks/common-hooks'; | ||||
| import { useNavigateWithFromState } from '@/hooks/route-hook'; | import { useNavigateWithFromState } from '@/hooks/route-hook'; | ||||
| import { | import { | ||||
| ChevronDown, | |||||
| Cpu, | Cpu, | ||||
| Github, | Github, | ||||
| Library, | Library, | ||||
| }, [navigate]); | }, [navigate]); | ||||
| return ( | return ( | ||||
| <section className="px-[60px] py-[12px] flex justify-between"> | |||||
| <section className="px-[60px] py-[12px] flex justify-between items-center"> | |||||
| <div className="flex items-center gap-4"> | <div className="flex items-center gap-4"> | ||||
| <img | <img | ||||
| src={'/logo.svg'} | src={'/logo.svg'} | ||||
| options={options} | options={options} | ||||
| value={currentPath} | value={currentPath} | ||||
| onChange={handleChange} | onChange={handleChange} | ||||
| className="bg-backgroundInverseStandard text-backgroundInverseStandard-foreground" | |||||
| ></Segmented> | ></Segmented> | ||||
| </div> | </div> | ||||
| <div className="flex items-center gap-4"> | <div className="flex items-center gap-4"> | ||||
| <Button variant="secondary">V 0.13.0</Button> | |||||
| <Container> | <Container> | ||||
| V 0.13.0 | |||||
| <Button variant="secondary" className="size-8"> | |||||
| <ChevronDown /> | |||||
| </Button> | |||||
| </Container> | |||||
| <Container className="px-3 py-2"> | |||||
| <Avatar className="w-[30px] h-[30px]"> | <Avatar className="w-[30px] h-[30px]"> | ||||
| <AvatarImage src="https://github.com/shadcn.png" /> | <AvatarImage src="https://github.com/shadcn.png" /> | ||||
| <AvatarFallback>CN</AvatarFallback> | <AvatarFallback>CN</AvatarFallback> |
| border: 'hsl(var(--border))', | border: 'hsl(var(--border))', | ||||
| input: 'hsl(var(--input))', | input: 'hsl(var(--input))', | ||||
| ring: 'hsl(var(--ring))', | ring: 'hsl(var(--ring))', | ||||
| background: 'hsl(var(--background))', | |||||
| background: 'var(--background)', | |||||
| foreground: 'hsl(var(--foreground))', | foreground: 'hsl(var(--foreground))', | ||||
| primary: { | primary: { | ||||
| DEFAULT: 'hsl(var(--primary))', | DEFAULT: 'hsl(var(--primary))', | ||||
| foreground: 'hsl(var(--primary-foreground))', | foreground: 'hsl(var(--primary-foreground))', | ||||
| }, | }, | ||||
| secondary: { | secondary: { | ||||
| DEFAULT: 'hsl(var(--secondary))', | |||||
| foreground: 'hsl(var(--secondary-foreground))', | |||||
| DEFAULT: 'var(--background-inverse-strong)', | |||||
| foreground: 'var(--background-inverse-strong-foreground)', | |||||
| }, | }, | ||||
| destructive: { | destructive: { | ||||
| DEFAULT: 'hsl(var(--destructive))', | DEFAULT: 'hsl(var(--destructive))', | ||||
| foreground: 'hsl(var(--popover-foreground))', | foreground: 'hsl(var(--popover-foreground))', | ||||
| }, | }, | ||||
| card: { | card: { | ||||
| DEFAULT: 'hsl(var(--card))', | |||||
| foreground: 'hsl(var(--card-foreground))', | |||||
| DEFAULT: 'var(--background-inverse-standard)', | |||||
| foreground: 'var(--background-inverse-standard-foreground)', | |||||
| }, | }, | ||||
| backgroundInverseStandard: { | backgroundInverseStandard: { | ||||
| DEFAULT: 'var(--background-inverse-standard)', | DEFAULT: 'var(--background-inverse-standard)', | ||||
| foreground: 'var(--background-inverse-standard-foreground)', | foreground: 'var(--background-inverse-standard-foreground)', | ||||
| }, | }, | ||||
| backgroundInverseWeak: { | |||||
| DEFAULT: 'var(--background-inverse-weak)', | |||||
| foreground: 'var(--background-inverse-weak-foreground)', | |||||
| }, | |||||
| backgroundCoreStandard: { | |||||
| DEFAULT: 'var(--background-core-standard)', | |||||
| foreground: 'var(--background-core-standard-foreground)', | |||||
| }, | |||||
| }, | }, | ||||
| borderRadius: { | borderRadius: { | ||||
| lg: `var(--radius)`, | lg: `var(--radius)`, |
| } | } | ||||
| .dark { | .dark { | ||||
| --background: 224 71% 4%; | |||||
| --background: rgba(11, 10, 18, 1); | |||||
| --foreground: 213 31% 91%; | --foreground: 213 31% 91%; | ||||
| --muted: 223 47% 11%; | --muted: 223 47% 11%; | ||||
| --background-inverse-standard: rgba(230, 227, 246, 0.15); | --background-inverse-standard: rgba(230, 227, 246, 0.15); | ||||
| --background-inverse-standard-foreground: rgba(255, 255, 255, 1); | --background-inverse-standard-foreground: rgba(255, 255, 255, 1); | ||||
| --background-inverse-weak: rgba(184, 181, 203, 0.15); | |||||
| --background-inverse-weak-foreground: rgba(255, 255, 255, 1); | |||||
| --background-core-standard: rgba(137, 126, 255, 1); | |||||
| --background-core-standard-foreground: rgba(255, 255, 255, 1); | |||||
| --background-inverse-strong: rgba(255, 255, 255, 0.15); | |||||
| --background-inverse-strong-foreground: rgba(255, 255, 255, 1); | |||||
| } | } | ||||
| } | } | ||||