const Button = styled.button`
background-color: ${props =>
props.primary ? '#007bff' : '#6c757d'};
color: white;
padding: ${props => props.large ? '15px 30px' : '10px 20px'};
font-size: ${props => props.large ? '18px' : '16px'};
border: none;
border-radius: 5px;
`;
// Uso
<Button primary>Primário</Button>
<Button large>Grande</Button>
<Button primary large>Primário Grande</Button>
import { ThemeProvider } from 'styled-components';
const theme = {
colors: {
primary: '#007bff',
secondary: '#6c757d',
success: '#28a745'
},
spacing: {
sm: '10px',
md: '20px',
lg: '40px'
}
};
const Button = styled.button`
background-color: ${props => props.theme.colors.primary};
padding: ${props => props.theme.spacing.md};
`;
function App() {
return (
<ThemeProvider theme={theme}>
<Button>Botão</Button>
</ThemeProvider>
);
}