extract widthhandler as prop

main
Mike Fix 2 years ago
parent 8a8edcfef8
commit c61da03d86
No known key found for this signature in database
GPG Key ID: 1D85E862314CA79F

@ -11,7 +11,6 @@ hljs.registerLanguage('javascript', javascript)
import { Spinner } from './Spinner' import { Spinner } from './Spinner'
import WindowControls from './WindowControls' import WindowControls from './WindowControls'
import WidthHandler from './WidthHandler'
import { import {
COLORS, COLORS,
@ -224,14 +223,7 @@ class Carbon extends React.PureComponent {
<div className="alpha eliminateOnRender" /> <div className="alpha eliminateOnRender" />
<div className="bg" /> <div className="bg" />
</div> </div>
{this.props.widthHandler}
{/* TODO pass in this child as a prop to Carbon */}
<WidthHandler
innerRef={this.props.innerRef}
onChange={this.props.updateWidth}
onConfirm={this.props.confirmWidth}
paddingHorizontal={config.paddingHorizontal}
/>
</div> </div>
)} )}
</div> </div>

@ -17,6 +17,7 @@ import ShareMenu from './ShareMenu'
import CopyMenu from './CopyMenu' import CopyMenu from './CopyMenu'
import Themes from './Themes' import Themes from './Themes'
import FontFace from './FontFace' import FontFace from './FontFace'
import WidthHandler from './WidthHandler'
import LanguageIcon from './svg/Language' import LanguageIcon from './svg/Language'
import { import {
LANGUAGES, LANGUAGES,
@ -399,12 +400,18 @@ class Editor extends React.Component {
ref={this.carbonNode} ref={this.carbonNode}
config={this.state} config={this.state}
onChange={this.updateCode} onChange={this.updateCode}
updateWidth={this.updateWidth}
confirmWidth={this.confirmWidth}
loading={this.state.loading} loading={this.state.loading}
theme={theme} theme={theme}
titleBar={titleBar} titleBar={titleBar}
onTitleBarChange={this.updateTitleBar} onTitleBarChange={this.updateTitleBar}
widthHandler={
<WidthHandler
innerRef={this.carbonNode}
onChange={this.updateWidth}
onConfirm={this.confirmWidth}
paddingHorizontal={config.paddingHorizontal}
/>
}
> >
{code != null ? code : DEFAULT_CODE} {code != null ? code : DEFAULT_CODE}
</Carbon> </Carbon>

Loading…
Cancel
Save