Skip to content

Commit

Permalink
refactor(components): refactor Dialog and update imports and exports
Browse files Browse the repository at this point in the history
fix #307
  • Loading branch information
nebula-aac committed Nov 11, 2023
1 parent 27c170d commit 767853e
Show file tree
Hide file tree
Showing 26 changed files with 73 additions and 65 deletions.
5 changes: 5 additions & 0 deletions packages/components/src/base/Backdrop/Backdrop.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Backdrop as MuiBackdrop, type BackdropProps as MuiBackdropProps } from '@mui/material';

export function Backdrop(props: MuiBackdropProps): JSX.Element {
return <MuiBackdrop {...props} />;
}
1 change: 1 addition & 0 deletions packages/components/src/base/Backdrop/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Backdrop } from './Backdrop';
5 changes: 5 additions & 0 deletions packages/components/src/base/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { Dialog as MuiDialog, type DialogProps as MuiDialogProps } from '@mui/material';

export function Dialog(props: MuiDialogProps): JSX.Element {
return <MuiDialog {...props} />;
}
5 changes: 0 additions & 5 deletions packages/components/src/base/Dialog/backdrop.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions packages/components/src/base/Dialog/dialog.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions packages/components/src/base/Dialog/dialogactions.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions packages/components/src/base/Dialog/dialogcontent.tsx

This file was deleted.

8 changes: 0 additions & 8 deletions packages/components/src/base/Dialog/dialogcontenttext.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions packages/components/src/base/Dialog/dialogtitle.tsx

This file was deleted.

7 changes: 1 addition & 6 deletions packages/components/src/base/Dialog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
export { Backdrop } from './backdrop';
export { Dialog } from './dialog';
export { DialogActions } from './dialogactions';
export { DialogContent } from './dialogcontent';
export { DialogContentText } from './dialogcontenttext';
export { DialogTitle } from './dialogtitle';
export { Dialog } from './Dialog';
8 changes: 8 additions & 0 deletions packages/components/src/base/DialogActions/DialogActions.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {
DialogActions as MuiDialogActions,
type DialogActionsProps as MuiDialogActionsProps
} from '@mui/material';

export function DialogActions(props: MuiDialogActionsProps): JSX.Element {
return <MuiDialogActions {...props} />;
}
1 change: 1 addition & 0 deletions packages/components/src/base/DialogActions/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { DialogActions } from './DialogActions';
8 changes: 8 additions & 0 deletions packages/components/src/base/DialogContent/DialogContent.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {
DialogContent as MuiDialogContent,
type DialogContentProps as MuiDialogContentProps
} from '@mui/material';

export function DialogContent(props: MuiDialogContentProps): JSX.Element {
return <MuiDialogContent {...props} />;
}
1 change: 1 addition & 0 deletions packages/components/src/base/DialogContent/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { DialogContent } from './DialogContent';
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {
DialogContentText as MuiDialogContentText,
type DialogContentTextProps as MuiDialogContentTextProps
} from '@mui/material';

export function DialogContentText(props: MuiDialogContentTextProps): JSX.Element {
return <MuiDialogContentText {...props} />;
}
1 change: 1 addition & 0 deletions packages/components/src/base/DialogContentText/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { DialogContentText } from './DialogContentText';
8 changes: 8 additions & 0 deletions packages/components/src/base/DialogTitle/DialogTitle.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import {
DialogTitle as MuiDialogTitle,
type DialogTitleProps as MuiDialogTitleProps
} from '@mui/material';

export function DialogTitle(props: MuiDialogTitleProps): JSX.Element {
return <MuiDialogTitle {...props} />;
}
1 change: 1 addition & 0 deletions packages/components/src/base/DialogTitle/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { DialogTitle } from './DialogTitle';
4 changes: 3 additions & 1 deletion packages/components/src/custom/ChartDialog/ChartDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react';
import { DialogActions, DialogContent, DialogContentText } from '../../base/Dialog';
import { DialogActions } from '../../base/DialogActions';
import { DialogContent } from '../../base/DialogContent';
import { DialogContentText } from '../../base/DialogContentText';
import { StyledDialog, StyledDialogTitle } from '../Dialog';

interface ChartDialogProps {
Expand Down
3 changes: 2 additions & 1 deletion packages/components/src/custom/Dialog/StyledDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { type DialogProps } from '@mui/material';
import { Dialog, DialogTitle } from '../../base/Dialog';
import { Dialog } from '../../base/Dialog';
import { DialogTitle } from '../../base/DialogTitle';

type StyledDialogProps = {
open: boolean;
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/custom/Dialog/StyledDialogActions.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import { DialogActions } from '../../base/Dialog';
import { DialogActions } from '../../base/DialogActions';

interface DialogActionsProps {
interface StyledDialogActionsProps {
children: React.ReactNode;
}

function StyledDialogActions({ children, ...props }: DialogActionsProps): JSX.Element {
function StyledDialogActions({ children, ...props }: StyledDialogActionsProps): JSX.Element {
return <DialogActions {...props}>{children}</DialogActions>;
}

Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/custom/Dialog/StyledDialogContent.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import React from 'react';
import { DialogContent } from '../../base/Dialog';
import { DialogContent } from '../../base/DialogContent';

interface DialogContentProps {
interface StyledDialogContentProps {
children: React.ReactNode;
}

function StyledDialogContent({ children, ...props }: DialogContentProps): JSX.Element {
function StyledDialogContent({ children, ...props }: StyledDialogContentProps): JSX.Element {
return <DialogContent {...props}>{children}</DialogContent>;
}

Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/custom/Dialog/StyledDialogTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from 'react';
import { DialogTitle } from '../../base/Dialog';
import { DialogTitle } from '../../base/DialogTitle';
import { Typography } from '../../base/Typography';

interface DialogTitleProps {
interface StyledDialogTitleProps {
children: React.ReactNode;
}

function StyledDialogTitle({ children, ...props }: DialogTitleProps): JSX.Element {
function StyledDialogTitle({ children, ...props }: StyledDialogTitleProps): JSX.Element {
return (
<DialogTitle
sx={{
Expand Down
10 changes: 4 additions & 6 deletions packages/components/src/custom/Dialog/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import StyledDialog from './StyledDialog';
import StyledDialogActions from './StyledDialogActions';
import StyledDialogContent from './StyledDialogContent';
import StyledDialogTitle from './StyledDialogTitle';

export { StyledDialog, StyledDialogActions, StyledDialogContent, StyledDialogTitle };
export { default as StyledDialog } from './StyledDialog';
export { default as StyledDialogActions } from './StyledDialogActions';
export { default as StyledDialogContent } from './StyledDialogContent';
export { default as StyledDialogTitle } from './StyledDialogTitle';
10 changes: 1 addition & 9 deletions packages/components/src/custom/index.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
// import { ErrorBoundary, withErrorBoundary, withSuppressedErrorBoundary } from './ErrorBoundary';
import { StyledDialog, StyledDialogActions, StyledDialogContent } from './Dialog';
import { useWindowDimensions } from './Helpers/Dimension';
import { useNotificationHandler } from './Helpers/Notification';
import { StyledTooltip } from './Tooltip';

export { StyledChartDialog } from './ChartDialog';
export { StyledSearchBar } from './StyledSearchBar';
export {
StyledDialog,
StyledDialogActions,
StyledDialogContent,
StyledTooltip,
useNotificationHandler,
useWindowDimensions
};
export { StyledTooltip, useNotificationHandler, useWindowDimensions };
6 changes: 6 additions & 0 deletions packages/components/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export * from './base/AccordionDetails';
export * from './base/AccordionSummary';
export * from './base/AppBar';
export * from './base/Avatar';
export * from './base/Backdrop';
export * from './base/Box';
export * from './base/Button';
export * from './base/ButtonGroup';
Expand All @@ -17,6 +18,10 @@ export * from './base/Chip';
export * from './base/ClickAwayListener';
export * from './base/Container';
export * from './base/Dialog';
export * from './base/DialogActions';
export * from './base/DialogContent';
export * from './base/DialogContentText';
export * from './base/DialogTitle';
export * from './base/Divider';
export * from './base/Drawer';
export * from './base/Form';
Expand Down Expand Up @@ -47,6 +52,7 @@ export {
type CustomColumn,
type CustomColumnVisibilityControlProps
} from './custom/CustomColumnVisibilityControl';
export * from './custom/Dialog';
export {
default as ResponsiveDataTable,
type Column,
Expand Down

0 comments on commit 767853e

Please sign in to comment.