mirror of
https://github.com/xibyte/jsketcher
synced 2025-12-09 18:02:50 +01:00
16 lines
No EOL
628 B
TypeScript
16 lines
No EOL
628 B
TypeScript
import { DeclaredIcon, getSizeInPx } from 'cad/icons/DeclarativeIcon';
|
|
import { IconDeclaration } from 'cad/icons/IconDeclaration';
|
|
import React from 'react';
|
|
import { AiOutlineQuestion } from 'react-icons/ai';
|
|
import { IconType } from 'react-icons/lib';
|
|
|
|
export function resolveIcon(iconDef: IconDeclaration | IconType) {
|
|
if (iconDef.iconType || iconDef.iconSet) {
|
|
return (props) => <DeclaredIcon {...iconDef} {...props}/>
|
|
} else {
|
|
if (!iconDef || typeof(iconDef) !== 'object') {
|
|
return size => <AiOutlineQuestion size={getSizeInPx(size)}/>;
|
|
}
|
|
return iconDef;
|
|
}
|
|
} |