Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a @centered argument to the AuLoader component #473

Merged
merged 1 commit into from
Feb 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion addon/components/au-loader.gts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export interface AuLoaderSignature {
Args: {
inline?: boolean;
hideMessage?: boolean;
centered?: boolean;
// Deprecated arguments
disableMessage?: boolean;
message?: string;
Expand All @@ -49,9 +50,17 @@ export default class AuLoader extends Component<AuLoaderSignature> {
return this.args.message || 'Aan het laden';
}

get centered() {
if (typeof this.args.centered === 'undefined' || this.args.centered) {
return 'au-u-text-center';
}

return '';
}

<template>
{{#if (has-block)}}
<div class="au-c-loader au-u-text-center" role="status" ...attributes>
<div class="au-c-loader {{this.centered}}" role="status" ...attributes>
<LoadingAnimation />
{{#if @inline}}
<span
Expand Down
7 changes: 7 additions & 0 deletions stories/5-components/Notifications/AuLoader.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ export default {
control: 'boolean',
description: 'Hide the loading text',
},
centered: {
control: 'boolean',
description:
'Allows you to opt-out of the centered positioning. defaults to `true`',
},
},
parameters: {
layout: 'padded',
Expand All @@ -26,6 +31,7 @@ const Template = (args) => ({
<AuLoader
@inline={{this.inline}}
@hideMessage={{this.hideMessage}}
@centered={{this.centered}}
>{{this.message}}</AuLoader>`,
context: args,
});
Expand All @@ -35,4 +41,5 @@ Component.args = {
message: 'Aan het laden',
inline: false,
hideMessage: false,
centered: true,
};
Loading