mirror of
https://github.com/bendtherules/is-nifty-open.git
synced 2026-08-18 13:52:20 +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: {}) {
|
||||
super(props);
|
||||
this.updateFromProps(props);
|
||||
|
||||
this.state = { rotated: false };
|
||||
|
||||
this.willBeCreated(props);
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
this.afterUpdated();
|
||||
}
|
||||
|
||||
willBeCreated(props: {}) {
|
||||
this.setState({ rotated: false });
|
||||
}
|
||||
|
||||
afterUpdated() {
|
||||
setTimeout(() => { this.setState({ rotated: true }); }, 1000);
|
||||
}
|
||||
|
||||
componentWillUpdate(nextProps: {}, nextState: {}) {
|
||||
this.updateFromProps(nextProps);
|
||||
}
|
||||
|
||||
updateFromProps(props: {}) {
|
||||
// do nothing for now
|
||||
}
|
||||
|
||||
render() {
|
||||
const iconClasses = ["icon"];
|
||||
if (this.state.rotated) {
|
||||
|
||||
Reference in New Issue
Block a user