move card and indicator into UI toolkit

This commit is contained in:
Dexter 2022-03-31 17:24:46 +01:00
parent 9ee577c890
commit 9c3957caa3
6 changed files with 71 additions and 0 deletions

View File

@ -0,0 +1,16 @@
import React from 'react';
import type { ComponentStory, ComponentMeta } from '@storybook/react';
import { Card } from './card';
export default {
title: 'Card',
component: Card,
} as ComponentMeta<typeof Card>;
const Template: ComponentStory<typeof Card> = (args) => {
return <Card>Test</Card>;
};
export const Default = Template.bind({});
Default.args = {};

View File

@ -0,0 +1,11 @@
import type { ReactNode } from 'react';
interface CardProps {
children: ReactNode;
}
export function Card({ children }: CardProps) {
return (
<div className="px-24 py-16 pr-64 border items-center">{children}</div>
);
}

View File

@ -0,0 +1 @@
export * from './card';

View File

@ -0,0 +1 @@
export * from './indicator';

View File

@ -0,0 +1,31 @@
import type { Story, Meta } from '@storybook/react';
import { Indicator } from './indicator';
export default {
component: Indicator,
title: 'Indicator',
} as Meta;
const Template: Story = (args) => <Indicator {...args} />;
export const Default = Template.bind({});
export const Highlight = Template.bind({});
Highlight.args = {
variant: 'highlight',
};
export const Success = Template.bind({});
Success.args = {
variant: 'success',
};
export const Warning = Template.bind({});
Warning.args = {
variant: 'warning',
};
export const Danger = Template.bind({});
Danger.args = {
variant: 'danger',
};

View File

@ -0,0 +1,11 @@
import classNames from 'classnames';
import type { Variant } from '../../utils/intent';
import { getVariantBackground } from '../../utils/intent';
export const Indicator = ({ variant }: { variant?: Variant }) => {
const names = classNames(
'inline-block w-8 h-8 mb-[0.15rem] mr-8 rounded',
getVariantBackground(variant)
);
return <div className={names} />;
};