Some changes
This commit is contained in:
parent
04ef7f4498
commit
7231beb222
9 changed files with 568 additions and 767 deletions
1244
package-lock.json
generated
1244
package-lock.json
generated
File diff suppressed because it is too large
Load diff
|
@ -27,12 +27,5 @@
|
||||||
"not dead",
|
"not dead",
|
||||||
"not ie <= 11",
|
"not ie <= 11",
|
||||||
"not op_mini all"
|
"not op_mini all"
|
||||||
],
|
]
|
||||||
"devDependencies": {
|
|
||||||
"eslint": "^5.9.0",
|
|
||||||
"eslint-config-airbnb": "^17.1.0",
|
|
||||||
"eslint-plugin-import": "^2.14.0",
|
|
||||||
"eslint-plugin-jsx-a11y": "^6.1.2",
|
|
||||||
"eslint-plugin-react": "^7.11.1"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,23 +17,13 @@ class App extends Component {
|
||||||
background: 1
|
background: 1
|
||||||
}
|
}
|
||||||
|
|
||||||
this.changeBackground.bind = this.changeBackground();
|
this.changeBackground = this.changeBackground.bind(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
changeBackground = () => {
|
changeBackground(background) {
|
||||||
setInterval(() => {
|
document.body.style.background = `url('/background/${background}.jpg') no-repeat fixed`;
|
||||||
let currentBackground = this.state.background;
|
|
||||||
document.body.style.background = `url('/background/${currentBackground}.jpg') no-repeat fixed`;
|
|
||||||
document.body.style.backgroundSize = 'cover';
|
document.body.style.backgroundSize = 'cover';
|
||||||
document.body.style.backgroundPosition = 'center center';
|
document.body.style.backgroundPosition = 'center center';
|
||||||
|
|
||||||
if (currentBackground === 4) {
|
|
||||||
currentBackground = 0
|
|
||||||
}
|
|
||||||
this.setState({
|
|
||||||
background: currentBackground + 1
|
|
||||||
})
|
|
||||||
}, 10000);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -42,10 +32,26 @@ class App extends Component {
|
||||||
<Header></Header>
|
<Header></Header>
|
||||||
<Router>
|
<Router>
|
||||||
<Switch>
|
<Switch>
|
||||||
<Route exact path="/" component={Home} />
|
<Route
|
||||||
<Route exact path="/carte" component={Map} />
|
exact
|
||||||
<Route exact path="/vegetaux/:typeId-:typeSlug" component={Vegetables} />
|
path="/"
|
||||||
<Route exact path="/vegetaux/:typeId-:typeSlug/:vegetableId-:vegetableSlug" component={Vegetable} />
|
render={(props) => <Home {...props} changeBackground={this.changeBackground} />}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
exact
|
||||||
|
path="/carte"
|
||||||
|
render={(props) => <Map {...props} changeBackground={this.changeBackground} />}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
exact
|
||||||
|
path="/vegetaux/:typeId-:typeSlug"
|
||||||
|
render={(props) => <Vegetables {...props} changeBackground={this.changeBackground} />}
|
||||||
|
/>
|
||||||
|
<Route
|
||||||
|
exact
|
||||||
|
path="/vegetaux/:typeId-:typeSlug/:vegetableId-:vegetableSlug"
|
||||||
|
render={(props) => <Vegetable {...props} changeBackground={this.changeBackground} />}
|
||||||
|
/>
|
||||||
</Switch>
|
</Switch>
|
||||||
</Router>
|
</Router>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -81,7 +81,7 @@ export default class Header extends React.Component {
|
||||||
<DropdownMenu right>
|
<DropdownMenu right>
|
||||||
{
|
{
|
||||||
this.state.types.map((type, key) => (
|
this.state.types.map((type, key) => (
|
||||||
<DropdownItem key={key}>
|
<DropdownItem as="div" key={key}>
|
||||||
|
|
||||||
<NavLink href={`/vegetaux/${type.id}-${strToSlug(type.name)}`}>
|
<NavLink href={`/vegetaux/${type.id}-${strToSlug(type.name)}`}>
|
||||||
<span className="text">{type.name}</span>
|
<span className="text">{type.name}</span>
|
||||||
|
|
|
@ -9,6 +9,8 @@ import '../css/Home.css';
|
||||||
|
|
||||||
export default class RouterHome extends React.Component {
|
export default class RouterHome extends React.Component {
|
||||||
render() {
|
render() {
|
||||||
|
// this.props.changeBackground()
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container>
|
<Container>
|
||||||
<Row>
|
<Row>
|
||||||
|
|
|
@ -9,7 +9,8 @@ import {
|
||||||
CarouselItem,
|
CarouselItem,
|
||||||
CarouselControl,
|
CarouselControl,
|
||||||
CarouselIndicators,
|
CarouselIndicators,
|
||||||
CarouselCaption
|
Breadcrumb,
|
||||||
|
BreadcrumbItem
|
||||||
} from 'reactstrap';
|
} from 'reactstrap';
|
||||||
import {
|
import {
|
||||||
NotificationContainer,
|
NotificationContainer,
|
||||||
|
@ -17,6 +18,7 @@ import {
|
||||||
} from 'react-notifications';
|
} from 'react-notifications';
|
||||||
import Api from '../Components/Api';
|
import Api from '../Components/Api';
|
||||||
import MapItem from '../Components/Map';
|
import MapItem from '../Components/Map';
|
||||||
|
import strToSlug from '../StrToSlug';
|
||||||
|
|
||||||
export default class RouterVegetable extends React.Component {
|
export default class RouterVegetable extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -29,7 +31,13 @@ export default class RouterVegetable extends React.Component {
|
||||||
name: '',
|
name: '',
|
||||||
Vegetables: []
|
Vegetables: []
|
||||||
},
|
},
|
||||||
item: {},
|
item: {
|
||||||
|
name: null,
|
||||||
|
Type: {
|
||||||
|
id: null,
|
||||||
|
name: null
|
||||||
|
}
|
||||||
|
},
|
||||||
activeIndex: 0
|
activeIndex: 0
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -96,8 +104,12 @@ export default class RouterVegetable extends React.Component {
|
||||||
<Row>
|
<Row>
|
||||||
<Col xs="12">
|
<Col xs="12">
|
||||||
<Row className="with-margin">
|
<Row className="with-margin">
|
||||||
<Col className=" with-border with-background">
|
<Col className="no-padding">
|
||||||
<h1>» {this.state.item.name}</h1>
|
<Breadcrumb>
|
||||||
|
<BreadcrumbItem><a href={`/vegetaux/${this.state.item.Type.id}-${strToSlug(this.state.item.Type.name)}`}>{this.state.item.Type.name}</a></BreadcrumbItem>
|
||||||
|
<BreadcrumbItem active>{this.state.item.name}</BreadcrumbItem>
|
||||||
|
</Breadcrumb>
|
||||||
|
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</Col>
|
</Col>
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
export default (string) => {
|
export default (string) => {
|
||||||
|
if (!string) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
let str = string;
|
let str = string;
|
||||||
str = str.replace(/^\s+|\s+$/g, ''); // trim
|
str = str.replace(/^\s+|\s+$/g, ''); // trim
|
||||||
str = str.toLowerCase();
|
str = str.toLowerCase();
|
||||||
|
|
|
@ -49,3 +49,12 @@ body {
|
||||||
float:left;
|
float:left;
|
||||||
display:inline; */
|
display:inline; */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.no-padding {
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.center {
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
Loading…
Reference in a new issue