Skip to content

Commit

Permalink
Fix types of icon component passed to au-icon
Browse files Browse the repository at this point in the history
  • Loading branch information
piemonkey committed Mar 20, 2024
1 parent 56069b1 commit 5780b3d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions addon/components/au-accordion.gts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { tracked } from '@glimmer/tracking';
import { modifier } from 'ember-modifier';
import AuButton from './au-button';
import AuContent from './au-content';
import AuIcon from './au-icon';
import AuIcon, { type AuIconSignature } from './au-icon';
import AuLoader from './au-loader';
import AuToolbar from './au-toolbar';

Expand All @@ -16,8 +16,8 @@ const autofocus = modifier(function autofocus(element: HTMLElement) {
export interface AuAccordionSignature {
Args: {
buttonLabel?: string;
iconClosed?: string;
iconOpen?: string;
iconClosed?: AuIconSignature['Args']['icon'];
iconOpen?: AuIconSignature['Args']['icon'];
isOpenInitially?: boolean;
loading?: boolean;
reverse?: boolean;
Expand Down
6 changes: 3 additions & 3 deletions addon/components/au-icon.gts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ export interface AuIconSignature {
alignment?: 'left' | 'right';
// TODO: We should deprecate the non-boolean versions since there is no reason to support them
ariaHidden?: boolean | 'true' | 'false';
icon: string | ComponentLike<Record<string, never>>;
icon: string | ComponentLike<{ Element: Element }>;
size?: 'large';
};
Element: SVGSVGElement;
Element: Element;
}

export default class AuIcon extends Component<AuIconSignature> {
Expand Down Expand Up @@ -47,10 +47,10 @@ export default class AuIcon extends Component<AuIconSignature> {
<template>
{{#if this.iconComponent}}
{{#let this.iconComponent as |Icon|}}
{{! @glint-expect-error: glint doesn't like us setting attributes on the passed component }}
<Icon
class="au-c-icon {{this.alignment}} {{this.size}}"
aria-hidden={{this.ariaHidden}}
...attributes
/>
{{/let}}
{{else}}
Expand Down
4 changes: 2 additions & 2 deletions addon/components/au-link-external.gts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Component from '@glimmer/component';
import AuIcon from './au-icon';
import AuIcon, { type AuIconSignature } from './au-icon';

const SKIN_CLASSES = {
primary: 'au-c-link',
Expand All @@ -12,7 +12,7 @@ const SKIN_CLASSES = {
export interface AuLinkExternalSignature {
Args: {
hideText?: boolean;
icon?: string;
icon?: AuIconSignature['Args']['icon'];
iconAlignment?: 'left' | 'right';
skin?:
| 'primary'
Expand Down

0 comments on commit 5780b3d

Please sign in to comment.