Skip to content

Commit

Permalink
feat: create spinner stories
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielduete committed Nov 22, 2024
1 parent 6264a37 commit ed8a6dc
Show file tree
Hide file tree
Showing 4 changed files with 135 additions and 0 deletions.
29 changes: 29 additions & 0 deletions packages/core/src/components/spinner/stories/spinner.args.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
export const SpinnerStoryArgs = {
decorators: [],
parameters: {
actions: {
handles: [],
},
docs: {
description: {
component:
'Spinners are inline block elements that usually appear near another element. Read the [Ionic documentation](https://ionicframework.com/docs/api/Spinner) for more information about this component.',
},
},
},
argTypes: {
type: {
control: 'select',
options: ['primary', 'secondary', 'dark'],
defaultValue: { summary: 'primary' },
description:
'The type of the Spinner, the component will receive the color according to its type.',
},
size: {
control: 'text',
defaultValue: { summary: 20 },
description:
'The type of the Spinner, the component will receive the color according to its type.',
},
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { Meta, StoryObj } from '@storybook/web-components'
import { html } from 'lit'

import { SpinnerStoryArgs } from './spinner.args'

export default {
title: 'Components/Spinner',
...SpinnerStoryArgs,
} as Meta

const createSpinner = (args) => {
return html`<atom-spinner type="${args.type}" />`
}

export const Primary: StoryObj = {
render: (args) => createSpinner(args),
args: {
type: 'primary',
},
}

export const Secondary: StoryObj = {
render: (args) => createSpinner(args),
args: {
type: 'secondary',
},
}

export const Dark: StoryObj = {
render: (args) => createSpinner(args),
args: {
type: 'dark',
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { AtomSpinner } from '@juntossomosmais/atomium/react'
import { Meta, StoryObj } from '@storybook/react'
import React from 'react'

import { SpinnerStoryArgs } from './spinner.args'

export default {
title: 'Components/Spinner',
component: AtomSpinner,
...SpinnerStoryArgs,
} as Meta

const createSpinner = (args) => <AtomSpinner color={args.color} />

export const Primary: StoryObj = {
render: (args) => createSpinner(args),
args: {
type: 'primary',
},
}

export const Secondary: StoryObj = {
render: (args) => createSpinner(args),
args: {
type: 'secondary',
},
}

export const Dark: StoryObj = {
render: (args) => createSpinner(args),
args: {
type: 'dark',
},
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { AtomSpinner } from '@juntossomosmais/atomium/vue'
import { Meta, StoryObj } from '@storybook/vue3'

import { SpinnerStoryArgs } from './spinner.args'

export default {
title: 'Components/Spinner',
...SpinnerStoryArgs,
} as Meta

const createSpinner = (args) => ({
components: { AtomSpinner },
setup() {
return { args }
},
template: `<AtomSpinner type="${args.type}"/>`,
})

export const Primary: StoryObj = {
render: (args) => createSpinner(args),
args: {
type: 'primary',
},
}

export const Secondary: StoryObj = {
render: (args) => createSpinner(args),
args: {
type: 'secondary',
},
}

export const Dark: StoryObj = {
render: (args) => createSpinner(args),
args: {
type: 'dark',
},
}

0 comments on commit ed8a6dc

Please sign in to comment.