make titleBar uncontrolled

main
Mike Fix 6 years ago
parent 8d93c58fa6
commit 3187b6777a

@ -94,9 +94,7 @@ class Carbon extends React.PureComponent {
<div className="container"> <div className="container">
{config.windowControls ? ( {config.windowControls ? (
<WindowControls <WindowControls
titleBar={this.props.titleBar}
theme={config.windowTheme} theme={config.windowTheme}
handleTitleBarChange={this.props.updateTitleBar}
code={this.props.children} code={this.props.children}
copyable={this.props.copyable} copyable={this.props.copyable}
/> />

@ -104,7 +104,6 @@ class Editor extends React.Component {
updateCode = code => this.updateState({ code }) updateCode = code => this.updateState({ code })
updateAspectRatio = aspectRatio => this.updateState({ aspectRatio }) updateAspectRatio = aspectRatio => this.updateState({ aspectRatio })
updateTitleBar = titleBar => this.updateState({ titleBar })
async getCarbonImage( async getCarbonImage(
{ {
@ -285,12 +284,11 @@ class Editor extends React.Component {
backgroundImage, backgroundImage,
backgroundMode, backgroundMode,
aspectRatio, aspectRatio,
titleBar,
code, code,
exportSize exportSize
} = this.state } = this.state
const config = omit(this.state, ['code', 'aspectRatio', 'titleBar']) const config = omit(this.state, ['code', 'aspectRatio'])
return ( return (
<> <>
@ -347,8 +345,6 @@ class Editor extends React.Component {
config={this.state} config={this.state}
onChange={this.updateCode} onChange={this.updateCode}
onAspectRatioChange={this.updateAspectRatio} onAspectRatioChange={this.updateAspectRatio}
titleBar={titleBar}
updateTitleBar={this.updateTitleBar}
loading={this.state.loading} loading={this.state.loading}
> >
{code != null ? code : DEFAULT_CODE} {code != null ? code : DEFAULT_CODE}

@ -36,17 +36,11 @@ const CopyButton = React.memo(function CopyButton({ text }) {
) )
}) })
export default ({ titleBar, theme, handleTitleBarChange, copyable, code }) => ( export default ({ theme, copyable, code }) => (
<div className="window-controls"> <div className="window-controls">
{theme === 'bw' ? <ControlsBW /> : <Controls />} {theme === 'bw' ? <ControlsBW /> : <Controls />}
<div className="window-title-container"> <div className="window-title-container">
<input <input aria-label="Image Title" type="text" spellCheck="false" />
aria-label="Image Title"
value={titleBar || ''}
type="text"
spellCheck="false"
onChange={e => handleTitleBarChange(e.target.value)}
/>
</div> </div>
{copyable && ( {copyable && (
<div className="copy-button"> <div className="copy-button">

Loading…
Cancel
Save