diff --git a/src/components/Icon.tsx b/src/components/Icon.tsx index 1407dbc..ec7ef44 100644 --- a/src/components/Icon.tsx +++ b/src/components/Icon.tsx @@ -125,16 +125,19 @@ type Props = { } export function Icon({ type, className = undefined, placeholder, ...otherProps }: Props) { - if (placeholder) return
- const { name, IconComponent } = getSVGIconComponent(type) - const mergedClassName = cx('octicon', name) + let children: React.ReactNode = null + if (!placeholder) { + const { name, IconComponent } = getSVGIconComponent(type) + const mergedClassName = cx('octicon', name) + children = React.createElement(Octicon, { + icon: IconComponent, + className: mergedClassName, + verticalAlign: 'text-bottom', + }) + } return (
- {React.createElement(Octicon, { - icon: IconComponent, - className: mergedClassName, - verticalAlign: 'text-bottom', - })} + {children}
) }