Skip to content

Commit

Permalink
Framework snippets for Toast static functions
Browse files Browse the repository at this point in the history
  • Loading branch information
BOTLANNER committed Jul 3, 2023
1 parent 04c2c68 commit 51b30e9
Showing 1 changed file with 118 additions and 0 deletions.
118 changes: 118 additions & 0 deletions src/toast/Toast.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,42 @@ document.querySelector('omni-button').addEventListener('click', () => {
});`
}
},
{
framework: 'Vue',
sourceParts: {
htmlFragment: raw`<omni-button label="Show Toast" @click="showToast"></omni-button>`,
jsFragment: `import { Toast } from '@capitec/omni-components/toast';
window.vueData = {
showToast: () => {
Toast.show({
type: 'success',
header: 'Success!',
detail: 'It was successful.',
closeable: true,
duration: 3000
});
}
};`
}
},
{
framework: 'Lit',
sourceParts: {
htmlFragment: raw`<omni-button label="Show Toast" @click="\${showToast}"></omni-button>`,
jsFragment: `import { Toast } from '@capitec/omni-components/toast';
const showToast = () => {
Toast.show({
type: 'success',
header: 'Success!',
detail: 'It was successful.',
closeable: true,
duration: 3000
});
}`
}
},
{
framework: 'React',
load: (args) => `import { OmniButton } from "@capitec/omni-components-react/button";
Expand Down Expand Up @@ -175,6 +211,50 @@ document.querySelector('omni-button').addEventListener('click', () => {
});`
}
},
{
framework: 'Vue',
sourceParts: {
htmlFragment: raw`<omni-button label="Show Toast" @click="showToast"></omni-button>`,
jsFragment: `import { Toast } from '@capitec/omni-components/toast';
Toast.configure({
position: 'top'
});
window.vueData = {
showToast: () => {
Toast.show({
type: 'success',
header: 'Success!',
detail: 'It was successful.',
closeable: true,
duration: 3000
});
}
};`
}
},
{
framework: 'Lit',
sourceParts: {
htmlFragment: raw`<omni-button label="Show Toast" @click="\${showToast}"></omni-button>`,
jsFragment: `import { Toast } from '@capitec/omni-components/toast';
Toast.configure({
position: 'top'
});
const showToast = () => {
Toast.show({
type: 'success',
header: 'Success!',
detail: 'It was successful.',
closeable: true,
duration: 3000
});
}`
}
},
{
framework: 'React',
load: (args) => `import { OmniButton } from "@capitec/omni-components-react/button";
Expand Down Expand Up @@ -247,6 +327,44 @@ document.querySelector('omni-button').addEventListener('click', () => {
});`
}
},
{
framework: 'Vue',
sourceParts: {
htmlFragment: raw`<omni-button label="Show Toast" @click="showToast"></omni-button>`,
jsFragment: `import { Toast } from '@capitec/omni-components/toast';
window.vueData = {
showToast: () => {
Toast.show({
stack: true,
type: 'success',
header: 'Success!',
detail: 'It was successful.',
closeable: true,
duration: 3000
});
}
};`
}
},
{
framework: 'Lit',
sourceParts: {
htmlFragment: raw`<omni-button label="Show Toast" @click="\${showToast}"></omni-button>`,
jsFragment: `import { Toast } from '@capitec/omni-components/toast';
const showToast = () => {
Toast.show({
stack: true,
type: 'success',
header: 'Success!',
detail: 'It was successful.',
closeable: true,
duration: 3000
});
}`
}
},
{
framework: 'React',
load: (args) => `import { OmniButton } from "@capitec/omni-components-react/button";
Expand Down

0 comments on commit 51b30e9

Please sign in to comment.