mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
chore: remove unused code
This commit is contained in:
parent
e54c6a0579
commit
e6d9c7eca0
1 changed files with 0 additions and 46 deletions
|
|
@ -1,46 +0,0 @@
|
|||
import * as React from 'react'
|
||||
|
||||
type Props = {
|
||||
children(size: Size): React.ReactNode
|
||||
}
|
||||
|
||||
type Size = {
|
||||
width: number
|
||||
height: number
|
||||
}
|
||||
|
||||
type State = {
|
||||
size: Size
|
||||
}
|
||||
|
||||
export default class AutoSizer extends React.Component<Props, State> {
|
||||
state = {
|
||||
size: {
|
||||
width: 0,
|
||||
height: 0,
|
||||
},
|
||||
}
|
||||
|
||||
ref = React.createRef<HTMLDivElement>()
|
||||
|
||||
componentDidMount() {
|
||||
const container = this.ref.current
|
||||
if (container) {
|
||||
this.setState({
|
||||
size: {
|
||||
width: container.offsetWidth,
|
||||
height: container.offsetHeight,
|
||||
},
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
const { size } = this.state
|
||||
return (
|
||||
<div {...this.props} ref={this.ref}>
|
||||
{this.props.children(size)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue