refactor: improve stories, remove wrappers use styles instead
This commit is contained in:
@@ -2,7 +2,6 @@ import type { Meta, StoryObj } from '@storybook/angular';
|
|||||||
|
|
||||||
import { CheckboxComponent } from './../../lib/atoms/checkbox/checkbox.component';
|
import { CheckboxComponent } from './../../lib/atoms/checkbox/checkbox.component';
|
||||||
|
|
||||||
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories
|
|
||||||
const meta: Meta<CheckboxComponent> = {
|
const meta: Meta<CheckboxComponent> = {
|
||||||
title: 'Atoms/Checkbox',
|
title: 'Atoms/Checkbox',
|
||||||
component: CheckboxComponent,
|
component: CheckboxComponent,
|
||||||
@@ -16,6 +15,21 @@ const meta: Meta<CheckboxComponent> = {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
render: (args) => ({
|
||||||
|
props: {...args, handler: (checked: boolean) => alert(`checked: ${checked}`)},
|
||||||
|
styles: [
|
||||||
|
`
|
||||||
|
@import url('/assets/styles.css');
|
||||||
|
:host {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
],
|
||||||
|
template: `
|
||||||
|
<mw-checkbox (checked)="handler($event)"/>
|
||||||
|
`,
|
||||||
|
})
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -30,15 +30,20 @@ export default meta;
|
|||||||
|
|
||||||
const Template = (args: { width: string, height: string, color: string, symbol: string,}) => ({
|
const Template = (args: { width: string, height: string, color: string, symbol: string,}) => ({
|
||||||
props: args,
|
props: args,
|
||||||
|
styles: `
|
||||||
|
:host {
|
||||||
|
display:flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
`,
|
||||||
template: `
|
template: `
|
||||||
<div style="display:flex; justify-content: center;">
|
|
||||||
<mw-svg
|
<mw-svg
|
||||||
width="${args.width}"
|
[width]="width"
|
||||||
height="${args.height}"
|
[height]="height"
|
||||||
color="${args.color}"
|
[color]="color"
|
||||||
symbol="${args.symbol}"
|
[symbol]="symbol"
|
||||||
></mw-svg>
|
/>
|
||||||
</div>`
|
`
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Svg = Template.bind({});
|
export const Svg = Template.bind({});
|
||||||
@@ -10,8 +10,8 @@ export default {
|
|||||||
color: "#000000",
|
color: "#000000",
|
||||||
ellipsis: false,
|
ellipsis: false,
|
||||||
letterSpacing: "normal",
|
letterSpacing: "normal",
|
||||||
lineHeight: null,
|
lineHeight: '',
|
||||||
maxWidth: null,
|
maxWidth: '',
|
||||||
size: '1.4rem',
|
size: '1.4rem',
|
||||||
variant: 0,
|
variant: 0,
|
||||||
},
|
},
|
||||||
@@ -23,7 +23,7 @@ export default {
|
|||||||
ellipsis: {
|
ellipsis: {
|
||||||
type: 'boolean',
|
type: 'boolean',
|
||||||
description: "If true, turns overflowing text into ellipsis (...) when the maxWidth attr is set",
|
description: "If true, turns overflowing text into ellipsis (...) when the maxWidth attr is set",
|
||||||
table: {'defaultValue':{'detail': 'Defaults to false', 'summary': 'false'}}
|
table: {defaultValue:{detail: 'Defaults to false', summary: 'false'} },
|
||||||
},
|
},
|
||||||
letterSpacing: {
|
letterSpacing: {
|
||||||
description: "Sets the horizontal spacing behavior between text characters",
|
description: "Sets the horizontal spacing behavior between text characters",
|
||||||
@@ -74,16 +74,25 @@ export default {
|
|||||||
|
|
||||||
const Template = (args: {variant: TypographyVariants, ellipsis: boolean, letterSpacing: string, lineHeight: null|string, size: string, color: string, maxWidth: null|string}) => ({
|
const Template = (args: {variant: TypographyVariants, ellipsis: boolean, letterSpacing: string, lineHeight: null|string, size: string, color: string, maxWidth: null|string}) => ({
|
||||||
props: args,
|
props: args,
|
||||||
|
styles: [
|
||||||
|
`
|
||||||
|
@import url('/assets/styles.css');
|
||||||
|
:host {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
`
|
||||||
|
],
|
||||||
template: `
|
template: `
|
||||||
<mw-typography
|
<mw-typography
|
||||||
[variant]="${args.variant}"
|
[variant]="variant"
|
||||||
[ellipsis]="${args.ellipsis}"
|
[ellipsis]="ellipsis"
|
||||||
color="${args.color}"
|
[color]="color"
|
||||||
letterSpacing="${args.letterSpacing}"
|
[letterSpacing]="letterSpacing"
|
||||||
lineHeight="${args.lineHeight}"
|
[lineHeight]="lineHeight"
|
||||||
maxWidth="${args.maxWidth}"
|
[maxWidth]="maxWidth"
|
||||||
size="${args.size}"
|
[size]="size"
|
||||||
>Texto</mw-typography>`,
|
>Texto</mw-typography>`,
|
||||||
});
|
});
|
||||||
|
|
||||||
export const Paragraph = Template.bind({});
|
export const Paragraph = Template.bind({});
|
||||||
|
|||||||
@@ -63,22 +63,27 @@ const Template: StoryObj<ExpenseIncomeCategoryByAccountDetailComponent> = {
|
|||||||
props: args,
|
props: args,
|
||||||
styles: [
|
styles: [
|
||||||
`
|
`
|
||||||
@import url('/assets/styles.css')
|
@import url('/assets/styles.css');
|
||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
height: 40px;
|
||||||
|
margin: auto;
|
||||||
|
padding: 0 4px;
|
||||||
|
width: 375px;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
],
|
],
|
||||||
template: `
|
template: `
|
||||||
<div style="width: 375px; height: 40px; margin: auto; padding: 0 4px;">
|
<mw-expense-income-category-by-account-detail
|
||||||
<mw-expense-income-category-by-account-detail
|
[acumAmount]="acumAmount"
|
||||||
[acumAmount]="acumAmount"
|
[amount]="amount"
|
||||||
[amount]="amount"
|
[iconProps]="{ symbol, color, backgroundColor }"
|
||||||
[iconProps]="{ symbol, color, backgroundColor }"
|
[category]="category"
|
||||||
[category]="category"
|
[description]="description"
|
||||||
[description]="description"
|
[showCheckbox]="showCheckbox"
|
||||||
[showCheckbox]="showCheckbox"
|
[variant]="variant"
|
||||||
[variant]="variant"
|
[whom]="whom"
|
||||||
[whom]="whom"
|
/>
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
`,
|
`,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,11 +45,17 @@ const Template: StoryObj<ExpenseIncomeCategoryDetailComponent> = {
|
|||||||
props: args,
|
props: args,
|
||||||
styles: [
|
styles: [
|
||||||
`
|
`
|
||||||
@import url('/assets/styles.css')
|
@import url('/assets/styles.css');
|
||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
height: 40px;
|
||||||
|
margin: auto;
|
||||||
|
padding: 0 4px;
|
||||||
|
width: 375px;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
],
|
],
|
||||||
template: `
|
template: `
|
||||||
<div style="width: 375px; height: 40px; margin: auto; padding: 0 4px;">
|
|
||||||
<mw-expense-income-category-detail
|
<mw-expense-income-category-detail
|
||||||
[amount]="amount"
|
[amount]="amount"
|
||||||
[iconProps]="{ symbol: symbol, color: color, backgroundColor: backgroundColor }"
|
[iconProps]="{ symbol: symbol, color: color, backgroundColor: backgroundColor }"
|
||||||
@@ -58,7 +64,6 @@ const Template: StoryObj<ExpenseIncomeCategoryDetailComponent> = {
|
|||||||
[variant]="variant"
|
[variant]="variant"
|
||||||
[whom]="whom"
|
[whom]="whom"
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
`,
|
`,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -49,11 +49,17 @@ const Template: StoryObj<ExpenseIncomeDateDetailComponent> = {
|
|||||||
props: args,
|
props: args,
|
||||||
styles: [
|
styles: [
|
||||||
`
|
`
|
||||||
@import url('/assets/styles.css')
|
@import url('/assets/styles.css');
|
||||||
|
:host {
|
||||||
|
display: block;
|
||||||
|
height: 40px;
|
||||||
|
margin: auto;
|
||||||
|
padding: 0 4px;
|
||||||
|
width: 375px;
|
||||||
|
}
|
||||||
`
|
`
|
||||||
],
|
],
|
||||||
template: `
|
template: `
|
||||||
<div style="width: 375px; height: 40px; margin: auto; padding: 0 4px;">
|
|
||||||
<mw-expense-income-date-detail
|
<mw-expense-income-date-detail
|
||||||
[amount]="amount"
|
[amount]="amount"
|
||||||
[date]="date"
|
[date]="date"
|
||||||
@@ -62,7 +68,6 @@ const Template: StoryObj<ExpenseIncomeDateDetailComponent> = {
|
|||||||
[variant]="variant"
|
[variant]="variant"
|
||||||
[whom]="whom"
|
[whom]="whom"
|
||||||
/>
|
/>
|
||||||
</div>
|
|
||||||
`,
|
`,
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user