Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/components/Select.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { ReactNode } from 'react'
import { Badge } from '~/components/ds/ui'
import { CaretUpDownIcon } from '@phosphor-icons/react/CaretUpDown'
import { CheckIcon } from '@phosphor-icons/react/Check'
import { twMerge } from 'tailwind-merge'
Expand All @@ -13,6 +14,7 @@ export type SelectOption = {
label: string
value: string
logo?: string
badge?: string
}

export type SelectProps<T extends SelectOption> = {
Expand Down Expand Up @@ -63,6 +65,9 @@ export function Select<T extends SelectOption>({
</span>
) : null}
<span className="truncate font-medium">{selectedOption.label}</span>
{selectedOption.badge ? (
<Badge>{selectedOption.badge}</Badge>
) : null}
<span className="pointer-events-none absolute inset-y-0 right-0 flex items-center pr-2">
<CaretUpDownIcon
className="h-4 w-4 opacity-40"
Expand Down Expand Up @@ -92,6 +97,7 @@ export function Select<T extends SelectOption>({
/>
) : null}
<span className="truncate">{option.label}</span>
{option.badge ? <Badge>{option.badge}</Badge> : null}
{selected === option.value ? (
<CheckIcon
className="h-4 w-4 absolute right-2 text-gray-800 dark:text-gray-400"
Expand Down
2 changes: 1 addition & 1 deletion src/components/VersionSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function useVersionConfig({
const available = versions.map(
(version): SelectOption =>
version === latestVersion
? { label: `${version} - Latest`, value: 'latest' }
? { label: version, value: 'latest', badge: 'Latest' }
: { label: version, value: version },
)

Expand Down
Loading