Skip to content

Commit

Permalink
Add SVG Card Story
Browse files Browse the repository at this point in the history
  • Loading branch information
Krutie committed Apr 4, 2021
1 parent d90b61f commit a562e8a
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 0 deletions.
43 changes: 43 additions & 0 deletions components/ui/card/Card.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ import CardImage from "./CardImage.vue";
import CardHeader from "./CardHeader.vue";
import CardFooter from "./CardFooter.vue";

// SVG Card
import CardContent from "./CardContent.vue";

// import config
import primaryConfig from './docs/primaryConfig.json'
import svgConfig from './docs/svgConfig.json'

// import readme
import readme from "./docs/readme.md";
Expand Down Expand Up @@ -69,3 +73,42 @@ const PrimaryTemplate = (args, { argTypes }) => ({
// named export Primary to create respective story
export const Primary = PrimaryTemplate.bind({});


// SVG
// Define template for SVG Story
const SVGTemplate = (args, { argTypes }) => ({
components: { Card, CardContent, CardFooter },
props: Object.keys(argTypes),
template: `
<card
:padding="padding"
:primary-color="primaryColor"
:secondary-color="secondaryColor"
:border-width="borderWidth"
:border-radius="borderRadius"
:card-bg="cardBg"
class="w-72"
>
<card-content>
<components :is="svgComponent" :color="primaryColor" />
</card-content>
<card-footer
:invert="invert"
:name="name"
category="Collection of card designs"
>
</card-footer>
</card>
`,
});
// named export Primary to create respective story
export const SVG = SVGTemplate.bind({});
SVG.args = svgConfig.args;
SVG.argTypes = svgConfig.argTypes;


// Gradient
// Define template for SVG Story
const GradientTemplate = () => ({})
// named export Primary to create respective story
export const Gradient = GradientTemplate.bind({});
30 changes: 30 additions & 0 deletions components/ui/card/docs/svgConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"args": {
"primaryColor": "blue-400",
"padding": 1,
"borderRadius": "3xl",
"invert": false,
"svgComponent": "svg-1"
},
"argTypes": {
"svgComponent": {
"table": {
"category": "SVG"
},
"control": {
"type": "select",
"options": [
"svg-1",
"svg-2",
"svg-3"
]
},
"defaultValue": "svg-3"
},
"invert": {
"table": {
"disable": true
}
}
}
}

0 comments on commit a562e8a

Please sign in to comment.