jsketcher/modules/ui/components/Fa.tsx
2020-06-09 21:52:49 -07:00

23 lines
No EOL
499 B
TypeScript

import React from 'react';
import cx from 'classnames';
export default function Fa({icon, fw, fa, stack, className, ...props}: {
icon: string,
fw?: boolean,
fa?: string[],
stack?: string,
className?: string,
props?: any
}) {
let faCss = fa ? fa.map(s => 'fa-' + s) : [];
if (icon) {
icon = 'fa-' + icon;
}
if (fw) {
faCss.push('fa-fw');
}
if (stack) {
faCss.push('fa-stack-' + stack);
}
return <i className={ cx('fa', icon, faCss, className) } {...props}/>
}