Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f687eec
commit ee98b3a
Showing
5 changed files
with
65 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import React from 'react' | ||
import { Story, Meta } from '@storybook/react' | ||
|
||
import Stack, { StackProps } from '.' | ||
|
||
export default { | ||
title: 'Layout/Stack', | ||
component: Stack, | ||
} as Meta | ||
|
||
export const Default: Story<StackProps> = (args) => { | ||
return ( | ||
<Stack {...args}> | ||
<div className="grid w-32 h-20 rounded bg-primary text-primary-content place-content-center">1</div> | ||
<div className="grid w-32 h-20 rounded bg-accent text-accent-content place-content-center">2</div> | ||
<div className="grid w-32 h-20 rounded bg-secondary text-secondary-content place-content-center">3</div> | ||
</Stack> | ||
) | ||
} | ||
|
||
Default.args = {} |
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,38 @@ | ||
import React, { forwardRef } from 'react' | ||
import { twMerge } from 'tailwind-merge' | ||
|
||
import { | ||
IComponentBaseProps, | ||
} from '../types' | ||
|
||
export type StackProps = | ||
& React.HTMLAttributes<HTMLDivElement> | ||
& IComponentBaseProps | ||
|
||
const Stack = forwardRef<HTMLDivElement, StackProps>(({ | ||
dataTheme, | ||
className, | ||
children, | ||
...props | ||
}, ref): JSX.Element => { | ||
const classes = twMerge( | ||
'stack', | ||
className, | ||
) | ||
|
||
return ( | ||
<div | ||
{...props} | ||
ref={ref} | ||
data-theme={dataTheme} | ||
className={classes} | ||
> | ||
{children} | ||
</div> | ||
) | ||
} | ||
) | ||
|
||
Stack.displayName = "Stack" | ||
|
||
export default Stack |
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,3 @@ | ||
import Stack, { StackProps as TStackProps } from './Stack' | ||
export type StackProps = TStackProps | ||
export default Stack |
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