mirror of
https://github.com/ershisan99/DevToysWeb.git
synced 2025-12-31 20:49:27 +00:00
refactor: clean code editor components and styles
This commit is contained in:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user