Skip to content
Open
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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"name": "Marcelo Ludovino",
"email": "marcelo.docutec@gmail.com"
},
"version": "0.0.8",
"version": "0.0.10",
"type": "module",
"engines": {
"node": ">=18.0.0"
Expand Down
26 changes: 26 additions & 0 deletions src/components/atoms/Select/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { FC } from 'react'

import { MenuItem } from '@mui/material'
import MuiSelect, { SelectProps } from '@mui/material/Select'

export interface MuiSelectProps extends SelectProps {
options: string[]
}

export const Select: FC<MuiSelectProps> = ({
options,
label = '',
...props
}) => {
return (
<MuiSelect {...props}>
{options.map(option => {
return (
<MenuItem value={option} key={option}>
{option}
</MenuItem>
)
})}
</MuiSelect>
)
}
40 changes: 40 additions & 0 deletions src/stories/Select.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import type { Meta, StoryFn } from '@storybook/react'

import { Select } from '../components/atoms/Select'

export default {
title: 'Atoms/Select',
component: Select,
tags: ['autodocs'],
argTypes: {},
} as Meta<typeof Select>

type Story = StoryFn<typeof Select>

const Template: Story = args => {
return (
<Select
{...args}
options={['Ambos', 'Activo', 'Inactivo', 'Lorem ipsum dolor sit amet']}
label='Estado'
/>
)
}

export const Standard = Template.bind({})
Standard.args = {
variant: 'standard',
defaultValue: 'Ambos',
}

export const Outlined = Template.bind({})
Outlined.args = {
variant: 'outlined',
defaultValue: 'Ambos',
}

export const DefaultLongText = Template.bind({})
DefaultLongText.args = {
variant: 'outlined',
defaultValue: 'Lorem ipsum dolor sit amet',
}