diff --git a/src/stories/components/Button.stories.tsx b/src/stories/components/Button.stories.tsx index e62093ac..1d497d8c 100644 --- a/src/stories/components/Button.stories.tsx +++ b/src/stories/components/Button.stories.tsx @@ -135,7 +135,7 @@ export const CourseCatalogActionButtons: Story = { CES - + Past Syllabi diff --git a/src/stories/components/Divider.stories.ts b/src/stories/components/Divider.stories.ts deleted file mode 100644 index 49b96675..00000000 --- a/src/stories/components/Divider.stories.ts +++ /dev/null @@ -1,18 +0,0 @@ -import Divider from 'src/views/components/common/Divider/Divider'; -import type { Meta, StoryObj } from '@storybook/react'; - -const meta = { - title: 'Components/Common/Divider', - component: Divider, - tags: ['autodocs'], - argTypes: { - color: { - control: 'color', - }, - }, -} satisfies Meta; - -export default meta; -type Story = StoryObj; - -export const Default: Story = {}; diff --git a/src/stories/components/Divider.stories.tsx b/src/stories/components/Divider.stories.tsx new file mode 100644 index 00000000..a2cf0caf --- /dev/null +++ b/src/stories/components/Divider.stories.tsx @@ -0,0 +1,77 @@ +import React from 'react'; +import { Meta, StoryObj } from '@storybook/react'; +import Divider from '@views/components/common/Divider/Divider'; +import { Button } from '@views/components/common/Button/Button'; +import AddIcon from '~icons/material-symbols/add'; +import CalendarMonthIcon from '~icons/material-symbols/calendar-month'; +import DescriptionIcon from '~icons/material-symbols/description'; +import HappyFaceIcon from '~icons/material-symbols/mood'; +import ReviewsIcon from '~icons/material-symbols/reviews'; + +const meta = { + title: 'Components/Common/Divider', + component: Divider, + parameters: { + layout: 'centered', + }, + tags: ['autodocs'], +} satisfies Meta; +export default meta; + +type Story = StoryObj; + +export const Vertical: Story = { + args: { + size: '2.5rem', + orientation: 'vertical', + }, + render: props => , +}; + +export const Horizontal: Story = { + args: { + size: '2.5rem', + orientation: 'horizontal', + }, + render: props => , +}; + +export const IGotHorizontalIGotVerticalWhatYouWant: Story = { + args: { + size: '2.5rem', + orientation: 'vertical', + }, + + render: props => ( + + {Array.from({ length: 21 }).map((_, i) => ( + + ))} + + ), +}; + +export const CourseCatalogActionButtons: Story = { + args: { + size: '1.75rem', + orientation: 'vertical', + }, + render: props => ( + + + + + RateMyProf + + + CES + + + Past Syllabi + + + Add Course + + + ), +}; diff --git a/src/views/components/common/Divider/Divider.module.scss b/src/views/components/common/Divider/Divider.module.scss deleted file mode 100644 index cf947f2a..00000000 --- a/src/views/components/common/Divider/Divider.module.scss +++ /dev/null @@ -1,5 +0,0 @@ -@use 'src/views/styles/colors.module.scss'; - -hr { - border: 1px solid colors.$limestone; -} diff --git a/src/views/components/common/Divider/Divider.tsx b/src/views/components/common/Divider/Divider.tsx index 3ad13117..f5db4a0e 100644 --- a/src/views/components/common/Divider/Divider.tsx +++ b/src/views/components/common/Divider/Divider.tsx @@ -1,25 +1,47 @@ import clsx from 'clsx'; import React from 'react'; -import { Color } from '@views/styles/colors.module.scss'; -import styles from './Divider.module.scss'; -export type Props = { - color?: Color | React.CSSProperties['borderColor']; - type?: 'solid' | 'dashed' | 'dotted'; - style?: React.CSSProperties; +/** + * Props for the Divider component + * + * @param orientation - Orientation of the divider (horizontal or vertical) + * @param size - Size of the divider (forwards to width or height in CSS) + * @param className - Additional classes to be added to the divider + * @param testId - Test id for the divider + */ +export type DividerProps = { + orientation: 'horizontal' | 'vertical'; + size: React.CSSProperties['width' | 'height']; className?: string; testId?: string; }; /** * This is a reusable divider component that can be used to separate content + * + * @returns A divider component + * + * @example + * ```tsx + * + * ``` + * + * @example + * ```tsx + * + * ``` */ -export default function Divider(props: Props) { - const style = { - ...props.style, - borderColor: props.color, - borderStyle: props.type, - }; +export default function Divider({ className, testId, size, orientation }: DividerProps) { + const style: React.CSSProperties = + orientation === 'horizontal' + ? { width: size, borderBottomWidth: '1px' } + : { height: size, borderRightWidth: '1px' }; - return ; + return ( + + ); }