misc_pterodactyl-panel/resources/scripts/components/elements/Icon.tsx

30 lines
787 B
TypeScript
Raw Normal View History

2020-10-15 03:13:36 +00:00
import React, { CSSProperties } from 'react';
import { IconDefinition } from '@fortawesome/fontawesome-svg-core';
import tw from 'twin.macro';
interface Props {
icon: IconDefinition;
className?: string;
style?: CSSProperties;
}
const Icon = ({ icon, className, style }: Props) => {
2022-06-26 19:30:05 +00:00
const [width, height, , , paths] = icon.icon;
2020-10-15 03:13:36 +00:00
return (
<svg
xmlns={'http://www.w3.org/2000/svg'}
viewBox={`0 0 ${width} ${height}`}
css={tw`fill-current inline-block`}
className={className}
style={style}
>
2022-06-26 19:30:05 +00:00
{(Array.isArray(paths) ? paths : [paths]).map((path, index) => (
<path key={`svg_path_${index}`} d={path} />
2020-10-15 03:13:36 +00:00
))}
</svg>
);
};
export default Icon;