Skip to content

Commit 67e3e60

Browse files
committed
Add a @centered argument to the AuLoader component
The loader is centered by default but this doesn't always look correctly for some use-cases. The `@centered` argument allows you to op-out of the default centering in case you need it.
1 parent 01dfc48 commit 67e3e60

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-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

+6
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,10 @@ export default {
1515
control: 'boolean',
1616
description: 'Hide the loading text',
1717
},
18+
centered: {
19+
control: 'boolean',
20+
description: 'The loader is centered by default, but that can be disabled by setting this to true.',
21+
},
1822
},
1923
parameters: {
2024
layout: 'padded',
@@ -26,6 +30,7 @@ const Template = (args) => ({
2630
<AuLoader
2731
@inline={{this.inline}}
2832
@hideMessage={{this.hideMessage}}
33+
@centered={{this.centered}}
2934
>{{this.message}}</AuLoader>`,
3035
context: args,
3136
});
@@ -35,4 +40,5 @@ Component.args = {
3540
message: 'Aan het laden',
3641
inline: false,
3742
hideMessage: false,
43+
centered: true,
3844
};

0 commit comments

Comments
 (0)