Skip to content

Commit 6c91876

Browse files
author
Horacio Herrera
committed
prepare styled-variants exercise
1 parent 2b09bdf commit 6c91876

File tree

2 files changed

+12
-24
lines changed

2 files changed

+12
-24
lines changed

src/components/patterns/Variants/exercise/index.js

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,33 @@
11
import React from "react";
22
import styled, { ThemeProvider } from "styled-components";
33
import theme from "./theme";
4-
import { variant } from 'styled-system'
4+
// import { variant } from 'styled-system'
55

6-
const alertStyle = variant({
7-
key: 'alertStyles'
8-
})
6+
// TODO: create a variant called `alertStyle`
7+
/*
8+
in order to add these new variant styles to your component,
9+
you need to add it to your styles AT THE END.
10+
11+
*if you have questions why at the end ask us!
12+
*/
913

1014
const Alert = styled("div")`
1115
border-radius: 8px;
1216
padding: 8px;
13-
box-shadow: 0 2px 1px -1px rgba(0,0,0,.2), 0 1px 1px 0 rgba(0,0,0,.14), 0 1px 3px 0 rgba(0,0,0,.12);
17+
box-shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2), 0 1px 1px 0 rgba(0, 0, 0, 0.14),
18+
0 1px 3px 0 rgba(0, 0, 0, 0.12);
1419
font-size: 18px;
1520
margin: 24px;
1621
font-weight: 800;
1722
text-align: center;
18-
${alertStyle}
1923
`;
2024

2125
const Wrapper = styled("div")`
2226
background-color: ${props => props.theme.colors.background};
2327
padding: 40px;
2428
`;
2529

30+
// TODO: here you have hints on how the variants should be named...
2631
const VariantsExercise = () => (
2732
<ThemeProvider theme={theme}>
2833
<Wrapper>

src/components/patterns/Variants/exercise/theme.js

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,7 @@ const theme = {
44
secondary: "#f6f6ff",
55
background: "papayawhip"
66
},
7-
alertStyles: {
8-
default: {
9-
backgroundColor: "#f6f6ff",
10-
color: "#00f"
11-
},
12-
success: {
13-
backgroundColor: "#a4d167",
14-
color: '#fff'
15-
},
16-
warning: {
17-
backgroundColor: "#eecd02",
18-
color: '#000'
19-
},
20-
error: {
21-
backgroundColor: "#f00",
22-
color: "#fff"
23-
}
24-
}
7+
// add some variants for your alerts here
258
}
269

2710
export default theme;

0 commit comments

Comments
 (0)