-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into add/github-pr-template
- Loading branch information
Showing
22 changed files
with
353 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import { ReactElement } from 'react' | ||
|
||
import * as Styles from './styled' | ||
|
||
interface Props { | ||
/**what will be rendered inside the button. It represents the content or label of the button */ | ||
children?: any | ||
/** Click callback, with event object passed as argument */ | ||
onClick?: () => void | ||
/** When set to `true`, this prop makes the button smaller in size. */ | ||
small?: boolean | ||
/** gives the button a solid background when set to `true` */ | ||
solid?: boolean | ||
/** gitves the submit attribute to the button element */ | ||
submit?: boolean | ||
/**to display the button inline with other elements */ | ||
inline?: boolean | ||
/** center alignment of the button */ | ||
center?: boolean | ||
/** set the button as the default action */ | ||
default?: boolean | ||
/** disables the button when set to `true` */ | ||
disabled?: boolean | ||
/** control whether the button is in read-only mode */ | ||
readOnly?: boolean | ||
/** indicates that the button is required for a certain action */ | ||
required?: boolean | ||
/** when set to `true` styles of the button change to red to indicate a irreversible action */ | ||
destructive?: boolean | ||
/** when set to `true` the button background disspaears */ | ||
$transparent?: boolean | ||
as?: string | ReactElement | ||
name?: string | ||
/** */ | ||
title?: string | ||
} | ||
|
||
export { baseButtonStyles } from './styled' | ||
|
||
/**Cretia actions buttons | ||
* | ||
* Renders a default `button` that can be styled with the `destructive`, | ||
* | ||
* `solid` and `$transparent` props. | ||
*/ | ||
|
||
function ButtonBase(props: Props) { | ||
const { | ||
name = 'react', | ||
title, | ||
submit = false, | ||
inline = false, | ||
center = false, | ||
readOnly = false, | ||
required = false, | ||
children, | ||
disabled = false, | ||
destructive = false, | ||
solid = submit, | ||
small = inline, | ||
$transparent = inline, | ||
} = props | ||
const useButton = !submit && typeof children !== 'string' | ||
|
||
return ( | ||
<Styles.Container | ||
name={name} | ||
small={small} | ||
solid={solid} | ||
$center={center} | ||
disabled={disabled} | ||
readOnly={readOnly} | ||
required={required} | ||
$destructive={destructive} | ||
$transparent={$transparent} | ||
type={submit ? 'submit' : 'button'} | ||
{...(useButton | ||
? { as: 'button' as any, children: children || title } | ||
: { value: children || title })} | ||
/> | ||
) | ||
} | ||
|
||
export { ButtonBase } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
import { CheckboxBase } from '.' | ||
|
||
const meta = { | ||
title: 'Components/Checkbox', | ||
component: CheckboxBase, | ||
tags: ['autodocs'], | ||
} satisfies Meta<typeof CheckboxBase> | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof meta> | ||
|
||
export const Default: Story = { | ||
args: { | ||
name: '', | ||
checked: true, | ||
}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
import { ColorPickerBase } from '.' | ||
|
||
const meta = { | ||
title: 'Components/ColorPicker', | ||
component: ColorPickerBase, | ||
tags: ['autodocs'], | ||
} satisfies Meta<typeof ColorPickerBase> | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof meta> | ||
|
||
export const Default: Story = { | ||
args: { name: 'helloworld', value: '#fff' }, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
import { FileBase } from '.' | ||
|
||
const meta = { | ||
title: 'Components/File', | ||
component: FileBase, | ||
tags: ['autodocs'], | ||
} satisfies Meta<typeof FileBase> | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof meta> | ||
|
||
export const Default: Story = { | ||
args: { name: 'helloworld.pdf', value: 'helloworld.pdf', label: '' }, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
import { PillBase } from '.' | ||
|
||
const meta = { | ||
title: 'Components/Pill', | ||
component: PillBase, | ||
tags: ['autodocs'], | ||
} satisfies Meta<typeof PillBase> | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof meta> | ||
|
||
export const Default: Story = { | ||
args: { message: 'This is a message' }, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
import { PopupBase } from '.' | ||
|
||
const meta = { | ||
title: 'Components/Popup', | ||
component: PopupBase, | ||
tags: ['autodocs'], | ||
} satisfies Meta<typeof PopupBase> | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof meta> | ||
|
||
export const Default: Story = { | ||
args: { children: 'ReactNode', relative: false, visible: true }, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import type { Meta, StoryObj } from '@storybook/react' | ||
|
||
import { RadioBase } from '.' | ||
|
||
const meta = { | ||
title: 'Components/Radio', | ||
component: RadioBase, | ||
tags: ['autodocs'], | ||
} satisfies Meta<typeof RadioBase> | ||
|
||
export default meta | ||
|
||
type Story = StoryObj<typeof meta> | ||
|
||
export const Default: Story = { | ||
args: { value: 'any', checked: false, name: 'string', label: 'string' }, | ||
} |
Oops, something went wrong.