-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathindex.js
More file actions
35 lines (32 loc) · 862 Bytes
/
index.js
File metadata and controls
35 lines (32 loc) · 862 Bytes
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
32
33
34
35
import React from 'react';
import { createComponent, ThemeProvider, applyTheme } from 'cf-style-container';
const Square = createComponent(({ theme }) => ({
height: '5em',
width: '5em',
backgroundColor: theme.backgroundColor,
border: theme.border,
color: theme.color,
padding: '2rem',
margin: 5
}));
const MySquare = applyTheme(
Square,
theme => ({
backgroundColor: theme.color
}),
{ color: 'white' },
{ border: '10px dotted blue' }
);
export default () =>
<article>
<h1>14. Themes</h1>
<ThemeProvider theme={{ color: 'red', border: '5px solid black' }}>
<div>
<ThemeProvider theme={{ color: 'blue' }}>
<Square>Something</Square>
</ThemeProvider>
<Square>Something different</Square>
<MySquare>Something different</MySquare>
</div>
</ThemeProvider>
</article>;