diff --git a/packages/app/src/app/pages/Sandbox/Editor/Workspace/Project/Description/Description.tsx b/packages/app/src/app/pages/Sandbox/Editor/Workspace/Project/Description/Description.tsx index 9b6bba4cbf9..c8123174f39 100644 --- a/packages/app/src/app/pages/Sandbox/Editor/Workspace/Project/Description/Description.tsx +++ b/packages/app/src/app/pages/Sandbox/Editor/Workspace/Project/Description/Description.tsx @@ -1,70 +1,68 @@ -import React, { useState } from 'react'; -import { inject, hooksObserver } from 'app/componentConnectors'; +import { ENTER } from '@codesandbox/common/lib/utils/keycodes'; +import React, { FunctionComponent, useState } from 'react'; + +import { useOvermind } from 'app/overmind'; import { WorkspaceInputContainer } from '../../elements'; + import { EditPen } from '../elements'; + import { SandboxDescription } from './elements'; -interface IDescriptionProps { +type Props = { editable: boolean; - store: any; - signals: any; -} - -export const Description = inject('store', 'signals')( - hooksObserver( - ({ - editable, - signals: { - workspace: { sandboxInfoUpdated, valueChanged }, +}; +export const Description: FunctionComponent = ({ editable }) => { + const { + actions: { + workspace: { sandboxInfoUpdated, valueChanged }, + }, + state: { + workspace: { + project: { description }, }, - store: { - workspace: { - project: { description }, - }, - }, - }: IDescriptionProps) => { - const [editing, setEditing] = useState(false); + }, + } = useOvermind(); + const [editing, setEditing] = useState(false); + + const onKeyDown = (event: React.KeyboardEvent) => { + if (event.keyCode === ENTER && !event.shiftKey) { + event.preventDefault(); + event.stopPropagation(); + sandboxInfoUpdated(); + setEditing(false); + } + }; - const onKeyDown = (event: React.KeyboardEvent) => { - if (event.keyCode === 13 && !event.shiftKey) { - event.preventDefault(); - event.stopPropagation(); + return editing ? ( + +