moved delete button to editor

This commit is contained in:
Fedor Katurov 2023-04-26 17:14:44 +06:00
parent 02333e6049
commit ece7395b26
5 changed files with 14 additions and 20 deletions

View file

@ -1,20 +1,25 @@
import { FC, PropsWithChildren } from "react";
import styles from "./styles.module.scss";
import { Button } from "~/components/buttons/Button";
import { useContainerPaddings } from "~/modules/theme/hooks/useContainerPaddings";
interface EditorWrapperProps extends PropsWithChildren {
onSave: () => void;
save: () => void;
remove: () => void;
}
const EditorWrapper: FC<EditorWrapperProps> = ({ children, onSave }) => {
const EditorWrapper: FC<EditorWrapperProps> = ({ children, save, remove }) => {
return (
<div className={styles.wrapper}>
<div className={styles.content}>{children}</div>
<div className={styles.panel}>
<Button onClick={remove} role="button" size="small" variant="outline">
Delete
</Button>
<div className={styles.filler} />
<Button onClick={onSave} role="button" size="small">
<Button onClick={save} role="button" size="small">
Save
</Button>
</div>

View file

@ -11,6 +11,7 @@ interface MarkdownEditorContainerProps {
id: string;
locked: boolean;
startEditing: () => void;
remove: () => void;
}
const RichEditor = lazy(() =>
@ -23,6 +24,7 @@ export const MarkdownEditorContainer: FC<MarkdownEditorContainerProps> = ({
id,
locked,
startEditing,
remove,
}) => {
const {
settings: { richEditorEnabled },
@ -39,7 +41,7 @@ export const MarkdownEditorContainer: FC<MarkdownEditorContainerProps> = ({
);
const editor = (
<EditorWrapper onSave={startEditing}>
<EditorWrapper save={startEditing} remove={remove}>
{richEditorEnabled ? (
<RichEditor value={value} onChange={setValue} locked={locked} />
) : (