Skip to content

Commit c200b13

Browse files
committed
Extending Styles
1 parent b3e52d7 commit c200b13

File tree

2 files changed

+21
-14
lines changed

2 files changed

+21
-14
lines changed

src/App.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,5 @@ import React from 'react';
22
import Welcome from './components/Welcome'
33

44

5-
const App = () => <div className="App">
6-
<Welcome/>
7-
<Welcome name="Mauricio"/>
8-
</div>;
5+
const App = () => <div className="App"><Welcome /></div>;
96
export default App;

src/components/Welcome.jsx

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,28 @@
1-
import React from "react";
1+
import React, { Fragment } from "react";
22
import styled from "styled-components";
33

4-
const Title = styled.h1`
5-
font-size: 30px;
6-
text-align: center;
7-
color: ${props => (props.primary ? "#e95678" : "#25b0bc")}; //(C)
4+
const Button = styled.button`
5+
font-size: 14px;
6+
font-weight: 400;
7+
background-color: #4a430b;
8+
border: none;
9+
cursor: pointer;
10+
color: #ffffff;
11+
padding: 10px 20px;
12+
border-radius: 4px;
813
`;
914

10-
const Welcome = ({ name = "Stranger" }) => {
11-
const isStranger = name === "Stranger"; //(A)
15+
const Link = styled(Button)`
16+
color: #4a430b;
17+
background-color: transparent;
18+
`;
19+
20+
const Welcome = () => {
1221
return (
13-
<Title primary={isStranger}>
14-
{/* (B) */}Hello {name}
15-
</Title>
22+
<Fragment>
23+
<Button>Click me!!</Button>
24+
<Link as="a">Give me click too!!</Link>
25+
</Fragment>
1626
);
1727
};
1828

0 commit comments

Comments
 (0)