Path: blob/1.0-develop/resources/scripts/components/elements/Icon.tsx
7461 views
import React, { CSSProperties } from 'react';1import { IconDefinition } from '@fortawesome/fontawesome-svg-core';2import tw from 'twin.macro';34interface Props {5icon: IconDefinition;6className?: string;7style?: CSSProperties;8}910const Icon = ({ icon, className, style }: Props) => {11const [width, height, , , paths] = icon.icon;1213return (14<svg15xmlns={'http://www.w3.org/2000/svg'}16viewBox={`0 0 ${width} ${height}`}17css={tw`fill-current inline-block`}18className={className}19style={style}20>21{(Array.isArray(paths) ? paths : [paths]).map((path, index) => (22<path key={`svg_path_${index}`} d={path} />23))}24</svg>25);26};2728export default Icon;293031