2023-02-01 01:47:10 +01:00
|
|
|
import feather from 'feather-icons'
|
2023-01-30 02:38:45 +01:00
|
|
|
|
2023-09-28 02:50:43 +02:00
|
|
|
/** @typedef {import('feather-icons').FeatherIconNames} FeatherIconNames */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param {string} name
|
|
|
|
* @param {string} [fallback]
|
|
|
|
* @returns {string | undefined}
|
|
|
|
*/
|
2023-01-30 02:38:45 +01:00
|
|
|
export default function Icon(name, fallback) {
|
2023-02-01 01:47:10 +01:00
|
|
|
const icon =
|
2023-09-28 02:50:43 +02:00
|
|
|
feather.icons[/** @type {FeatherIconNames} */ (name.toLowerCase())] ||
|
|
|
|
(fallback && feather.icons[/** @type {FeatherIconNames} */ (fallback.toLowerCase())])
|
|
|
|
return icon?.toSvg({ width: 16, height: 16 })
|
2023-01-30 02:38:45 +01:00
|
|
|
}
|