diff --git a/src/assets/images/gear.svg b/src/assets/images/gear.svg new file mode 100644 index 0000000..5f57546 --- /dev/null +++ b/src/assets/images/gear.svg @@ -0,0 +1,3 @@ + + + diff --git a/src/assets/images/locked.svg b/src/assets/images/locked.svg deleted file mode 100644 index 2cba7b7..0000000 --- a/src/assets/images/locked.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/assets/images/unlocked.svg b/src/assets/images/unlocked.svg deleted file mode 100644 index c4270b1..0000000 --- a/src/assets/images/unlocked.svg +++ /dev/null @@ -1,3 +0,0 @@ - - - diff --git a/src/components/buttons/Button/index.tsx b/src/components/buttons/Button/index.tsx new file mode 100644 index 0000000..fc8c5a6 --- /dev/null +++ b/src/components/buttons/Button/index.tsx @@ -0,0 +1,31 @@ +import classNames from "classnames"; +import React, { FC } from "react"; +import styles from "./styles.module.scss"; + +interface ButtonProps + extends React.DetailedHTMLProps< + React.ButtonHTMLAttributes, + HTMLButtonElement + > { + variant?: "solid" | "outline"; + size?: "normal" | "small"; +} + +const Button: FC = ({ + variant = "solid", + size = "normal", + className, + ...rest +}) => ( + + + + ); +}; + +export { EditorWrapper }; diff --git a/src/modules/editor/components/EditorWrapper/styles.module.scss b/src/modules/editor/components/EditorWrapper/styles.module.scss new file mode 100644 index 0000000..540871d --- /dev/null +++ b/src/modules/editor/components/EditorWrapper/styles.module.scss @@ -0,0 +1,22 @@ +.wrapper { + width: 100%; + height: 100%; + display: flex; + flex-direction: column; + user-select: none; +} + +.content { + flex: 1; +} + +.panel { + flex: 0; + padding: 10px; + display: flex; + flex-direction: row; +} + +.filler { + flex: 1; +} diff --git a/src/modules/editor/components/EmptyViewer/index.tsx b/src/modules/editor/components/EmptyViewer/index.tsx index dbbd102..c088c90 100644 --- a/src/modules/editor/components/EmptyViewer/index.tsx +++ b/src/modules/editor/components/EmptyViewer/index.tsx @@ -1,6 +1,7 @@ import { FC } from "react"; import styles from "./styles.module.scss"; import { useContainerPaddings } from "~/modules/theme/hooks/useContainerPaddings"; +import { Button } from "~/components/buttons/Button"; interface EmptyViewerProps { startEditing?: () => void; @@ -13,11 +14,14 @@ const EmptyViewer: FC = ({ startEditing }) => {
Nothing's here
- - - start editing - - +
); diff --git a/src/modules/editor/components/EmptyViewer/styles.module.scss b/src/modules/editor/components/EmptyViewer/styles.module.scss index f3696be..15b0e11 100644 --- a/src/modules/editor/components/EmptyViewer/styles.module.scss +++ b/src/modules/editor/components/EmptyViewer/styles.module.scss @@ -10,10 +10,10 @@ transition: opacity 0.25s; &:hover { - opacity: 1; + opacity: 0.5; } } .title { - opacity: 0.5; + margin-bottom: 1em; } diff --git a/src/modules/editor/components/ReactMarkdownEditor/index.tsx b/src/modules/editor/components/ReactMarkdownEditor/index.tsx index 240f757..1e5968f 100644 --- a/src/modules/editor/components/ReactMarkdownEditor/index.tsx +++ b/src/modules/editor/components/ReactMarkdownEditor/index.tsx @@ -34,6 +34,7 @@ const ReactMarkdownEditor: FC = ({ style={style} placeholder="Start typing here..." value={value} + rows={1} /> ); }; diff --git a/src/modules/editor/components/ReactMarkdownViewer/index.tsx b/src/modules/editor/components/ReactMarkdownViewer/index.tsx index 8024e57..84ef1d6 100644 --- a/src/modules/editor/components/ReactMarkdownViewer/index.tsx +++ b/src/modules/editor/components/ReactMarkdownViewer/index.tsx @@ -2,17 +2,35 @@ import { FC } from "react"; import ReactMarkdown from "react-markdown"; import { useContainerPaddings } from "~/modules/theme/hooks/useContainerPaddings"; import styles from "./styles.module.scss"; +import { Button } from "~/components/buttons/Button"; interface ReactMarkdownViewerProps { value: string; + startEditing: () => void; } -const ReactMarkdownViewer: FC = ({ value }) => { +const ReactMarkdownViewer: FC = ({ + value, + startEditing, +}) => { const style = useContainerPaddings(); return (
- {value} +
+ +
+ +
+ {value} +
); }; diff --git a/src/modules/editor/components/ReactMarkdownViewer/styles.module.scss b/src/modules/editor/components/ReactMarkdownViewer/styles.module.scss index dcc55ae..000781b 100644 --- a/src/modules/editor/components/ReactMarkdownViewer/styles.module.scss +++ b/src/modules/editor/components/ReactMarkdownViewer/styles.module.scss @@ -1,4 +1,27 @@ .editor { + position: relative; + height: 100%; + box-sizing: border-box; +} + +.edit { + position: absolute; + bottom: 0; + right: 0; + opacity: 0; + transition: opacity 0.25s; + padding: 10px; + + .editor:hover & { + opacity: 0.5; + } + + &:hover { + opacity: 1; + } +} + +.content { & > :first-child { margin-top: 0 !important; margin-left: 0 !important; diff --git a/src/modules/editor/containers/MarkdownEditorContainer/index.tsx b/src/modules/editor/containers/MarkdownEditorContainer/index.tsx index 223194b..9673dd0 100644 --- a/src/modules/editor/containers/MarkdownEditorContainer/index.tsx +++ b/src/modules/editor/containers/MarkdownEditorContainer/index.tsx @@ -5,6 +5,7 @@ import { usePersistedValue } from "./hooks/usePersistedValue"; import styles from "./styles.module.scss"; import { useSettings } from "~/modules/settings/context/SettingsContext"; import { EmptyViewer } from "../../components/EmptyViewer"; +import { EditorWrapper } from "../../components/EditorWrapper"; interface MarkdownEditorContainerProps { id: string; @@ -34,14 +35,19 @@ export const MarkdownEditorContainer: FC = ({ const viewer = empty ? ( ) : ( - + ); - const editor = richEditorEnabled ? ( - - ) : ( - + const editor = ( + + {richEditorEnabled ? ( + + ) : ( + + )} + ); + return (
{locked ? viewer : editor} diff --git a/src/modules/layout/components/GridLayoutItemWrapper/index.tsx b/src/modules/layout/components/GridLayoutItemWrapper/index.tsx index 78b700b..d2ba43a 100644 --- a/src/modules/layout/components/GridLayoutItemWrapper/index.tsx +++ b/src/modules/layout/components/GridLayoutItemWrapper/index.tsx @@ -5,8 +5,7 @@ import { IconButton } from "~/components/buttons/IconButton"; import DeleteIcon from "~/assets/images/delete.svg"; import SplitVertical from "~/assets/images/split-vertical.svg"; import SplitHorizontal from "~/assets/images/split-horizontal.svg"; -import Locked from "~/assets/images/locked.svg"; -import Unlocked from "~/assets/images/unlocked.svg"; +import Gear from "~/assets/images/gear.svg"; type GridLayoutItemWrapperProps = PropsWithChildren & { splitVertical: () => void; @@ -24,7 +23,6 @@ const GridLayoutItemWrapper: FC = ({ showSettings, remove, locked, - lock, }) => (
@@ -49,7 +47,7 @@ const GridLayoutItemWrapper: FC = ({ role="button" className={styles.button} > - S + {!locked && ( @@ -57,10 +55,6 @@ const GridLayoutItemWrapper: FC = ({ )} - - - {locked ? : } -
{children} diff --git a/src/modules/layout/components/GridLayoutItemWrapper/styles.module.scss b/src/modules/layout/components/GridLayoutItemWrapper/styles.module.scss index 898d958..22d8d5a 100644 --- a/src/modules/layout/components/GridLayoutItemWrapper/styles.module.scss +++ b/src/modules/layout/components/GridLayoutItemWrapper/styles.module.scss @@ -17,6 +17,7 @@ top: 2px; right: 4px; transition: all 0.25s; + z-index: 1; } .button {