mirror of
https://github.com/bendtherules/is-nifty-open.git
synced 2026-08-18 22:02:57 +00:00
Refactor dateswitchbar icon rotation logic
This commit is contained in:
@@ -6,23 +6,23 @@ export class DateSwitchBar extends React.Component<{}, { rotated: boolean }> {
|
|||||||
|
|
||||||
constructor(props: {}) {
|
constructor(props: {}) {
|
||||||
super(props);
|
super(props);
|
||||||
this.updateFromProps(props);
|
|
||||||
|
|
||||||
this.state = { rotated: false };
|
this.state = { rotated: false };
|
||||||
|
|
||||||
|
this.willBeCreated(props);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
|
this.afterUpdated();
|
||||||
|
}
|
||||||
|
|
||||||
|
willBeCreated(props: {}) {
|
||||||
|
this.setState({ rotated: false });
|
||||||
|
}
|
||||||
|
|
||||||
|
afterUpdated() {
|
||||||
setTimeout(() => { this.setState({ rotated: true }); }, 1000);
|
setTimeout(() => { this.setState({ rotated: true }); }, 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUpdate(nextProps: {}, nextState: {}) {
|
|
||||||
this.updateFromProps(nextProps);
|
|
||||||
}
|
|
||||||
|
|
||||||
updateFromProps(props: {}) {
|
|
||||||
// do nothing for now
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const iconClasses = ["icon"];
|
const iconClasses = ["icon"];
|
||||||
if (this.state.rotated) {
|
if (this.state.rotated) {
|
||||||
|
|||||||
Reference in New Issue
Block a user