diff --git a/addons/core/translations/actions/en-us.yaml b/addons/core/translations/actions/en-us.yaml index 9c97d54af..2bdd086cd 100644 --- a/addons/core/translations/actions/en-us.yaml +++ b/addons/core/translations/actions/en-us.yaml @@ -36,4 +36,5 @@ toggle-secret: Toggle secret visibility minimize: Minimize fullscreen: Fullscreen clear-all-filters: Clear all filters -learn-more: Learn more \ No newline at end of file +learn-more: Learn more +refresh: Refresh \ No newline at end of file diff --git a/addons/rose/addon/components/rose/button/index.js b/addons/rose/addon/components/rose/button/index.js new file mode 100644 index 000000000..fa54cee1d --- /dev/null +++ b/addons/rose/addon/components/rose/button/index.js @@ -0,0 +1,5 @@ +import Component from '@glimmer/component'; + +export default class RoseButtonComponent extends Component { + // =attributes +} diff --git a/addons/rose/addon/components/rose/loading-button/index.hbs b/addons/rose/addon/components/rose/loading-button/index.hbs new file mode 100644 index 000000000..b5be619a5 --- /dev/null +++ b/addons/rose/addon/components/rose/loading-button/index.hbs @@ -0,0 +1,18 @@ + + {{yield}} + \ No newline at end of file diff --git a/addons/rose/addon/components/rose/loading-button/index.js b/addons/rose/addon/components/rose/loading-button/index.js new file mode 100644 index 000000000..d27678155 --- /dev/null +++ b/addons/rose/addon/components/rose/loading-button/index.js @@ -0,0 +1,20 @@ +import button from '../button/index'; + +import { tracked } from '@glimmer/tracking'; +import { action } from '@ember/object'; + +export default class LoadingButton extends button { + // =actions + @tracked isLoading = false; + + @action + async toggleRefresh() { + this.isLoading = true; + try { + await this.args.onClick(); + } catch (e) { + console.error('Error while loading data', e); + } + this.isLoading = false; + } +} diff --git a/addons/rose/addon/components/rose/loading-button/index.stories.mdx b/addons/rose/addon/components/rose/loading-button/index.stories.mdx new file mode 100644 index 000000000..bd791219c --- /dev/null +++ b/addons/rose/addon/components/rose/loading-button/index.stories.mdx @@ -0,0 +1,43 @@ +import { Meta, Story, Preview } from '@storybook/addon-docs/blocks'; +import { hbs } from 'ember-cli-htmlbars'; +import { action } from '@storybook/addon-actions'; +import { text, boolean, select } from '@storybook/addon-knobs'; + + + +# LoadingButton + +A simple LoadingButton component with two states - loading and reloading that renders an HTML `