add full page width preference

This commit is contained in:
Philipinho
2024-07-03 11:00:42 +01:00
parent d1ae117f76
commit 8f056d1071
10 changed files with 135 additions and 38 deletions

View File

@ -2,6 +2,9 @@ import classes from "@/features/editor/styles/editor.module.css";
import React from "react";
import { TitleEditor } from "@/features/editor/title-editor";
import PageEditor from "@/features/editor/page-editor";
import { Container } from "@mantine/core";
import { useAtom } from "jotai/index";
import { userAtom } from "@/features/user/atoms/current-user-atom.ts";
const MemoizedTitleEditor = React.memo(TitleEditor);
const MemoizedPageEditor = React.memo(PageEditor);
@ -21,8 +24,16 @@ export function FullEditor({
spaceSlug,
editable,
}: FullEditorProps) {
const [user] = useAtom(userAtom);
const fullPageWidth = user.settings?.preferences?.fullPageWidth;
return (
<div className={classes.editor}>
<Container
fluid={fullPageWidth}
{...(fullPageWidth && { mx: 80 })}
size={850}
className={classes.editor}
>
<MemoizedTitleEditor
pageId={pageId}
slugId={slugId}
@ -31,6 +42,6 @@ export function FullEditor({
editable={editable}
/>
<MemoizedPageEditor pageId={pageId} editable={editable} />
</div>
</Container>
);
}