Criando Componentes Estilizados
💻 Exemplo: Componentes Básicos
import styled from 'styled-components';
// Estilizar elementos HTML
const Container = styled.div`
max-width: 1200px;
margin: 0 auto;
padding: 20px;
`;
const Title = styled.h1`
font-size: 32px;
color: #333;
margin-bottom: 20px;
`;
const Card = styled.div`
background: white;
border-radius: 8px;
padding: 20px;
box-shadow: 0 2px 4px rgba(0,0,0,0.1);
`;
// Uso
function App() {
return (
<Container>
<Title>Meu Título</Title>
<Card>Conteúdo do card</Card>
</Container>
);
}
💻 Exemplo: Estender Componentes
const Button = styled.button`
padding: 10px 20px;
border: none;
border-radius: 5px;
`;
const PrimaryButton = styled(Button)`
background-color: #007bff;
color: white;
`;
const DangerButton = styled(Button)`
background-color: #dc3545;
color: white;
`;