-
Notifications
You must be signed in to change notification settings - Fork 19
refactor(icon): remove disableSvgIcons from ´provideIconConfig()` o…
#2239
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,18 +17,12 @@ import { IconService } from './si-icons'; | |
| /** | ||
| * Global configuration for icons. | ||
| */ | ||
| export interface IconConfig { | ||
| /** | ||
| * If true, the si-icon component will always render the icon font instead of the svg. | ||
| * | ||
| * @defaultValue false | ||
| */ | ||
| disableSvgIcons?: boolean; | ||
| } | ||
| // eslint-disable-next-line @typescript-eslint/no-empty-object-type | ||
| export interface IconConfig {} | ||
|
|
||
| const ICON_CONFIG = new InjectionToken<IconConfig>('ICON_CONFIG', { | ||
| providedIn: 'root', | ||
| factory: () => ({ disableSvgIcons: false }) | ||
| factory: () => ({}) | ||
| }); | ||
|
Comment on lines
+20
to
26
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since Unless there are plans to introduce other configuration options in the near future, please consider removing the configuration infrastructure entirely:
|
||
|
|
||
| /** | ||
|
|
@@ -82,11 +76,10 @@ export class SiIconComponent { | |
| */ | ||
| readonly icon = input.required<string>(); | ||
|
|
||
| private readonly config = inject(ICON_CONFIG); | ||
| private readonly iconService = inject(IconService); | ||
|
|
||
| protected readonly svgIcon = computed(() => { | ||
| const icon = this.config.disableSvgIcons ? undefined : this.iconService.getIcon(this.icon()); | ||
| const icon = this.iconService.getIcon(this.icon()); | ||
| if (!icon) { | ||
| return undefined; | ||
| } | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.