Skip to content

Commit eab8023

Browse files
authored
Merge pull request #473 from appuniversum/feat/loader-centered-argument
Add a `@centered` argument to the `AuLoader` component
2 parents 01dfc48 + 1264653 commit eab8023

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

addon/components/au-loader.gts

+10-1
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface AuLoaderSignature {
2727
Args: {
2828
inline?: boolean;
2929
hideMessage?: boolean;
30+
centered?: boolean;
3031
// Deprecated arguments
3132
disableMessage?: boolean;
3233
message?: string;
@@ -49,9 +50,17 @@ export default class AuLoader extends Component<AuLoaderSignature> {
4950
return this.args.message || 'Aan het laden';
5051
}
5152

53+
get centered() {
54+
if (typeof this.args.centered === 'undefined' || this.args.centered) {
55+
return 'au-u-text-center';
56+
}
57+
58+
return '';
59+
}
60+
5261
<template>
5362
{{#if (has-block)}}
54-
<div class="au-c-loader au-u-text-center" role="status" ...attributes>
63+
<div class="au-c-loader {{this.centered}}" role="status" ...attributes>
5564
<LoadingAnimation />
5665
{{#if @inline}}
5766
<span

stories/5-components/Notifications/AuLoader.stories.js

+7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,11 @@ export default {
1515
control: 'boolean',
1616
description: 'Hide the loading text',
1717
},
18+
centered: {
19+
control: 'boolean',
20+
description:
21+
'Allows you to opt-out of the centered positioning. defaults to `true`',
22+
},
1823
},
1924
parameters: {
2025
layout: 'padded',
@@ -26,6 +31,7 @@ const Template = (args) => ({
2631
<AuLoader
2732
@inline={{this.inline}}
2833
@hideMessage={{this.hideMessage}}
34+
@centered={{this.centered}}
2935
>{{this.message}}</AuLoader>`,
3036
context: args,
3137
});
@@ -35,4 +41,5 @@ Component.args = {
3541
message: 'Aan het laden',
3642
inline: false,
3743
hideMessage: false,
44+
centered: true,
3845
};

0 commit comments

Comments
 (0)