Skip to content

Commit

Permalink
feat: added stack
Browse files Browse the repository at this point in the history
  • Loading branch information
benjitrosch committed Mar 11, 2022
1 parent f687eec commit ee98b3a
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -133,7 +133,7 @@ Use tools like the official <a href="https://daisyui.com/theme-generator/">daisy
- [X] Indicator
- [X] Input Group
- [X] Mask
- [ ] Stack
- [X] Stack
</details>

<details>
Expand Down
21 changes: 21 additions & 0 deletions src/Stack/Stack.stories.tsx
@@ -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 = {}
38 changes: 38 additions & 0 deletions src/Stack/Stack.tsx
@@ -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
3 changes: 3 additions & 0 deletions src/Stack/index.ts
@@ -0,0 +1,3 @@
import Stack, { StackProps as TStackProps } from './Stack'
export type StackProps = TStackProps
export default Stack
2 changes: 2 additions & 0 deletions src/index.ts
Expand Up @@ -32,6 +32,7 @@ import Radio from './Radio'
import Range from './Range'
import Rating from './Rating'
import Select from './Select'
import Stack from './Stack'
import Stats from './Stats'
import Swap from './Swap'
import Table from './Table'
Expand Down Expand Up @@ -74,6 +75,7 @@ export {
Range,
Rating,
Select,
Stack,
Stats,
Swap,
Table,
Expand Down

0 comments on commit ee98b3a

Please sign in to comment.