1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-23 05:24:18 +00:00
pds-2021-g2-nest/code/frontend/src/utils/make_icon.js

17 lines
429 B
JavaScript
Raw Normal View History

2021-04-21 01:57:18 +00:00
import React, { isValidElement } from "react"
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"
export default function make_icon(icon, className) {
if(isValidElement(icon)) {
return <span className={className}>icon</span>;
}
else if(icon) {
return (
<span className={className}><FontAwesomeIcon icon={icon}/></span>
)
}
else {
return null;
}
}