Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: introduce new select field based on shadcn implementation with custom interfaces #134

Merged
merged 3 commits into from
Oct 5, 2024
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
2 changes: 1 addition & 1 deletion packages/design-system/.ladle/head.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
--border: 214.3 31.8% 91.4%;
--input: 214.3 31.8% 91.4%;
--ring: 222.2 84% 4.9%;
--radius: 0.3rem;
--radius: 0.5rem;
--chart-1: 12 76% 61%;
--chart-2: 173 58% 39%;
--chart-3: 197 37% 24%;
Expand Down
79 changes: 2 additions & 77 deletions packages/design-system/src/Select.stories.tsx
Original file line number Diff line number Diff line change
@@ -1,69 +1,6 @@
import { useState } from 'react'
import Select from './Select'

export const fruitsValues = [
{ value: 'apple', label: 'Apple' },
{ value: 'banana', label: 'Banana' },
{ value: 'pear', label: 'Pear' },
{ value: 'watermelon', label: 'Watermelon' },
{ value: 'peach', label: 'Peach' },
{ value: 'mango', label: 'Mango' },
]
export const vegetablesValues = [
{ value: 'carrot', label: 'Carrot' },
{ value: 'cucumber', label: 'Cucumber' },
{ value: 'onion', label: 'Onion' },
{ value: 'potato', label: 'Potato' },
{ value: 'tomato', label: 'Tomato' },
{ value: 'broccoli', label: 'Broccoli' },
]
export const transportValues = [
{ value: 'car', label: 'Car' },
{ value: 'bike', label: 'Bike' },
{ value: 'train', label: 'Train' },
{ value: 'plane', label: 'Plane' },
{ value: 'boat', label: 'Boat' },
{ value: 'bus', label: 'Bus' },
]
export const programmingValues = [
{ value: 'javascript', label: 'JavaScript' },
{ value: 'typescript', label: 'TypeScript' },
{ value: 'python', label: 'Python' },
{ value: 'ruby', label: 'Ruby' },
{ value: 'java', label: 'Java' },
{ value: 'csharp', label: 'C#' },
]

export const programmingValuesDisabled = [
{ value: 'javascript', label: 'JavaScript (disabled)', disabled: true },
{ value: 'typescript', label: 'TypeScript' },
{ value: 'python', label: 'Python (disabled)', disabled: true },
{ value: 'ruby', label: 'Ruby' },
{ value: 'java', label: 'Java (disabled)' },
{ value: 'csharp', label: 'C#' },
]

export const groupValues = [
{ items: fruitsValues },
{ items: vegetablesValues, showSeparator: true },
{ items: transportValues, showSeparator: true, label: 'Transport' },
{
items: programmingValues,
showSeparator: true,
label: 'Programming Languages',
},
]

export const groupValuesDisabled = [
{ items: fruitsValues },
{ items: vegetablesValues, showSeparator: true },
{ items: transportValues, showSeparator: true, label: 'Transport' },
{
items: programmingValuesDisabled,
showSeparator: true,
label: 'Programming Languages',
},
]
import { fruitsValues, groupValues } from './values'

export const Default = () => {
return (
Expand Down Expand Up @@ -212,9 +149,8 @@ export const Styled = () => {
className={{
root: 'h-full rounded-none border-none',
content: 'bg-green-200',
trigger: 'rounded-none border-none bg-uzh-blue-20',
trigger: 'rounded-none border-none bg-uzh-blue-20 text-lg',
item: 'text-red-700',
scrollButton: 'bg-blue-400',
groupLabel: 'text-red-700',
separator: 'bg-green-700',
}}
Expand All @@ -223,17 +159,6 @@ export const Styled = () => {
)
}

export const Small = () => {
return (
<Select
placeholder="Select an item"
groups={groupValues}
onChange={(newValue) => console.log(newValue)}
size="sm"
/>
)
}

export const CustomTriggerLabel = () => {
const items = [
{ value: 'apple', label: 'Apple long label', shortLabel: 'Apple' },
Expand Down
Loading
Loading