import React, {useState} from "react";
import { Wrapper, Text, Image } from "./style";
import { history } from "../../utils/history";

const Tab = ({label, icon, url}) => {
    const [isActive, setIsActive] = useState(history.location.pathname === url);

    return (
        <Wrapper active={isActive}>
            <Image src={icon} alt="icon" />
            <Text>{label}</Text>
        </Wrapper>
    );
};

export default Tab;
