1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2024-11-22 21:14:18 +00:00
pds-2021-g2-nest/nest_frontend/utils/make_icon.js

17 lines
427 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)) {
2021-05-11 14:37:15 +00:00
return <span className={className}>icon</span>
2021-04-21 01:57:18 +00:00
}
else if(icon) {
return (
<span className={className}><FontAwesomeIcon icon={icon}/></span>
)
}
else {
2021-05-11 14:37:15 +00:00
return null
2021-04-21 01:57:18 +00:00
}
}