refactor: clean code editor components and styles

This commit is contained in:
rusconn
2022-04-04 10:45:42 +09:00
parent d410830b7e
commit dfb6461eef
12 changed files with 75 additions and 156 deletions

View File

@@ -1,17 +1,20 @@
import { Box, Typography } from "@mui/material";
import { memo, PropsWithChildren } from "react";
import { Box, Stack, Typography } from "@mui/material";
import { ComponentPropsWithoutRef, memo, PropsWithChildren } from "react";
type Props = PropsWithChildren<{
title: string;
}>;
type Props = PropsWithChildren<
{
title: string;
} & ComponentPropsWithoutRef<typeof Stack>
>;
const StyledComponent = ({ children, title }: Props) => (
<Box>
const StyledComponent = ({ children, title, ...stackProps }: Props) => (
// eslint-disable-next-line react/jsx-props-no-spreading
<Stack {...stackProps}>
<Typography variant="h6" component="h2">
{title}
</Typography>
{children}
</Box>
<Box flexGrow={1}>{children}</Box>
</Stack>
);
export const Component = memo(StyledComponent);