diff --git a/src/Diff/Diff.stories.tsx b/src/Diff/Diff.stories.tsx new file mode 100644 index 00000000..9326fcae --- /dev/null +++ b/src/Diff/Diff.stories.tsx @@ -0,0 +1,55 @@ +import React from 'react' +import { StoryFn as Story, Meta } from '@storybook/react' + +import Diff, { DiffProps } from '.' + +const meta: Meta = { + title: 'Data Display/Diff', + component: Diff, + parameters: { + controls: { expanded: true }, + }, +} + +export default meta + +export const Default: Story = ({ secondItem, ...args }) => ( + + } + > + daisy + +) +Default.argTypes = { + secondItem: { + control: false, + }, +} +export const Text: Story = ({ secondItem, ...args }) => ( + + DAISY + + } + > +
+ DAISY +
+
+) +Text.argTypes = { + secondItem: { + control: false, + }, +} diff --git a/src/Diff/Diff.tsx b/src/Diff/Diff.tsx new file mode 100644 index 00000000..0936f494 --- /dev/null +++ b/src/Diff/Diff.tsx @@ -0,0 +1,31 @@ +import React, { forwardRef, ReactNode } from 'react' +import clsx from 'clsx' +import { twMerge } from 'tailwind-merge' + +import { IComponentBaseProps } from '../types' + +export type DiffProps = React.HTMLAttributes & + IComponentBaseProps & { + secondItem: ReactNode + } + +const Diff = forwardRef( + ( + { dataTheme, className, children, secondItem, ...props }, + ref + ): JSX.Element => { + const classes = twMerge('diff aspect-[16/9]', clsx({}), className) + + return ( +
+
{children}
+
{secondItem}
+
+
+ ) + } +) + +Diff.displayName = 'Diff' + +export default Diff diff --git a/src/Diff/index.ts b/src/Diff/index.ts new file mode 100644 index 00000000..a393bd7b --- /dev/null +++ b/src/Diff/index.ts @@ -0,0 +1,5 @@ +export * from './Diff'; + +import Diff, { DiffProps as TDiffProps } from './Diff' +export type DiffProps = TDiffProps +export default Diff