mirror of
https://github.com/kremalicious/portfolio.git
synced 2025-01-03 10:25:00 +01:00
remove unneccesary state from props
This commit is contained in:
parent
097874bb54
commit
8e7e700ede
@ -22,24 +22,8 @@ export default class Header extends PureComponent {
|
|||||||
minimal: PropTypes.bool
|
minimal: PropTypes.bool
|
||||||
}
|
}
|
||||||
|
|
||||||
state = { isMinimal: this.props.minimal }
|
|
||||||
|
|
||||||
checkMinimal = () => {
|
|
||||||
const { minimal } = this.props
|
|
||||||
|
|
||||||
this.setState({ isMinimal: minimal })
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidMount() {
|
|
||||||
this.checkMinimal()
|
|
||||||
}
|
|
||||||
|
|
||||||
componentDidUpdate() {
|
|
||||||
this.checkMinimal()
|
|
||||||
}
|
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { isMinimal } = this.state
|
const { minimal } = this.props
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<StaticQuery
|
<StaticQuery
|
||||||
@ -48,16 +32,16 @@ export default class Header extends PureComponent {
|
|||||||
const meta = data.dataYaml
|
const meta = data.dataYaml
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header className={isMinimal ? styles.minimal : styles.header}>
|
<header className={minimal ? styles.minimal : styles.header}>
|
||||||
<ThemeSwitch />
|
<ThemeSwitch />
|
||||||
|
|
||||||
<Link className={styles.header__link} to={'/'}>
|
<Link className={styles.header__link} to={'/'}>
|
||||||
<LogoUnit minimal={isMinimal} />
|
<LogoUnit minimal={minimal} />
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
<Networks hide={isMinimal} />
|
<Networks hide={minimal} />
|
||||||
|
|
||||||
<Availability hide={isMinimal && !meta.availability.status} />
|
<Availability hide={minimal && !meta.availability.status} />
|
||||||
</header>
|
</header>
|
||||||
)
|
)
|
||||||
}}
|
}}
|
||||||
|
Loading…
Reference in New Issue
Block a user