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

fix(ui-library): harmonized property naming in loader and fixed misse… #979

Merged
merged 2 commits into from
Mar 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
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
Loading