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): removed icon-link #997

Merged
merged 5 commits into from
Mar 8, 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
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,6 @@ Removing is slightly more difficult than adding, because there are multiple comp
- Form Caption
- Icon
- Icon Button
- Icon Link
- Number Input
- Select
- TabBar
Expand Down
3 changes: 1 addition & 2 deletions packages/ui-library/.storybook/.pa11yci
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
},
"urls": [
"http://localhost:1337/iframe.html?id=blriconbutton--blr-icon-button&viewMode=story",
"http://localhost:1337/iframe.html?id=blriconlink--blr-icon-link&viewMode=story",
"http://localhost:1337/iframe.html?id=blricon--blr-icon&viewMode=story",
"http://localhost:1337/iframe.html?id=blrloader--blr-loader&viewMode=story",
"http://localhost:1337/iframe.html?id=blrradio--blr-radio-group&viewMode=story",
Expand All @@ -21,4 +20,4 @@
"http://localhost:1337/iframe.html?id=blrtextinput--blr-text-input&viewMode=story",
"http://localhost:1337/iframe.html?id=blrtextbutton--blr-text-button&args=icon:boilerChevronDownGreen&viewMode=story"
]
}
}
21 changes: 0 additions & 21 deletions packages/ui-library/src/components/icon-link/index.css.ts

This file was deleted.

58 changes: 0 additions & 58 deletions packages/ui-library/src/components/icon-link/index.stories.ts

This file was deleted.

47 changes: 0 additions & 47 deletions packages/ui-library/src/components/icon-link/index.test.ts

This file was deleted.

96 changes: 0 additions & 96 deletions packages/ui-library/src/components/icon-link/index.ts
Original file line number Diff line number Diff line change
@@ -1,96 +0,0 @@
import { LitElement, html, nothing } from 'lit';
import { classMap } from 'lit/directives/class-map.js';
import { property } from 'lit/decorators.js';
import { SizelessIconType } from '@boiler/icons';
import { styleCustom as iconLinkStyleCustom } from './index.css';
import { styleCustom as iconButtonStyleCustom } from '../icon-button/index.css';
import { ThemeType } from '../../foundation/_tokens-generated/index.themes';
import { actionLight, actionDark } from '../../foundation/semantic-tokens/action.css';
import { ActionVariantType, ActionSizesType, FormSizesType, SizesType } from '../../globals/types';
import { calculateIconName } from '../../utils/calculate-icon-name';
import { determineLoaderVariant } from '../../utils/determine-loader-variant';
import { getComponentConfigToken } from '../../utils/get-component-config-token';
import { BlrIconRenderFunction } from '../icon/renderFunction';
import { BlrLoaderRenderFunction } from '../loader/renderFunction';
import { TAG_NAME } from './renderFunction';

//
export class BlrIconLink extends LitElement {
static styles = [iconLinkStyleCustom, iconButtonStyleCustom];

@property() arialabel?: string;
@property() icon?: SizelessIconType;
@property() href?: string;
@property() target?: string;
@property() onClick?: HTMLLinkElement['onclick'];
@property() onBlur?: HTMLLinkElement['onblur'];
@property() linkId?: string;
@property() variant: ActionVariantType = 'primary';
@property() size?: ActionSizesType = 'md';
@property() loading!: boolean;
@property() theme: ThemeType = 'Light';

protected render() {
if (this.size) {
const classes = classMap({
[`${this.variant}`]: this.variant,
[`${this.size}`]: this.size,
});

const dynamicStyles = this.theme === 'Light' ? [actionLight] : [actionDark];
const loaderVariant = determineLoaderVariant(this.variant);

const loaderSize = getComponentConfigToken([
'sem',
'buttons',
'loader',
'sizevariant',
this.size,
]).toLowerCase() as FormSizesType;

const iconSizeVariant = getComponentConfigToken([
'cmp',
'IconButton',
'Icon',
'SizeVariant',
this.size.toUpperCase(),
]).toLowerCase() as SizesType;

return html`<style>
${dynamicStyles.map((style) => style)}
</style>
<a
aria-label=${this.arialabel}
class="blr-semantic-action blr-icon-link blr-icon-button ${classes}"
href=${this.href}
loading=${this.loading}
target=${this.target}
@click=${this.onClick}
@blur=${this.onBlur}
id=${this.linkId || nothing}
>
${this.loading
? BlrLoaderRenderFunction({
sizeVariant: loaderSize,
variant: loaderVariant,
theme: this.theme,
})
: BlrIconRenderFunction(
{
icon: calculateIconName(this.icon, iconSizeVariant),
sizeVariant: iconSizeVariant,
},
{
'aria-hidden': true,
}
)}
</a>`;
}
}
}

if (!customElements.get(TAG_NAME)) {
customElements.define(TAG_NAME, BlrIconLink);
}

export type BlrIconLinkType = Omit<BlrIconLink, keyof LitElement>;
13 changes: 0 additions & 13 deletions packages/ui-library/src/components/icon-link/indexReact.ts

This file was deleted.

This file was deleted.

1 change: 0 additions & 1 deletion packages/ui-library/src/components/icon/index.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export default {
- [**Text Input**](?path=/docs/components-text-input--docs)
- [**Toggle Switch**](?path=/docs/components-toggle-switch--docs)
- [**Tab Bar**](?path=/docs/components-tabbar--docs)
- [**Icon Link**](?path=/docs/components-icon-link--docs)
- [**Number Input**](?path=/docs/components-number-input--docs)

It is not intended to use the Icon directly when creating new applications.
Expand Down
2 changes: 0 additions & 2 deletions packages/ui-library/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,5 +53,3 @@ export { BlrButtonGroup } from './components/button-group';
export { BlrDivider } from './components/divider';

export { BlrIcon } from './components/icon';

export { BlrIconLink } from './components/icon-link';
Loading