diff --git a/src/components/atoms/Spinner/Spinner.js b/src/components/atoms/Spinner/Spinner.js index 6d5ce379..8cc856e8 100644 --- a/src/components/atoms/Spinner/Spinner.js +++ b/src/components/atoms/Spinner/Spinner.js @@ -22,13 +22,13 @@ export default class Image extends HTMLElement { this.shadowRoot.appendChild(spinnerStyles); // image attributes - const spinnerType = this.getAttribute('data-type'); + const spinnerType = this.getAttribute('type'); + + const spinnerSize = this.getAttribute('size'); - const spinnerSize = this.getAttribute('data-size'); + const backgroundColor = this.getAttribute('background-color'); - const backgroundColor = this.getAttribute('data-background-color'); - - const displayType = this.getAttribute('data-display-type'); + const displayType = this.getAttribute('display-type'); let spinnerSizeClass; // TODO: Fix old ESLint errors - see issue #1099 diff --git a/src/stories/spinner.stories.js b/src/stories/spinner.stories.js index 985fb1c5..2dd91fc7 100644 --- a/src/stories/spinner.stories.js +++ b/src/stories/spinner.stories.js @@ -14,16 +14,33 @@ export default { control: { type: 'select' }, options: ['sm', 'md'], }, + backgroundColor: { + control: { type: 'select' }, + options: [ + 'primary', + 'secondary', + 'success', + 'info', + 'warning', + 'danger', + 'light', + 'dark', + ], + }, backgroundColor: COMMON_STORY_ARGS.bootstrapColor, }, }; // Template const Template = (args) => { const spinner = document.createElement('cod-spinner'); - spinner.setAttribute('data-type', args.type); - spinner.setAttribute('data-background-color', args.backgroundColor); - spinner.setAttribute('data-size', args.size); - spinner.setAttribute('data-display-type', args.displayType); + spinner.setAttribute('type', args.type); + spinner.setAttribute('background-color', args.backgroundColor); + if (args.size){ + spinner.setAttribute('size', args.size); + } + if (args.displayType){ + spinner.setAttribute('display-type', args.displayType); + } return spinner; };