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

Fix - Revisao de componentes #14

Merged
merged 10 commits into from
Feb 8, 2023
2 changes: 2 additions & 0 deletions apps/docs/.storybook/preview.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ import { themes } from '@storybook/theming'

export const parameters = {
actions: { argTypesRegex: '^on[A-Z].*' },
layout: 'centered',
controls: {
expanded: true,
matchers: {
color: /(background|color)$/i,
date: /Date$/,
Expand Down
66 changes: 0 additions & 66 deletions apps/docs/src/stories/Button.stories.tsx

This file was deleted.

31 changes: 31 additions & 0 deletions apps/docs/src/stories/Button/Icon.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { ComponentStory, Meta } from '@storybook/react'
import { CheckCircle } from 'phosphor-react'

import { Button, ButtonIconProps } from '@coaktion/visu'

export default {
title: 'Button/Icon',
component: Button.Icon,
argTypes: {
children: {
table: {
type: {
summary: 'React.ReactNode',
},
},
},
},
args: {
children: '',
},
} as Meta<ButtonIconProps>

const Template: ComponentStory<typeof Button.Icon> = (args) => {
return (
<Button.Icon {...args}>
<CheckCircle />
</Button.Icon>
)
}

export const Comum = Template.bind({})
97 changes: 97 additions & 0 deletions apps/docs/src/stories/Button/Root.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
import { Meta, StoryObj } from '@storybook/react'
import { CheckCircle } from 'phosphor-react'

import { Button, ButtonRootProps } from '@coaktion/visu'

export default {
title: 'Button/Root',
component: Button.Root,
argTypes: {
children: {
table: {
type: {
summary: 'React.ReactNode',
},
},
},
size: {
control: { type: 'inline-radio' },
description: 'Define o tamanho do botão',
options: ['sm', 'md', 'lg'],
table: {
type: {
summary: ['sm', 'md', 'lg'].join('|'),
},
defaultValue: { summary: 'md' },
},
type: { name: 'string', required: false },
},
ghost: {
control: 'boolean',
description: 'Aplica o estilo ghost',
table: {
type: { summary: 'boolean' },
defaultValue: { summary: false },
},
type: { name: 'boolean', required: false },
},
disabled: {
control: { type: 'boolean' },
description: 'Desabilita o botão',
table: {
type: { summary: 'boolean' },
defaultValue: { summary: false },
},
type: { name: 'boolean', required: false },
},
onClick: {
action: 'clicked',
description: 'Define o evento de click',
table: { type: { summary: 'function' } },
},
},
args: {
children: '',
size: 'md',
ghost: false,
disabled: false,
},
} as Meta<ButtonRootProps>

export const Comum: StoryObj<ButtonRootProps> = {
args: {
children: 'Clique aqui',
},
}

export const ComIcone: StoryObj<ButtonRootProps> = {
argTypes: {
children: {
control: 'none',
},
},
args: {
children: [
'Clique aqui',
<Button.Icon key="icon">
<CheckCircle />
</Button.Icon>,
],
},
}

export const ComIconeNaEsquerda: StoryObj<ButtonRootProps> = {
argTypes: {
children: {
control: 'none',
},
},
args: {
children: [
<Button.Icon key="icon">
<CheckCircle />
</Button.Icon>,
'Clique aqui',
],
},
}
49 changes: 0 additions & 49 deletions apps/docs/src/stories/Input.stories.tsx

This file was deleted.

42 changes: 42 additions & 0 deletions apps/docs/src/stories/Input/Icon.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { ComponentStory, Meta } from '@storybook/react'
import { Envelope } from 'phosphor-react'

import { Input, InputIconProps } from '@coaktion/visu'

export default {
title: 'Input/Icon',
component: Input.Icon,
argTypes: {
disabled: {
control: { type: 'boolean' },
description: 'Desabilita o ícone',
table: {
type: { summary: 'boolean' },
defaultValue: { summary: false },
},
type: { name: 'boolean', required: false },
},
},
args: {
disabled: false,
},
} as Meta<InputIconProps>

const Template: ComponentStory<typeof Input.Icon> = (args) => {
return (
<Input.Icon {...args}>
<Envelope />
</Input.Icon>
)
}

export const Comum = Template.bind({})

export const ComAcaoDeClique = Template.bind({})
ComAcaoDeClique.argTypes = {
onClick: {
action: 'clicked',
description: 'Define o evento de click',
table: { type: { summary: 'function' } },
},
}
45 changes: 45 additions & 0 deletions apps/docs/src/stories/Input/Input.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
import { ComponentStory, Meta } from '@storybook/react'

import { Input, InputInputProps } from '@coaktion/visu'

export default {
title: 'Input/Input',
component: Input.Input,
argTypes: {
placeholder: {
control: { type: 'text' },
description: 'Placeholder do input',
table: {
type: {
summary: 'string',
},
defaultValue: '',
},
},
disabled: {
control: { type: 'boolean' },
description: 'Desabilita o input',
table: {
type: { summary: 'boolean' },
defaultValue: { summary: false },
},
type: { name: 'boolean', required: false },
},
},
args: {
placeholder: 'Escreva seu email aqui',
disabled: false,
},
} as Meta<InputInputProps>

const Template: ComponentStory<typeof Input.Input> = (args) => {
return (
<>
Input comum com todas as propriedades de um input comum
<br />
<Input.Input {...args} />
</>
)
}

export const Comum = Template.bind({})
Loading