-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Responsive text search, layout, toggles.
- Loading branch information
1 parent
085b083
commit a145464
Showing
28 changed files
with
825 additions
and
283 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import React from "react"; | ||
|
||
const CrossLarge = props => ( | ||
<svg width={14} height={14} viewBox="0 0 14 14" fill="none" {...props}> | ||
<path | ||
d="M1 13l5.984-6M13 13L7.016 7M13 1L7.016 7M1 1l5.984 6" | ||
stroke="currentColor" | ||
strokeMiterlimit={10} | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
</svg> | ||
); | ||
|
||
export default CrossLarge; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
import React, { Component } from "react"; | ||
|
||
import MagnifyingGlass from "./MagnifyingGlass"; | ||
import CrossLarge from "./CrossLarge"; | ||
|
||
class MobileSearch extends Component { | ||
constructor(props) { | ||
super(props); | ||
this.state = { | ||
searchFieldValue: "", | ||
searchFieldPlaceholder: "Rechercher" | ||
}; | ||
this.handleSearchFieldChange = this.handleSearchFieldChange.bind(this); | ||
this.handleSearchFieldFocus = this.handleSearchFieldFocus.bind(this); | ||
this.handleSearchFieldBlur = this.handleSearchFieldBlur.bind(this); | ||
this.handleFullTextSearch = this.handleFullTextSearch.bind(this); | ||
this.handleReset = this.handleReset.bind(this); | ||
} | ||
handleSearchFieldChange(ev) { | ||
this.setState({ searchFieldValue: ev.target.value }); | ||
} | ||
handleSearchFieldFocus(ev) { | ||
this.setState({ searchFieldPlaceholder: "mot-clé, date, artiste…" }); | ||
} | ||
handleSearchFieldBlur(ev) { | ||
this.setState({ searchFieldPlaceholder: "Rechercher" }); | ||
} | ||
handleFullTextSearch(ev) { | ||
ev.preventDefault(); | ||
console.log("search now"); | ||
} | ||
handleReset(ev) { | ||
ev.preventDefault(); | ||
this.setState({ searchFieldValue: "" }); | ||
} | ||
componentDidMount() { | ||
document.documentElement.classList.add("prevent-scroll"); | ||
this.searchFieldRef.focus(); | ||
} | ||
componentWillUnmount() { | ||
document.documentElement.classList.remove("prevent-scroll"); | ||
} | ||
render() { | ||
return ( | ||
<div className="MobileSearch"> | ||
<div | ||
className="MobileSearch__overlay" | ||
onClick={this.props.onCloseSearch} | ||
/> | ||
<div className="MobileSearch__controls"> | ||
<form | ||
className="MobileSearch__form" | ||
onSubmit={this.handleFullTextSearch} | ||
action="#" | ||
> | ||
<div className="MobileSearch__search"> | ||
<button type="submit"> | ||
<MagnifyingGlass /> | ||
</button> | ||
</div> | ||
<div className="MobileSearch__input"> | ||
<input | ||
placeholder={this.state.searchFieldPlaceholder} | ||
type="search" | ||
value={this.state.searchFieldValue} | ||
onChange={this.handleSearchFieldChange} | ||
onFocus={this.handleSearchFieldFocus} | ||
onBlur={this.handleSearchFieldBlur} | ||
ref={elRef => { | ||
this.searchFieldRef = elRef; | ||
}} | ||
/> | ||
</div> | ||
<div className="MobileSearch__cancel"> | ||
<button type="reset" onClick={this.handleReset}> | ||
<CrossLarge /> | ||
</button> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default MobileSearch; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
.MobileSearch { | ||
position: fixed; | ||
top: 0; | ||
bottom: 0; | ||
left: 0; | ||
right: 0; | ||
height: 100%; | ||
width: 100%; | ||
z-index: 2; | ||
} | ||
.MobileSearch__overlay { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
right: 0; | ||
bottom: 0; | ||
background-color: rgba(0, 0, 0, 0.3); | ||
} | ||
.MobileSearch__controls { | ||
position: relative; | ||
z-index: 1; | ||
} | ||
|
||
.MobileSearch__form { | ||
display: flex; | ||
height: 62px; | ||
padding: 0; | ||
margin: 0; | ||
background-color: #fff; | ||
flex-flow: row nowrap; | ||
justify-content: flex-start; | ||
align-items: center; | ||
} | ||
.MobileSearch__input { | ||
flex: 1 1 auto; | ||
|
||
& input { | ||
padding: 0; | ||
margin: 0; | ||
display: block; | ||
width: 100%; | ||
height: 35px; | ||
background-color: transparent; | ||
border: 0; | ||
|
||
@include f-serif; | ||
font-size: rem(16px); | ||
line-height: rem(35px); | ||
} | ||
} | ||
.MobileSearch__search, | ||
.MobileSearch__cancel { | ||
flex: 0 0 50px; | ||
width: 50px; | ||
height: 50px; | ||
|
||
& button { | ||
display: flex; | ||
flex-flow: column; | ||
justify-content: center; | ||
align-items: center; | ||
height: 50px; | ||
width: 50px; | ||
background-color: #fff; | ||
border: none; | ||
margin: 0; | ||
padding: 0; | ||
} | ||
} | ||
.MobileSearch__search svg { | ||
position: relative; | ||
left: -2px; | ||
} | ||
.MobileSearch__cancel svg { | ||
position: relative; | ||
right: -3px; | ||
} |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.