diff --git a/packages/lsd-react/src/components/CSSBaseline/CSSBaseline.tsx b/packages/lsd-react/src/components/CSSBaseline/CSSBaseline.tsx index bdc53fa..508d250 100644 --- a/packages/lsd-react/src/components/CSSBaseline/CSSBaseline.tsx +++ b/packages/lsd-react/src/components/CSSBaseline/CSSBaseline.tsx @@ -12,6 +12,8 @@ import { BreadcrumbStyles } from '../Breadcrumb/Breadcrumb.styles' import { BreadcrumbItemStyles } from '../BreadcrumbItem/BreadcrumbItem.styles' import { defaultThemes, Theme, withTheme } from '../Theme' import { TypographyStyles } from '../Typography/Typography.styles' +import { CardItemStyles } from '../CardItem/Cardtem.styles' +import { CardStyles } from '../Card/Card.styles' const componentStyles: Array | SerializedStyles> = [ @@ -26,6 +28,8 @@ const componentStyles: Array | SerializedStyles> = IconTagStyles, BreadcrumbStyles, BreadcrumbItemStyles, + CardItemStyles, + CardStyles, ] export const CSSBaseline: React.FC<{ theme?: Theme }> = ({ diff --git a/packages/lsd-react/src/components/Card/Card.classes.ts b/packages/lsd-react/src/components/Card/Card.classes.ts new file mode 100644 index 0000000..83ce738 --- /dev/null +++ b/packages/lsd-react/src/components/Card/Card.classes.ts @@ -0,0 +1,9 @@ +export const cardClasses = { + root: `lsd-card`, + text: `lsd-card__text`, + + withHeader: 'lsd-card--with-header', + small: 'lsd-card--small', + medium: 'lsd-card--medium', + large: 'lsd-card--large', +} diff --git a/packages/lsd-react/src/components/Card/Card.stories.tsx b/packages/lsd-react/src/components/Card/Card.stories.tsx new file mode 100644 index 0000000..55545ef --- /dev/null +++ b/packages/lsd-react/src/components/Card/Card.stories.tsx @@ -0,0 +1,28 @@ +import { Meta, Story } from '@storybook/react' +import { Card, CardProps } from './Card' + +export default { + title: 'Card', + component: Card, + argTypes: { + size: { + type: { + name: 'enum', + value: ['small', 'medium', 'large'], + }, + }, + }, +} as Meta + +export const Root: Story = (args) => ( +
+ +
+) + +Root.args = { + size: 'large', + label: 'Title', + text: 'A wise man can learn more from a foolish question than a fool can learn from a wise answer.', + withHeader: false, +} diff --git a/packages/lsd-react/src/components/Card/Card.styles.ts b/packages/lsd-react/src/components/Card/Card.styles.ts new file mode 100644 index 0000000..c7c6b7b --- /dev/null +++ b/packages/lsd-react/src/components/Card/Card.styles.ts @@ -0,0 +1,32 @@ +import { css } from '@emotion/react' +import { cardClasses } from './Card.classes' + +export const CardStyles = css` + .${cardClasses.root} { + color: rgb(var(--lsd-text-primary)); + background: none; + border: 1px solid rgb(var(--lsd-border-primary)); + word-break: keep-all; + padding: 8px 16px; + box-sizing: border-box; + } + + .${cardClasses.large} { + width: 600px; + padding: 10px 18px; + } + + .${cardClasses.medium} { + width: 540px; + padding: 6px 14px; + } + + .${cardClasses.small} { + width: 480px; + padding: 6px 12px; + } + + .${cardClasses.withHeader} { + border-top: 1px solid transparent; + } +` diff --git a/packages/lsd-react/src/components/Card/Card.tsx b/packages/lsd-react/src/components/Card/Card.tsx new file mode 100644 index 0000000..61fcab6 --- /dev/null +++ b/packages/lsd-react/src/components/Card/Card.tsx @@ -0,0 +1,42 @@ +import clsx from 'clsx' +import React from 'react' +import { CardItem } from '../CardItem' +import { Typography } from '../Typography' +import { cardClasses } from './Card.classes' + +export type CardProps = Omit, 'label'> & { + size?: 'small' | 'medium' | 'large' + label?: string + text: string + withHeader?: boolean +} + +export const Card: React.FC & { + classes: typeof cardClasses +} = ({ label = '', size = 'large', text, withHeader = false, ...props }) => { + return ( + <> + {withHeader && } +
+ + {text} + +
+ + ) +} + +Card.classes = cardClasses diff --git a/packages/lsd-react/src/components/Card/index.ts b/packages/lsd-react/src/components/Card/index.ts new file mode 100644 index 0000000..067a7c2 --- /dev/null +++ b/packages/lsd-react/src/components/Card/index.ts @@ -0,0 +1 @@ +export * from './Card' diff --git a/packages/lsd-react/src/components/CardItem/Cardtem.classes.ts b/packages/lsd-react/src/components/CardItem/Cardtem.classes.ts new file mode 100644 index 0000000..2a5b73b --- /dev/null +++ b/packages/lsd-react/src/components/CardItem/Cardtem.classes.ts @@ -0,0 +1,7 @@ +export const cardItemClasses = { + root: `lsd-card-item`, + + small: `lsd-card-item--small`, + medium: `lsd-card-item--medium`, + large: `lsd-card-item--large`, +} diff --git a/packages/lsd-react/src/components/CardItem/Cardtem.stories.tsx b/packages/lsd-react/src/components/CardItem/Cardtem.stories.tsx new file mode 100644 index 0000000..566ffee --- /dev/null +++ b/packages/lsd-react/src/components/CardItem/Cardtem.stories.tsx @@ -0,0 +1,26 @@ +import { Meta, Story } from '@storybook/react' +import { CardItem, CardItemProps } from './Cardtem' + +export default { + title: 'CardItem', + component: CardItem, + argTypes: { + size: { + type: { + name: 'enum', + value: ['small', 'medium', 'large'], + }, + }, + }, +} as Meta + +export const Root: Story = (args) => ( +
+ +
+) + +Root.args = { + size: 'large', + label: 'Title', +} diff --git a/packages/lsd-react/src/components/CardItem/Cardtem.styles.ts b/packages/lsd-react/src/components/CardItem/Cardtem.styles.ts new file mode 100644 index 0000000..d761bd7 --- /dev/null +++ b/packages/lsd-react/src/components/CardItem/Cardtem.styles.ts @@ -0,0 +1,30 @@ +import { css } from '@emotion/react' +import { cardItemClasses } from './Cardtem.classes' + +export const CardItemStyles = css` + .${cardItemClasses.root} { + box-sizing: border-box; + border: 1px solid rgb(var(--lsd-border-primary)); + text-align: center; + display: flex; + justify-content: center; + } + + .${cardItemClasses.large} { + width: 600px; + min-height: 40px; + padding: 10px 18px; + } + + .${cardItemClasses.medium} { + width: 540px; + min-height: 32px; + padding: 6px 14px; + } + + .${cardItemClasses.small} { + width: 480px; + min-height: 28px; + padding: 6px 12px; + } +` diff --git a/packages/lsd-react/src/components/CardItem/Cardtem.tsx b/packages/lsd-react/src/components/CardItem/Cardtem.tsx new file mode 100644 index 0000000..16709b6 --- /dev/null +++ b/packages/lsd-react/src/components/CardItem/Cardtem.tsx @@ -0,0 +1,37 @@ +import clsx from 'clsx' +import React from 'react' +import { Typography } from '../Typography' +import { cardItemClasses } from './Cardtem.classes' + +export type CardItemProps = Omit< + React.HTMLAttributes, + 'label' +> & { + label: string + size?: 'small' | 'medium' | 'large' +} + +export const CardItem: React.FC & { + classes: typeof cardItemClasses +} = ({ label, size = 'large', ...props }) => { + return ( +
+ + {label} + +
+ ) +} + +CardItem.classes = cardItemClasses diff --git a/packages/lsd-react/src/components/CardItem/index.ts b/packages/lsd-react/src/components/CardItem/index.ts new file mode 100644 index 0000000..73f6b88 --- /dev/null +++ b/packages/lsd-react/src/components/CardItem/index.ts @@ -0,0 +1 @@ +export * from './Cardtem'