Files
Jonathan Summers-MuirandFrancesco Sansalvadore 6d760a1a99 Feat/deep dark (#27026)
* chore: move to deeper dark

* tidy up boxes on www

* update deep-dark colors

* fix homepage product cards

* toned down pricing page a little

* update

* lots of color changes

* Update grid.scss

* Update EntityListItem.tsx

* Update EntityListItem.tsx

* fix partners page icon

* fix partners page colors

* update theme

* Update global.css

* combined dark theme so classic-dark does not break on other sites

* Update package-lock.json

* updated color tokens pipeline to support combined dark theme

* smol updates

* Update FeaturedThumb.tsx

* Update BlogFilters.tsx

* Update BlogListItem.tsx

* Update BlogListItem.tsx

* Update UserSettingsDropdown.tsx

* Update NavigationBar.tsx

---------

Co-authored-by: Francesco Sansalvadore <f.sansalvadore@gmail.com>
2024-07-30 21:34:28 +08:00

72 lines
2.0 KiB
TypeScript

import { Check, Minus } from 'lucide-react'
import { cn } from 'ui'
export interface RoleImpersonationRadioProps<T extends string> {
label?: string
value: T
isSelected: boolean | 'partially'
onSelectedChange: (value: T) => void
icon?: React.ReactNode
}
function RoleImpersonationRadio<T extends string>({
label,
value,
isSelected,
onSelectedChange,
icon,
}: RoleImpersonationRadioProps<T>) {
return (
<label
className={cn(
'border border-default rounded-md bg-surface-200 hover:bg-overlay-hover hover:border-control px-4 py-3 w-44 cursor-pointer transition-colors',
isSelected && 'border-foreground-muted hover:border-foreground-muted bg-surface-300'
)}
tabIndex={0}
onKeyDown={(e) => {
if (e.key === 'Enter' || e.key === ' ') {
onSelectedChange(value)
}
}}
htmlFor={`role-${value}`}
>
<div className="flex justify-between items-center mb-2">
{icon && <div>{icon}</div>}
{isSelected && (
<div className="flex items-center justify-center p-0.5 bg-foreground text-background rounded-full">
{typeof isSelected === 'boolean' && (
<Check size={12} strokeWidth="4" className="text-background" />
)}
{isSelected === 'partially' && (
<Minus size={12} strokeWidth="4" className="text-background" />
)}
</div>
)}
</div>
<input
id={`role-${value}`}
type="radio"
name="role"
value={value}
checked={Boolean(isSelected)}
onChange={(e) => {
onSelectedChange(e.target.value as T)
}}
className="invisible h-0 w-0 border-0"
/>
<span
className={cn(
'text-sm text-foreground-light whitespace-nowrap select-none transition-colors',
isSelected && 'text-foreground'
)}
>
{label ?? value} role
</span>
</label>
)
}
export default RoleImpersonationRadio