import * as React from "react"; import { get } from "lodash"; import * as MaterialIcon from "@material-ui/icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { ComponentTypes } from "../types"; import { IconTypes, IconProps, IconSource, PluginProps } from "./types"; import { V1ObjectWrapper, convertProperties } from "../V1ObjectWrapper"; export const Icon: React.FC = ({ style = {}, properties = {}, type = IconTypes.Block, source = IconSource.MATERIAL, }) => { const IconComponent = MaterialIcon[type]; return ( {source === IconSource.MATERIAL && ( )} {source === IconSource.FONTAWESOME && ( )} ); }; const IconPluginComponent: React.FC = ({ settings }) => { const properties = convertProperties(settings.properties); return ( ); }; export const onComponentRender = (hook, payload, actions) => { if (hook.id === "webcomponent" && payload.type === ComponentTypes.ICON) { return [IconPluginComponent]; } }; export { IconTypes, IconSource }; export default Icon;