Skip to content

Commit 4954463

Browse files
committed
styled-components and ThemeProvider
1 parent 427e88a commit 4954463

File tree

1 file changed

+16
-14
lines changed

1 file changed

+16
-14
lines changed

src/components/Component.jsx

Lines changed: 16 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useContext } from "react";
22
import ThemeContext from "../contexts/theme";
3-
import styled from "styled-components";
3+
import styled, { ThemeProvider } from "styled-components";
44

55
const Wrapper = styled.div`
66
padding: 40px;
@@ -45,19 +45,21 @@ const Component = props => {
4545
const { theme } = useContext(ThemeContext);
4646

4747
return (
48-
<Wrapper theme={theme}>
49-
<Title>Example component CSS</Title>
50-
<Paragraph>
51-
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Ducimus,
52-
temporibus labore voluptatibus aspernatur illo ad id sit nulla, a atque
53-
doloribus itaque ab? Soluta, exercitationem illum provident quod iure
54-
numquam?
55-
</Paragraph>
56-
<Button theme={theme}>I'm a button</Button>
57-
<Link href="/#" onClick={e => e.preventDefault()} theme={theme}>
58-
I'm a link
59-
</Link>
60-
</Wrapper>
48+
<ThemeProvider theme={theme}>
49+
<Wrapper>
50+
<Title>Example component CSS</Title>
51+
<Paragraph>
52+
Lorem ipsum, dolor sit amet consectetur adipisicing elit. Ducimus,
53+
temporibus labore voluptatibus aspernatur illo ad id sit nulla, a
54+
atque doloribus itaque ab? Soluta, exercitationem illum provident quod
55+
iure numquam?
56+
</Paragraph>
57+
<Button>I'm a button</Button>
58+
<Link href="/#" onClick={e => e.preventDefault()}>
59+
I'm a link
60+
</Link>
61+
</Wrapper>
62+
</ThemeProvider>
6163
);
6264
};
6365

0 commit comments

Comments
 (0)