blob: 5d031eb379096e167448e9d1ba9aa88497f9ef57 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
import React, { Component } from 'react'
import Marquee from "react-fast-marquee"
import "./marquee.css"
import { MARQUEES } from "site/projects/museum/constants"
export default class MarqueeContainer extends Component {
constructor(props) {
super(props)
this.state = {
}
}
componentDidMount() {
this.load()
}
componentDidUpdate(prevProps) {
if (this.props.location.pathname !== prevProps.location.pathname) {
this.load()
}
}
load() {
const { match } = this.props
const { page_name } = match.params
if (!(page_name in MARQUEES)) {
this.setState({ message: null })
}
this.setState({ message: MARQUEES[page_name] })
}
render() {
const { language } = this.props
if (!this.state.message) return null
return (
<div className="marquee-container">
<Marquee
direction="left"
speed={412}
gradient={false}
>
<span className="marquee-text">
{this.state.message[language]}
</span>
</Marquee>
</div>
)
}
}
|