Attrs
import styled from 'styled-components';
type ButtonProps = {
type ?: 'button' | 'submit' | 'reset'
active : boolean
}
const Button = styled.button.attrs<ButtonProps>((props) => ({
type: props.type ?? 'button',
}))<ButtonProps>`
background:#FFF;
color:#000;
border:1px solid #888;
/* background:#fff; */
${(props) => props.active && css`
background:#f00;
color:#fff;
`}
`;
// 상속
const PrimaryButton = styled(Button)`
background:#fff;
${(props) => props.active && css`
background:#000;
color:#fff;
`}
`
export default Button;Last updated