Skip to content

Commit

Permalink
Responsive text search, layout, toggles.
Browse files Browse the repository at this point in the history
  • Loading branch information
nedbaldessin committed Mar 18, 2019
1 parent 085b083 commit a145464
Show file tree
Hide file tree
Showing 28 changed files with 825 additions and 283 deletions.
823 changes: 578 additions & 245 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
"hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"prod": "npm run production",
"production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"svgr": "svgr --ext=jsx -d resources/assets/js resources/assets/js"
"svgr": "svgr --svgo-config=\"svgo.json\" --ext=jsx -d resources/assets/js resources/assets/js"
},
"devDependencies": {
"@svgr/cli": "^2.1.1",
"@svgr/cli": "^2.4.1",
"axios": "^0.18",
"babel-preset-react": "^6.24.1",
"bootstrap": "^4.0.0",
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/Collection/ArrowDown.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";

const ArrowDown = props => (
<svg width={19} height={19} fill="none" {...props}>
<svg width={19} height={19} viewBox="0 0 19 19" fill="none" {...props}>
<path
d="M18.343 10.364a.5.5 0 1 0-.686-.728l.686.728zM9.18 17.636a.5.5 0 1 0 .687.728l-.687-.728zm-7.836-8a.5.5 0 0 0-.686.728l.686-.728zm7.791 8.728a.5.5 0 1 0 .687-.728l-.687.728zM10 .5a.5.5 0 0 0-1 0h1zm-1 17a.5.5 0 0 0 1 0H9zm8.657-7.864l-8.478 8 .687.728 8.477-8-.686-.728zm-17 .728l8.477 8 .687-.728-8.478-8-.686.728zM9 .5v17h1V.5H9z"
fill="currentColor"
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/Collection/Filters/Cross.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";

const Cross = props => (
<svg width={8} height={8} fill="none" {...props}>
<svg width={8} height={8} viewBox="0 0 8 8" fill="none" {...props}>
<path
d="M7 1L4.009 3.904M1 1l2.991 2.905M1 7.005L3.991 4.1M7 7.005L4.009 4.1"
stroke="#000"
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/Collection/Filters/Cross.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions resources/assets/js/Collection/Filters/CrossLarge.jsx
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;
6 changes: 6 additions & 0 deletions resources/assets/js/Collection/Filters/CrossLarge.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
31 changes: 29 additions & 2 deletions resources/assets/js/Collection/Filters/FilterPanelMobile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,29 @@ import CriteriaPhrase from "./CriteriaPhrase";
import MnLogo from "./MnLogo";
import MagnifyingGlass from "./MagnifyingGlass";
import ScrollToTop from "../ScrollToTop";
import MobileSearch from "./MobileSearch";

class FilterPanelMobile extends Component {
constructor(props) {
super(props);
this.state = {};
this.state = {
currentMode: "default"
};

this.activateSearchMode = this.activateSearchMode.bind(this);
this.handleCloseSearch = this.handleCloseSearch.bind(this);
}

activateSearchMode() {
this.setState({
currentMode: "search"
});
}

handleCloseSearch() {
this.setState({
currentMode: "default"
});
}

render() {
Expand Down Expand Up @@ -44,14 +62,23 @@ class FilterPanelMobile extends Component {
</div>
</div>
</Headroom>

{this.state.currentMode === "search" ? (
<MobileSearch onCloseSearch={this.handleCloseSearch} />
) : null}

<div className="FilterPanelMobile__toggles">
<div className="FilterPanelMobile__toggleholder FilterPanelMobile__toggleholder--left">
<button type="button" className="FilterPanelMobile__filterbutton">
Filtrer
</button>
</div>
<div className="FilterPanelMobile__toggleholder FilterPanelMobile__toggleholder--center">
<button type="button" className="FilterPanelMobile__searchicon">
<button
type="button"
className="FilterPanelMobile__searchicon"
onClick={this.activateSearchMode}
>
<MagnifyingGlass width={20} height={20} />
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
.FilterPanelMobile__toggles {
width: 100%;
position: fixed;
bottom: 50px;
bottom: 30px;
left: 0;
right: 0;
z-index: 1;
Expand Down
9 changes: 1 addition & 8 deletions resources/assets/js/Collection/Filters/MagnifyingGlass.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import React from "react";

const MagnifyingGlass = props => (
<svg
width={17}
height={17}
fill="none"
viewBox="0 0 17 17"
preserveAspectRatio="xMidYMid meet"
{...props}
>
<svg width={17} height={17} viewBox="0 0 17 17" fill="none" {...props}>
<path
d="M10.153 11.699c-3.229 0-5.847-2.463-5.847-5.5 0-3.038 2.618-5.5 5.847-5.5C13.383.7 16 3.161 16 6.2c0 3.037-2.618 5.5-5.847 5.5zM6.377 10.566L1 15.698"
stroke="currentColor"
Expand Down
9 changes: 1 addition & 8 deletions resources/assets/js/Collection/Filters/MnLogo.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import React from "react";

const MnLogo = props => (
<svg
width={50}
height={15}
viewBox="0 0 50 15"
preserveAspectRatio="xMidYMid meet"
fill="none"
{...props}
>
<svg width={50} height={15} viewBox="0 0 50 15" fill="none" {...props}>
<path
d="M32.053 11.041c-.483 1.981-2.412 3.478-4.736 3.478-2.675 0-4.823-1.982-4.823-4.448V4.61c0-.97-.877-1.778-1.93-1.778-1.052 0-1.929.809-1.929 1.779h-.701c0-2.467 2.148-4.448 4.823-4.448 2.675 0 4.823 1.981 4.823 4.448v5.459c0 .97.877 1.779 1.93 1.779 1.052 0 1.929-.809 1.929-1.78h.35"
fill="#000"
Expand Down
86 changes: 86 additions & 0 deletions resources/assets/js/Collection/Filters/MobileSearch.jsx
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;
77 changes: 77 additions & 0 deletions resources/assets/js/Collection/Filters/MobileSearch.scss
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.
2 changes: 1 addition & 1 deletion resources/assets/js/Collection/Settings/Eye.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";

const Eye = props => (
<svg width={22} height={20} fill="none" {...props}>
<svg width={22} height={20} viewBox="0 0 22 20" fill="none" {...props}>
<path
d="M21 12.819c-.202-.217-4.343-6.505-10-6.722-3.636-.109-6.667 2.819-10 6.722.202.217 4.343 5.855 10 6.18.101 0-.101 0 0 0 3.333 0 6.869-2.169 10-6.18zm-10 4.987c-3.333-.108-6.162-2.494-7.677-4.12-.404-.434-.404-1.192 0-1.626 2.525-2.82 5.05-4.77 7.778-4.662 3.333.108 6.263 2.927 7.778 4.662.404.434.404 1.192 0 1.626-2.728 2.71-5.152 4.229-7.879 4.12z"
fill="#434343"
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/Collection/Settings/EyeHover.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";

const EyeHover = props => (
<svg width={22} height={20} fill="none" {...props}>
<svg width={22} height={20} viewBox="0 0 22 20" fill="none" {...props}>
<path
d="M21 12.857c-.202-.215-4.343-6.467-10-6.682-3.535-.108-6.667 2.802-10 6.682.202.216 4.343 5.82 10 6.144.101 0-.101 0 0 0 3.434-.108 6.869-2.156 10-6.144zm-10 4.85C7.768 17.6 4.838 15.23 3.323 13.72c-.404-.431-.404-1.186 0-1.617C5.848 9.193 8.273 7.253 11 7.36c3.333.108 6.263 2.91 7.778 4.635.404.431.404 1.186 0 1.617-2.525 2.802-5.05 4.311-7.778 4.096z"
fill="#000"
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/Detail/ArrowBack.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";

const ArrowBack = props => (
<svg width={19} height={19} fill="none" {...props}>
<svg width={19} height={19} viewBox="0 0 19 19" fill="none" {...props}>
<path
d="M9 18L1 9.522M9 1L1 9.478"
stroke="currentColor"
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/Detail/Cross.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";

const Cross = props => (
<svg width={14} height={14} fill="none" {...props}>
<svg width={14} height={14} viewBox="0 0 14 14" fill="none" {...props}>
<path
d="M.646 12.647a.5.5 0 0 0 .708.706l-.708-.706zM6.984 7l.354.353a.5.5 0 0 0 0-.706L6.984 7zm5.662 6.353a.5.5 0 0 0 .708-.706l-.708.706zM7.016 7l-.354-.353a.5.5 0 0 0 0 .706L7.016 7zm6.338-5.647a.5.5 0 0 0-.708-.706l.708.706zm-12-.706a.5.5 0 1 0-.708.706l.708-.706zm0 12.706l5.984-6-.708-.706-5.984 6 .708.706zm12-.706l-5.984-6-.708.706 5.984 6 .708-.706zm-.708-12l-5.984 6 .708.706 5.984-6-.708-.706zm-12 .706l5.984 6 .708-.706-5.984-6-.708.706z"
fill="currentColor"
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/Detail/Download.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";

const Download = props => (
<svg width={17} height={17} fill="none" {...props}>
<svg width={17} height={17} viewBox="0 0 17 17" fill="none" {...props}>
<path
d="M14.412 7.348l-6.266 5.877M1.848 7.348l6.266 5.877"
stroke="currentColor"
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/Detail/MagnifyingGlass.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";

const MagnifyingGlass = props => (
<svg width={17} height={17} fill="none" {...props}>
<svg width={17} height={17} viewBox="0 0 17 17" fill="none" {...props}>
<path
d="M10.153 11.998c-3.23 0-5.847-2.462-5.847-5.499C4.306 3.462 6.924 1 10.153 1 13.383 1 16 3.462 16 6.5c0 3.036-2.618 5.498-5.847 5.498zM6.377 10.867L1 15.998"
stroke="currentColor"
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/Detail/ShareFacebook.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";

const ShareFacebook = props => (
<svg width={10} height={15} fill="none" {...props}>
<svg width={10} height={15} viewBox="0 0 10 15" fill="none" {...props}>
<path
d="M6.282 4.665h2.754c-.074.933-.223 1.865-.297 2.798H5.985v7.464H2.933V7.463H.923V4.665h2.01v-.287c0-.646 0-1.292.15-1.866C3.38 1.148 4.346.43 5.686.144 6.134.072 6.58 0 7.027 0H9.11v2.799H6.803c-.297 0-.372.143-.372.359-.149.502-.149 1.004-.149 1.507z"
fill="currentColor"
Expand Down
Loading

0 comments on commit a145464

Please sign in to comment.