Skip to content

Commit 0568cb0

Browse files
committed
Fixing #310 by adding a blur behavior and displaying an "x" instead of the search icon when active
1 parent ded049b commit 0568cb0

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

components/navigation/navigation-style.scss

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,10 @@
120120
background:transparent;
121121
transition:color 250ms;
122122

123+
&.icon-cross {
124+
display:none;
125+
}
126+
123127
&:hover {
124128
color:getColor(white);
125129
}
@@ -147,6 +151,14 @@
147151
margin-right:0.5em;
148152
width:400px;
149153
}
154+
155+
.navigation__search-icon.icon-cross {
156+
display:block;
157+
}
158+
159+
.navigation__search-icon.icon-magnifying-glass {
160+
display:none;
161+
}
150162
}
151163
}
152164

components/navigation/navigation.jsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import Logo from '../logo/logo';
55
import './navigation-style';
66
import './search-style';
77

8+
// TODO: Maybe by updating the routing scheme later on we can avoid hardcoding this?
89
let Sections = [
910
{
1011
title: 'Concepts',
@@ -30,6 +31,7 @@ let Sections = [
3031
}
3132
];
3233

34+
// TODO: Move back to using state once we can handle algolia on our own
3335
export default class Navigation extends React.Component {
3436
render() {
3537
let { pageUrl, sections } = this.props;
@@ -67,10 +69,14 @@ export default class Navigation extends React.Component {
6769
<input
6870
type="text"
6971
className="navigation__search-input"
70-
placeholder="Search documentation…" />
72+
placeholder="Search documentation…"
73+
onBlur={ this._toggleSearch.bind(this) } />
7174
<button
7275
className="navigation__search-icon icon-magnifying-glass"
7376
onClick={ this._toggleSearch.bind(this) } />
77+
<button
78+
className="navigation__search-icon icon-cross"
79+
onClick={ this._toggleSearch.bind(this) } />
7480
</div>
7581
</Container>
7682

0 commit comments

Comments
 (0)