-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
65 additions
and
73 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,4 @@ $title-margin-map: ( | |
s: xxs, | ||
m: xs, | ||
l: s | ||
) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,3 @@ $available-appearance: ( | |
filled, | ||
outlined | ||
); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,19 @@ | ||
import type { StoryFn, Meta } from '@storybook/react' | ||
import React from 'react' | ||
import Card, { Props } from './components/card/Card' | ||
import fixture from '../assets/fixture.jpg' | ||
import type { StoryFn, Meta } from "@storybook/react"; | ||
import React from "react"; | ||
import Card, { Props } from "./components/card/Card"; | ||
|
||
export default { | ||
title: 'Components/Card', | ||
component: Card | ||
} as Meta | ||
title: "Components/Card", | ||
component: Card, | ||
} as Meta; | ||
|
||
const Template: StoryFn<Props> = (args) => <Card {...args} /> | ||
const Template: StoryFn<Props> = (args) => <Card {...args} />; | ||
|
||
export const Index = Template.bind({}) | ||
export const Index = Template.bind({}); | ||
Index.args = { | ||
appearance: 'elevated', | ||
body: 'Card body', | ||
color: 'primary', | ||
appearance: "elevated", | ||
body: "Card body", | ||
color: "primary", | ||
isGapless: false, | ||
shape: 'circle' | ||
} | ||
shape: "circle", | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,40 @@ | ||
import React, { FC, ReactNode } from 'react' | ||
import { Shape } from '../types' | ||
import React, { FC } from "react"; | ||
import { Shape } from "../types"; | ||
|
||
export interface Props { | ||
appearance?: 'filled' | 'outlined' | 'elevated'; | ||
body?: string | ||
color?: 'primary' | 'secondary' | 'tertiary'; | ||
isGapless?: boolean | ||
shape?: Shape | ||
appearance?: "filled" | "outlined" | "elevated"; | ||
body?: string; | ||
color?: "primary" | "secondary" | "tertiary"; | ||
isGapless?: boolean; | ||
shape?: Shape; | ||
} | ||
|
||
const Card: FC<Props> = (props: Props) => { | ||
const { | ||
appearance, | ||
body, | ||
color, | ||
isGapless, | ||
shape, | ||
...rest | ||
} = props; | ||
|
||
const classes = [`in-card`] | ||
|
||
if (typeof appearance !== 'undefined') { | ||
classes.push(`-appearance-${appearance}`) | ||
const { appearance, body, color, isGapless, shape, ...rest } = props; | ||
|
||
const classes = [`in-card`]; | ||
|
||
if (typeof appearance !== "undefined") { | ||
classes.push(`-appearance-${appearance}`); | ||
} | ||
|
||
if (typeof color !== 'undefined') { | ||
classes.push(`-color-${color}`) | ||
if (typeof color !== "undefined") { | ||
classes.push(`-color-${color}`); | ||
} | ||
|
||
if (isGapless) { | ||
classes.push('-is-gapless') | ||
classes.push("-is-gapless"); | ||
} | ||
|
||
if (typeof shape !== 'undefined') { | ||
classes.push(`-shape-${shape}`) | ||
if (typeof shape !== "undefined") { | ||
classes.push(`-shape-${shape}`); | ||
} | ||
|
||
return ( | ||
<div | ||
className={classes.join(' ')} | ||
{...rest} | ||
> | ||
<div className={classes.join(" ")} {...rest}> | ||
{body || null} | ||
</div> | ||
); | ||
} | ||
}; | ||
|
||
export default Card | ||
export default Card; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters