Skip to content

Commit

Permalink
fix(ui-library): harmonized property naming in loader and fixed misse…
Browse files Browse the repository at this point in the history
…d sizeVariant in js example text-button (#979)

Co-authored-by: Thorben Hartmann <122102805+thrbnhrtmnn@users.noreply.github.com>
  • Loading branch information
JpunktWpunkt and thrbnhrtmnn authored Mar 8, 2024
1 parent 8a57f8a commit 491bd6b
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/js-example-app/src/index.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
offset="20"
message="Message-text"
>
<blr-text-button theme="Light" variant="secondary" size="md" label="Hover me"></blr-text-button>
<blr-text-button theme="Light" variant="secondary" sizeVariant="md" label="Hover me"></blr-text-button>
</blr-tooltip>
</div>

Expand Down
2 changes: 1 addition & 1 deletion packages/ui-library/src/components/icon-button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export class BlrIconButton extends LitElement {
${this.focused && !this.loading ? html`<span class="focus-layer"></span>` : nothing}
${this.loading
? BlrLoaderRenderFunction({
size: loaderSizeVariant,
sizeVariant: loaderSizeVariant,
variant: loaderVariant,
theme: this.theme,
})
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-library/src/components/icon-link/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export class BlrIconLink extends LitElement {
>
${this.loading
? BlrLoaderRenderFunction({
size: loaderSize,
sizeVariant: loaderSize,
variant: loaderVariant,
theme: this.theme,
})
Expand Down
11 changes: 5 additions & 6 deletions packages/ui-library/src/components/loader/index.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const sharedStyles = html`
const defaultParams: BlrLoaderType = {
theme: 'Light',
variant: 'default',
size: 'md',
sizeVariant: 'md',
};

export default {
Expand All @@ -37,8 +37,7 @@ export default {
category: 'Appearance',
},
},
size: {
name: 'sizeVariant',
sizeVariant: {
description: 'Choose size of the component.',
options: FeedbackSizes,
control: { type: 'radio' },
Expand Down Expand Up @@ -94,7 +93,7 @@ export const Variant = () => {
...defaultParams,
theme: 'Light',
variant: 'default',
size: 'md',
sizeVariant: 'md',
})}
`;
};
Expand All @@ -108,7 +107,7 @@ export const Inverted = () => {
${BlrLoaderRenderFunction({
...defaultParams,
variant: 'default',
size: 'md',
sizeVariant: 'md',
})}
</div>
`;
Expand All @@ -132,7 +131,7 @@ export const SizeVariant = () => {
html`<div class="size-container">
${BlrLoaderRenderFunction({
...defaultParams,
size: size,
sizeVariant: size,
})}
</div>`
)}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-library/src/components/loader/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('blr-loader', () => {
});

it('has a size sm when "size" is set to "sm" ', async () => {
const element = await fixture(BlrLoaderRenderFunction({ ...sampleParams, size: 'sm' }));
const element = await fixture(BlrLoaderRenderFunction({ ...sampleParams, sizeVariant: 'sm' }));

const loader = querySelectorDeep('div.blr-loader', element.getRootNode() as HTMLElement);
const className = loader?.className;
Expand Down
8 changes: 4 additions & 4 deletions packages/ui-library/src/components/loader/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,24 +10,24 @@ import { ActionSizesType, FeedbackVariantType } from '../../globals/types';
export class BlrLoader extends LitElement {
static styles = [];

@property() size?: ActionSizesType = 'md';
@property() sizeVariant?: ActionSizesType = 'md';
@property() variant?: FeedbackVariantType;
@property() theme: ThemeType = 'Light';

protected render() {
if (this.size) {
if (this.sizeVariant) {
const dynamicStyles = this.theme === 'Light' ? [styleCustomLight] : [styleCustomDark];

const classes = classMap({
'blr-loader': true,
[`${this.variant}`]: this.variant || '',
[`${this.size}`]: this.size || 'md',
[`${this.sizeVariant}`]: this.sizeVariant || 'md',
});

return html`<style>
${dynamicStyles.map((style) => style)}
</style>
<div class="loader-container ${this.size}">
<div class="loader-container ${this.sizeVariant}">
<div class="${classes}" role="status" aria-live="polite"></div>
</div>`;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui-library/src/components/text-button/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export class BlrTextButton extends LitElement {
${this.loading
? html`
${BlrLoaderRenderFunction({
size: loaderSizeVariant,
sizeVariant: loaderSizeVariant,
variant: loaderVariant,
theme: this.theme,
})}
Expand Down

0 comments on commit 491bd6b

Please sign in to comment.