diff options
Diffstat (limited to 'frontend/site/projects/museum/views/artists.js')
| -rw-r--r-- | frontend/site/projects/museum/views/artists.js | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/frontend/site/projects/museum/views/artists.js b/frontend/site/projects/museum/views/artists.js index 52a71e3..ed6ba0d 100644 --- a/frontend/site/projects/museum/views/artists.js +++ b/frontend/site/projects/museum/views/artists.js @@ -1,4 +1,5 @@ import React, { Component } from 'react' +import { connect } from 'react-redux' import actions from 'site/actions' import "./artists.css" @@ -8,7 +9,7 @@ import { ArrowLeft, ArrowRight } from "site/projects/museum/icons" import { history } from "site/store" -export default class Artists extends Component { +class Artists extends Component { state = { currentIndex: 0, detail: false, @@ -21,6 +22,7 @@ export default class Artists extends Component { this.previousArtist = this.previousArtist.bind(this) this.nextArtist = this.nextArtist.bind(this) this.goHome = this.goHome.bind(this) + this.changeLanguage = this.changeLanguage.bind(this) } componentDidMount() { @@ -50,8 +52,13 @@ export default class Artists extends Component { history.push(`/last-museum/home/`) } + changeLanguage() { + actions.site.changeLanguage(this.props.language === "de" ? "en" : "de") + } + scrollToTop() { setTimeout(() => { + if (!this.ref.current) return Array.from(this.ref.current.querySelectorAll(".artist-content")).forEach(el => { el.scrollTo(0, 0) }) @@ -103,6 +110,13 @@ export default class Artists extends Component { } } +const mapStateToProps = state => ({ + interactive: state.site.interactive, + language: state.site.language, +}) + +export default connect(mapStateToProps)(Artists) + const ArtistDetail = ({ artist, index, isCurrent, language, onClose }) => { return ( <div className={isCurrent ? "artist-detail visible" : "artist-detail"}> @@ -116,7 +130,7 @@ const ArtistDetail = ({ artist, index, isCurrent, language, onClose }) => { <div className="artist-detail-name" onClick={onClose}> {artist.name} </div> - <div className="artist-location">{artist.location}</div> + <div className="artist-location">{artist.location[language]}</div> </div> ) } |
