import React, { useState } from 'react';
import styled from 'styled-components';
import v from '../../styles/Variables';
interface Props {
backgroundHover?: string;
callback: () => void;
fontHover?: string;
isActive?: boolean;
radius?: number;
title: string;
tooltip: boolean;
themeClass?: string;
srText: string;
}
interface ButtonStyles {
backgroundHover: string;
fontHover: string;
radius?: number;
}
const IconButton = ({ tooltip = false, callback, radius = 45, themeClass, title, backgroundHover = '#000', fontHover = '#fff', isActive = false, srText }: Props) => {
const [showTooltip, showTooltipSetter] = useState(false);
return (
callback()}
onMouseEnter={() => showTooltipSetter(true)}
onMouseLeave={() => showTooltipSetter(false)}
className={`IconButton border--none bg--offLight radius--lg text--center font--dark888 animate position--relative ${themeClass} ${isActive === true ? 'active' : null}`}
radius={radius}
backgroundHover={backgroundHover}
fontHover={fontHover}
aria-pressed={isActive}
>
{title}
{srText}
);
};
export default IconButton;
/* styles */
const ButtonWrap = styled.button`
display: inline-block;
width: ${({ radius }) => `${radius}px`};
height: ${({ radius }) => `${radius}px`};
// overflow: hidden;
line-height: ${({ radius }) => `${radius}px`};
transition: ${v.animate};
&:hover,
&.active {
background: ${({ backgroundHover }) => `${backgroundHover} !important`};
color: ${({ fontHover }) => `${fontHover} !important`};
}
`;