1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-25 06:24:19 +00:00
pds-2021-g2-nest/nest_frontend/utils/make_icon.js

17 lines
No EOL
427 B
JavaScript

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
}
}