import styled from 'styled-components'; import { ButtonThemeProps } from './interfaces'; const common = (props: ButtonThemeProps) => ` box-sizing: border-box; border: ${props.theme.border}; border-radius: 0; cursor: pointer; font-size: 14px; line-height: 16px; white-space: normal; padding: ${props.variant === 'primary' || 'secondary' ? '10px 20px' : '0'}; min-width: 120px; min-height: 40px; text-align: center; transition: ${props.theme.transition}; color: ${props.theme.textColor}; background-color: ${props.transparent ? 'transparent' : props.theme.backgroundColor}; text-decoration: ${props.theme.textDecoration}; text-transform: ${props.theme.textTransform}; font-family: ${props.theme.fontFamily}; font-weight: ${props.theme.fontWeight}; ${props.theme.borderWidth ? `border-width: ${props.theme.borderWidth};` : ''} ${props.theme.borderStyle ? `border-style: ${props.theme.borderStyle};` : ''} ${props.theme.borderImage ? `border-image: ${props.theme.borderImage};` : ''} &:disabled { opacity: 0.3; cursor: not-allowed; } &:not(:disabled):focus, &:not(:disabled):hover { background-color: ${props.transparent ? 'transparent' : props.theme.backgroundColorHover}; border-image: ${props.theme.borderImageHover || 'initial'} ; border: ${props.variant === 'tertiary' ? 'unset' : props.theme.borderHover}; color: ${props.theme.textColorHover}; outline: none; span { color: #fff; background: none; mix-blend-mode: unset; &::before { display: none; } } } } `; const StyledButton = styled.button` ${(props: ButtonThemeProps) => common(props)}; `; export default StyledButton;