Merge branch 'pr/68' into hackathon
This commit is contained in:
@@ -1,24 +1,33 @@
|
||||
import { Button } from 'src/views/components/common/Button/Button';
|
||||
import type { Meta, StoryObj } from '@storybook/react';
|
||||
import React from 'react';
|
||||
import { colorsFlattened } from 'src/shared/util/themeColors';
|
||||
import ImagePlaceholderIcon from '~icons/material-symbols/image';
|
||||
import AddIcon from '~icons/material-symbols/add';
|
||||
import RemoveIcon from '~icons/material-symbols/remove';
|
||||
import CalendarMonthIcon from '~icons/material-symbols/calendar-month';
|
||||
import ReviewsIcon from '~icons/material-symbols/reviews';
|
||||
import HappyFaceIcon from '~icons/material-symbols/mood';
|
||||
import DescriptionIcon from '~icons/material-symbols/description';
|
||||
|
||||
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
||||
const meta = {
|
||||
title: 'Components/Common/Button',
|
||||
component: Button,
|
||||
parameters: {
|
||||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
||||
layout: 'centered',
|
||||
},
|
||||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
||||
tags: ['autodocs'],
|
||||
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
||||
args: {
|
||||
children: 'Button',
|
||||
},
|
||||
argTypes: {
|
||||
children: { control: 'text' },
|
||||
},
|
||||
title: 'Components/Common/Button',
|
||||
component: Button,
|
||||
parameters: {
|
||||
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
||||
layout: 'centered',
|
||||
},
|
||||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
||||
tags: ['autodocs'],
|
||||
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
||||
args: {
|
||||
children: 'Button',
|
||||
icon: ImagePlaceholderIcon,
|
||||
},
|
||||
argTypes: {
|
||||
children: { control: 'text' },
|
||||
},
|
||||
} satisfies Meta<typeof Button>;
|
||||
|
||||
export default meta;
|
||||
@@ -26,72 +35,112 @@ type Story = StoryObj<typeof meta>;
|
||||
|
||||
// More on writing stories with args: https://storybook.js.org/docs/writing-stories/args
|
||||
export const Default: Story = {
|
||||
args: {},
|
||||
args: {
|
||||
variant: 'filled',
|
||||
color: 'ut-black',
|
||||
},
|
||||
};
|
||||
|
||||
export const Disabled: Story = {
|
||||
args: {
|
||||
disabled: true,
|
||||
},
|
||||
};
|
||||
|
||||
export const Grid: Story = {
|
||||
render: props => (
|
||||
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
||||
<div style={{ display: 'flex' }}>
|
||||
<Button {...props} type='primary' />
|
||||
<Button {...props} type='secondary' />
|
||||
<Button {...props} type='tertiary' />
|
||||
<Button {...props} type='danger' />
|
||||
<Button {...props} type='warning' />
|
||||
<Button {...props} type='success' />
|
||||
<Button {...props} type='info' />
|
||||
</div>
|
||||
<div style={{ display: 'flex' }}>
|
||||
<Button {...props} type='primary' disabled />
|
||||
<Button {...props} type='secondary' disabled />
|
||||
<Button {...props} type='tertiary' disabled />
|
||||
<Button {...props} type='danger' disabled />
|
||||
<Button {...props} type='warning' disabled />
|
||||
<Button {...props} type='success' disabled />
|
||||
<Button {...props} type='info' disabled />
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
};
|
||||
|
||||
|
||||
// TODO: Actually show the buttons as they appear in the design
|
||||
export const CourseButtons: Story = {
|
||||
args: {
|
||||
children: 'Add Course',
|
||||
},
|
||||
render: props => (
|
||||
<div style={{ display: 'flex', flexDirection: 'column' }}>
|
||||
<div style={{ display: 'flex' }}>
|
||||
<Button {...props} type='primary' />
|
||||
<Button {...props} type='secondary' />
|
||||
<Button {...props} type='tertiary' />
|
||||
<Button {...props} type='danger' />
|
||||
<Button {...props} type='warning' />
|
||||
<Button {...props} type='success' />
|
||||
<Button {...props} type='info' />
|
||||
</div>
|
||||
<div style={{ display: 'flex' }}>
|
||||
<Button {...props} type='primary' disabled />
|
||||
<Button {...props} type='secondary' disabled />
|
||||
<Button {...props} type='tertiary' disabled />
|
||||
<Button {...props} type='danger' disabled />
|
||||
<Button {...props} type='warning' disabled />
|
||||
<Button {...props} type='success' disabled />
|
||||
<Button {...props} type='info' disabled />
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
design: {
|
||||
type: 'figma',
|
||||
url: 'https://www.figma.com/file/8tsCay2FRqctrdcZ3r9Ahw/UTRP?type=design&node-id=324-389&mode=design&t=BoS5xBrpSsjgQXqv-4',
|
||||
args: {
|
||||
variant: 'filled',
|
||||
color: 'ut-black',
|
||||
disabled: true,
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// @ts-ignore
|
||||
export const Grid: Story = {
|
||||
render: props => (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '15px' }}>
|
||||
<div style={{ display: 'flex', gap: '15px' }}>
|
||||
<Button {...props} variant='filled' color='ut-black' />
|
||||
<Button {...props} variant='outline' color='ut-black' />
|
||||
<Button {...props} variant='single' color='ut-black' />
|
||||
</div>
|
||||
|
||||
<hr />
|
||||
|
||||
<div style={{ display: 'flex', gap: '15px' }}>
|
||||
<Button {...props} variant='filled' color='ut-black' disabled />
|
||||
<Button {...props} variant='outline' color='ut-black' disabled />
|
||||
<Button {...props} variant='single' color='ut-black' disabled />
|
||||
</div>
|
||||
</div>
|
||||
),
|
||||
};
|
||||
|
||||
export const PrettyColors: Story = {
|
||||
// @ts-ignore
|
||||
args: {
|
||||
children: '',
|
||||
},
|
||||
render: props => {
|
||||
const colorsNames = Object.keys(colorsFlattened) as (keyof typeof colorsFlattened)[];
|
||||
|
||||
return (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '15px' }}>
|
||||
{colorsNames.map(color => (
|
||||
<div style={{ display: 'flex', gap: '15px' }} key={color}>
|
||||
<Button {...props} variant='filled' color={color}>
|
||||
Button
|
||||
</Button>
|
||||
<Button {...props} variant='outline' color={color}>
|
||||
Button
|
||||
</Button>
|
||||
<Button {...props} variant='single' color={color}>
|
||||
Button
|
||||
</Button>
|
||||
<Button {...props} variant='filled' color={color} />
|
||||
<Button {...props} variant='outline' color={color} />
|
||||
<Button {...props} variant='single' color={color} />
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
// @ts-ignore
|
||||
export const CourseButtons: Story = {
|
||||
render: props => (
|
||||
<div style={{ display: 'flex', flexDirection: 'column', gap: '15px', alignItems: 'center' }}>
|
||||
<Button {...props} variant='filled' color='ut-green' icon={AddIcon}>
|
||||
Add Course
|
||||
</Button>
|
||||
<Button {...props} variant='filled' color='theme-red' icon={RemoveIcon}>
|
||||
Remove Course
|
||||
</Button>
|
||||
</div>
|
||||
),
|
||||
parameters: {
|
||||
design: {
|
||||
type: 'figma',
|
||||
url: 'https://www.figma.com/file/8tsCay2FRqctrdcZ3r9Ahw/UTRP?type=design&node-id=324-389&mode=design&t=BoS5xBrpSsjgQXqv-4',
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
export const CourseCatalogActionButtons: Story = {
|
||||
// @ts-ignore
|
||||
args: {
|
||||
children: '',
|
||||
},
|
||||
render: props => (
|
||||
<div style={{ display: 'flex', gap: '15px' }}>
|
||||
<Button {...props} variant='filled' color='ut-burnt-orange' icon={CalendarMonthIcon} />
|
||||
<Button {...props} variant='outline' color='ut-blue' icon={ReviewsIcon}>
|
||||
RateMyProf
|
||||
</Button>
|
||||
<Button {...props} variant='outline' color='ut-teal' icon={HappyFaceIcon}>
|
||||
CES
|
||||
</Button>
|
||||
<Button {...props} variant='outline' color='ut-yellow' icon={DescriptionIcon}>
|
||||
Past Syllabi
|
||||
</Button>
|
||||
<Button {...props} variant='filled' color='ut-green' icon={AddIcon}>
|
||||
Add Course
|
||||
</Button>
|
||||
</div>
|
||||
),
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user