Skip to content

Commit 330bc96

Browse files
authored
update day-09 code references, closes #33
1 parent 6ae659c commit 330bc96

File tree

1 file changed

+28
-37
lines changed

1 file changed

+28
-37
lines changed

day-09/post.md

Lines changed: 28 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -44,25 +44,21 @@ Recall, the render function of our `Header` component currently looks like this:
4444
```javascript
4545
class Header extends React.Component {
4646
render() {
47-
// Classes to add to the <input /> element
48-
let searchInputClasses = ["searchInput"];
49-
50-
// Update the class array if the state is visible
51-
if (this.state.searchVisible) {
52-
searchInputClasses.push("active");
53-
}
54-
5547
return (
5648
<div className="header">
57-
<div className="fa fa-more"></div>
49+
<div className="menuIcon">
50+
<div className="dashTop"></div>
51+
<div className="dashBottom"></div>
52+
<div className="circle"></div>
53+
</div>
5854

5955
<span className="title">
6056
{this.props.title}
6157
</span>
6258

6359
<input
6460
type="text"
65-
className={searchInputClasses.join(' ')}
61+
className="searchInput"
6662
placeholder="Search ..." />
6763

6864
<div className="fa fa-search searchIcon"></div>
@@ -82,12 +78,20 @@ We can target the `header` by defining the styles for a `.header` class in a reg
8278
Let's fill in the styles for the `Header` class names:
8379

8480
```html
85-
.header {
81+
.demo .notificationsFrame .header {
8682
background: rgba(251, 202, 43, 1);
8783
}
88-
.header, .fa, .title, .searchIcon {
84+
.demo .notificationsFrame .header .searchIcon,
85+
.demo .notificationsFrame .header .title {
8986
color: #333333;
9087
}
88+
89+
.demo .notificationsFrame .header .menuIcon .dashTop,
90+
.demo .notificationsFrame .header .menuIcon .dashBottom,
91+
.demo .notificationsFrame .header .menuIcon .circle {
92+
background-color: #333333;
93+
}
94+
9195
```
9296

9397
<div class="demo" id="demo2"></div>
@@ -113,8 +117,7 @@ Defining styles inside a component is easy using the `style` prop. All DOM eleme
113117
For example, to add a `color` style to a `<div />` element in JSX, this might look like:
114118

115119
```javascript
116-
const style = { color: 'blue' }
117-
<div style={style}>
120+
<div style={{ color: 'blue' }}>
118121
This text will have the color blue
119122
</div>
120123
```
@@ -142,27 +145,18 @@ To update our header component to use these styles instead of depending on a CSS
142145

143146
```javascript
144147
class Header extends React.Component {
145-
// ...
146148
render() {
147-
// Classes to add to the <input /> element
148-
let searchInputClasses = ["searchInput"];
149-
150-
// Update the class array if the state is visible
151-
if (this.state.searchVisible) {
152-
searchInputClasses.push("active");
153-
}
154-
155149
const wrapperStyle = {
156-
backgroundColor: 'rgba(251, 202, 43, 1)'
157-
}
150+
backgroundColor: "rgba(251, 202, 43, 1)"
151+
};
158152

159153
const titleStyle = {
160-
color: '#111111'
161-
}
154+
color: "#111111"
155+
};
162156

163157
const menuColor = {
164-
backgroundColor: '#111111'
165-
}
158+
backgroundColor: "#111111"
159+
};
166160

167161
return (
168162
<div style={wrapperStyle} className="header">
@@ -178,16 +172,13 @@ class Header extends React.Component {
178172

179173
<input
180174
type="text"
181-
className={searchInputClasses.join(' ')}
182-
placeholder="Search ..." />
175+
className="searchInput"
176+
placeholder="Search ..."
177+
/>
183178

184-
{/* Adding an onClick handler to call the showSearch button */}
185-
<div
186-
style={titleStyle}
187-
onClick={this.showSearch.bind(this)}
188-
className="fa fa-search searchIcon"></div>
179+
<div style={titleStyle} className="fa fa-search searchIcon"></div>
189180
</div>
190-
)
181+
);
191182
}
192183
}
193184
```

0 commit comments

Comments
 (0)