summaryrefslogtreecommitdiff
path: root/preact/demo/styled-components.js
blob: f8433ba15180573188429f56b1b96caceff1b191 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import { createElement } from 'preact';
import styled, { css } from 'styled-components';

const Button = styled.button`
	background: transparent;
	border-radius: 3px;
	border: 2px solid palevioletred;
	color: palevioletred;
	margin: 0.5em 1em;
	padding: 0.25em 1em;

	${props =>
		props.primary &&
		css`
			background: palevioletred;
			color: white;
		`}
`;

const Container = styled.div`
	text-align: center;
`;

export default function StyledComp() {
	return (
		<Container>
			<Button>Normal Button</Button>
			<Button primary>Primary Button</Button>
		</Container>
	);
}