Fix publish button

This commit is contained in:
Thomas Nordquist
2020-04-20 14:03:03 +02:00
parent 7a91e4dee6
commit 6fc0d3f28d

View File

@@ -102,7 +102,7 @@ function Publish(props: Props) {
)
}
function EditorMode(props: {
const EditorMode = memo(function EditorMode(props: {
payload?: string
editorMode: string
focusEditor: () => void
@@ -127,8 +127,7 @@ function EditorMode(props: {
}
}, [props.payload])
return useMemo(
() => (
return (
<div style={{ marginTop: '16px' }}>
<div style={{ width: '100%', lineHeight: '64px', textAlign: 'center' }}>
<EditorModeSelect value={props.editorMode} onChange={updateMode} focusEditor={props.focusEditor} />
@@ -138,10 +137,8 @@ function EditorMode(props: {
</div>
</div>
</div>
),
[props.editorMode]
)
}
})
const FormatJsonButton = React.memo(function FormatJsonButton(props: {
editorMode: string
@@ -166,7 +163,7 @@ const FormatJsonButton = React.memo(function FormatJsonButton(props: {
)
})
const PublishButton = (props: { publish: () => void; focusEditor: () => void }) => {
const PublishButton = memo(function PublishButton(props: { publish: () => void; focusEditor: () => void }) {
const handleClickPublish = useCallback(
(e: React.MouseEvent) => {
e.stopPropagation()
@@ -175,8 +172,7 @@ const PublishButton = (props: { publish: () => void; focusEditor: () => void })
[props.publish]
)
return useMemo(
() => (
return (
<Button
variant="contained"
size="small"
@@ -187,10 +183,8 @@ const PublishButton = (props: { publish: () => void; focusEditor: () => void })
>
<Navigation style={{ marginRight: '8px' }} /> Publish
</Button>
),
[handleClickPublish]
)
}
})
const mapDispatchToProps = (dispatch: any) => {
return {