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">
{config.windowControls ? (
<WindowControls
titleBar={this.props.titleBar}
theme={config.windowTheme}
handleTitleBarChange={this.props.updateTitleBar}
code={this.props.children}
copyable={this.props.copyable}
/>

@ -104,7 +104,6 @@ class Editor extends React.Component {
updateCode = code => this.updateState({ code })
updateAspectRatio = aspectRatio => this.updateState({ aspectRatio })
updateTitleBar = titleBar => this.updateState({ titleBar })
async getCarbonImage(
{
@ -285,12 +284,11 @@ class Editor extends React.Component {
backgroundImage,
backgroundMode,
aspectRatio,
titleBar,
code,
exportSize
} = this.state
const config = omit(this.state, ['code', 'aspectRatio', 'titleBar'])
const config = omit(this.state, ['code', 'aspectRatio'])
return (
<>
@ -347,8 +345,6 @@ class Editor extends React.Component {
config={this.state}
onChange={this.updateCode}
onAspectRatioChange={this.updateAspectRatio}
titleBar={titleBar}
updateTitleBar={this.updateTitleBar}
loading={this.state.loading}
>
{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">
{theme === 'bw' ? <ControlsBW /> : <Controls />}
<div className="window-title-container">
<input
aria-label="Image Title"
value={titleBar || ''}
type="text"
spellCheck="false"
onChange={e => handleTitleBarChange(e.target.value)}
/>
<input aria-label="Image Title" type="text" spellCheck="false" />
</div>
{copyable && (
<div className="copy-button">

Loading…
Cancel
Save