import React, { FC } from "react"; import styled, { css } from "styled-components"; import CSS from "csstype"; type IconNames = "copy" | "download" | "fileinput"; export interface IconProps { style?: CSS.Properties; iconName: IconNames; onClick: () => void; } const Icon: FC = ({ style, iconName, onClick }) => { const generateIcon = (iconName: IconNames) => { if (iconName === "download") { return ( ); } if (iconName === "copy") { return ( ); } if (iconName === "fileinput") { return ( ); } }; return ( {generateIcon(iconName)} ); }; export default Icon; const StyledSpan = styled.span` position: absolute; top: calc(50% - 1rem); right: 1.5rem; z-index: 100; width: 3rem; height: 3rem; font-size: 1.6rem; cursor: pointer; color: black; ${(props) => props.iconName === "download" && css` color: white; `} `;