Skip to content

Commit 547fc14

Browse files
committed
Made padding an option.
1 parent 864fab0 commit 547fc14

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/components/Card.stories.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import type { Meta, StoryObj } from '@storybook/vue3';
33
import Card from './Card.vue';
44

55
const meta: Meta<typeof Card> = {
6+
title: "SAF/card",
67
component: Card,
78
};
89

@@ -17,6 +18,7 @@ type Story = StoryObj<typeof Card>;
1718
*/
1819
export const Primary: Story = {
1920
render: (args) => ({
21+
name: 'Basic card',
2022
components: { Card },
2123
setup() {
2224
return { args };
@@ -25,6 +27,7 @@ export const Primary: Story = {
2527
}),
2628
args: {
2729
//👇 The args you need here will depend on your component
30+
hasPadding: true,
2831
heading: 'This is heading',
2932
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.'
3033
},

src/components/Card.vue

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div class="card">
2+
<div class="card" :class="hasPadding && 'hasPad'">
33
<h3 class="title">{{ heading }}</h3>
44
<p class="text">{{ text }}</p>
55
</div>
@@ -8,12 +8,17 @@
88
99
defineProps({
1010
heading: String,
11-
text: String
11+
text: String,
12+
hasPadding: Boolean
1213
})
1314
</script>
1415
<style scoped>
1516
.card {
16-
padding: 10px;
17+
1718
border: 2px solid #cef;
1819
}
20+
.hasPad{
21+
padding: 20px;
22+
}
23+
1924
</style>

0 commit comments

Comments
 (0)