Answers for "switch case styled components"

0

switch case styled components

import { Feather } from '@expo/vector-icons';

type IconProps = {
    type: "up" | "down" | "total";
}

const handleColorType = ({ type }: IconProps ) => {
    switch (type) {
        case "up":
            return '#12A454';
        case "down":
            return '#E83F5B';
        case "total":
            return '#363F5F';
        default:
            return "#fff";
    }
};

export const Icon = styled(Feather) <IconProps>`
    color: ${({ type }) => handleColorType({ type })}
`;
Posted by: Guest on July-24-2021

Code answers related to "TypeScript"

Browse Popular Code Answers by Language