Skip to content

Commit

Permalink
Added DividerWithText
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeystylle committed Aug 2, 2024
1 parent ac5147b commit 7f2e630
Show file tree
Hide file tree
Showing 3 changed files with 56 additions and 0 deletions.
32 changes: 32 additions & 0 deletions components/DividerWithText/DividerWithText.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import type { Meta, StoryObj } from '@storybook/react';

import DividerWithText from './DividerWithText';

const meta: Meta<typeof DividerWithText> = {
title: 'Components/DividerWithText',
component: DividerWithText,
tags: ['autodocs'],
parameters: {
layout: 'centered',
},
decorators: [
Story => (
<div
style={{
width: '500px',
}}
>
<Story />
</div>
),
],
};

export default meta;
type Story = StoryObj<typeof DividerWithText>;

export const Default: Story = {
args: {
text: 'Divider Text',
},
};
23 changes: 23 additions & 0 deletions components/DividerWithText/DividerWithText.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { cn } from '@/lib/utils';
import React from 'react';

interface DividerProps extends React.ComponentPropsWithoutRef<'div'> {
/**
* text content of bet the divider
*/
text: string;
}

const dividerClass = cn(
'mx-auto flex w-full items-center justify-evenly ',
'before:mr-4 before:block before:h-px before:flex-grow before:bg-gray-400 ',
'after:ml-4 after:block after:h-px after:flex-grow after:bg-gray-400 '
);

const DividerWithText = (props: DividerProps) => {
const { text } = props;

return <div className={dividerClass}>{text}</div>;
};

export default DividerWithText;
1 change: 1 addition & 0 deletions components/DividerWithText/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './DividerWithText';

0 comments on commit 7f2e630

Please sign in to comment.