From 11edeef488e8307c0acbb2c7be5c354fc6094b92 Mon Sep 17 00:00:00 2001 From: Alexander Horbunov <31066977+hornetDC@users.noreply.github.com> Date: Fri, 2 Apr 2021 01:04:39 +0300 Subject: [PATCH 1/3] Added markdown editor (#94) --- apps/blueprints/src/components/MDEditor.tsx | 41 +++++++++++++ .../src/pages/user/blueprint-create.tsx | 6 +- .../pages/user/blueprint/[blueprintId].tsx | 6 +- package.json | 1 + yarn.lock | 59 +++++++++++++++++++ 5 files changed, 111 insertions(+), 2 deletions(-) create mode 100644 apps/blueprints/src/components/MDEditor.tsx diff --git a/apps/blueprints/src/components/MDEditor.tsx b/apps/blueprints/src/components/MDEditor.tsx new file mode 100644 index 0000000..bd2370d --- /dev/null +++ b/apps/blueprints/src/components/MDEditor.tsx @@ -0,0 +1,41 @@ +import React from "react"; +import styled from "@emotion/styled"; +import SimpleMDE, { SimpleMDEEditorProps } from "react-simplemde-editor"; +import "easymde/dist/easymde.min.css"; + +const StyledSimpleMDE = styled(SimpleMDE)` + .editor-toolbar { + button.active, + button:hover { + background: #5d5d5d; + } + + &.fullscreen { + background: #414040; + } + } + + .editor-preview { + background: #414040; + } + + .CodeMirror { + background: #414040; + color: white; + } + + .CodeMirror-cursor { + border-color: white; + } + + .EasyMDEContainer .CodeMirror-fullscreen { + border-left: none !important; + border-bottom: none !important; + } +`; + +export const MDEditor: React.FC = (props) => { + return ( + + ); +}; diff --git a/apps/blueprints/src/pages/user/blueprint-create.tsx b/apps/blueprints/src/pages/user/blueprint-create.tsx index 79818ba..83faec0 100644 --- a/apps/blueprints/src/pages/user/blueprint-create.tsx +++ b/apps/blueprints/src/pages/user/blueprint-create.tsx @@ -20,6 +20,7 @@ import { validateCreateBlueprintForm } from "../../utils/validate"; import { ImageEditor } from "../../components/ImageEditor"; import { Select } from "../../components/Select"; import { Button } from "../../components/Button"; +import { MDEditor } from "../../components/MDEditor"; import { pageHandler } from "../../utils/page-handler"; const FieldStyle = css` @@ -90,7 +91,10 @@ export const UserBlueprintCreate: NextPage = () => { css={FieldStyle} > Description -