Skip to content

Commit

Permalink
docs(svg): replace xlinkHref with href in multiple examples
Browse files Browse the repository at this point in the history
  • Loading branch information
secundant committed Jul 24, 2023
1 parent d61f02b commit 4a817c9
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export function Icon({ name, className, viewBox, ...props }: IconProps) {
aria-hidden
{...props}
>
<use xlinkHref={`/${spriteName}.svg#${iconName}`} />
<use href={`/${spriteName}.svg#${iconName}`} />
</svg>
);
}
2 changes: 1 addition & 1 deletion examples/svg-next/src/shared/ui/icon/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export function Icon({ name, className, viewBox, ...props }: IconProps) {
aria-hidden
{...props}
>
<use xlinkHref={`/sprite.svg#${name}`} />
<use href={`/sprite.svg#${name}`} />
</svg>
);
}
2 changes: 1 addition & 1 deletion examples/svg-vite/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export function Icon({ name, className, viewBox, ...props }: IconProps) {
aria-hidden
{...props}
>
<use xlinkHref={`/${spriteName}.svg#${iconName}`} />
<use href={`/${spriteName}.svg#${iconName}`} />
</svg>
);
}
Expand Down
6 changes: 3 additions & 3 deletions examples/svg-vite/src/shared/ui/icon/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export interface IconProps extends Omit<SVGProps<SVGSVGElement>, 'name' | 'type'
name: IconName;
}

export function Icon({ name, className, viewBox: viewBoxFromProps, ...props }: IconProps) {
export function Icon({ name, className, ...props }: IconProps) {
const [spriteName, iconName] = name.split('/') as [
keyof SpritesMap,
SpritesMap[keyof SpritesMap]
Expand All @@ -22,12 +22,12 @@ export function Icon({ name, className, viewBox: viewBoxFromProps, ...props }: I
return (
<svg
className={clsx('icon', className)}
viewBox={viewBoxFromProps ?? viewBox}
viewBox={viewBox}
focusable="false"
aria-hidden
{...props}
>
<use xlinkHref={`/${filePath}#${iconName}`} />
<use href={`/${filePath}#${iconName}`} />
</svg>
);
}
2 changes: 1 addition & 1 deletion libs/svg/examples/react/icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function Icon({ name, className, viewBox, ...props }: IconProps) {
aria-hidden
{...props}
>
<use xlinkHref={`/path/to/sprites/${spriteName}.svg#${iconName}`} />
<use href={`/path/to/sprites/${spriteName}.svg#${iconName}`} />
</svg>
);
}

0 comments on commit 4a817c9

Please sign in to comment.