Skip to content

Commit

Permalink
feat(dialog): introduce DialogSizes type
Browse files Browse the repository at this point in the history
closes #5516
  • Loading branch information
Parsium committed Oct 12, 2022
1 parent 63a6856 commit 877f962
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
17 changes: 5 additions & 12 deletions src/components/dialog/dialog.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,37 +5,30 @@ import Modal, { ModalProps } from "../modal";
import Heading from "../heading";
import { TagProps } from "../../__internal__/utils/helpers/tags/tags";
import useResizeObserver from "../../hooks/__internal__/useResizeObserver";

import {
StyledDialog,
StyledDialogTitle,
StyledDialogContent,
StyledDialogInnerContent,
} from "./dialog.style";
import { DialogSizes, TOP_MARGIN } from "./dialog.config";

import FocusTrap from "../../__internal__/focus-trap";
import IconButton from "../icon-button";
import Icon from "../icon";
import { TOP_MARGIN } from "./dialog.config";
import useLocale from "../../hooks/__internal__/useLocale";
import useIsStickyFooterForm from "../../hooks/__internal__/useIsStickyFooterForm";

type PaddingValues = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
const PADDING_VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8] as const;
type PaddingValues = typeof PADDING_VALUES[number];

export interface ContentPaddingInterface {
p?: PaddingValues;
py?: PaddingValues;
px?: PaddingValues;
}

type DialogSizes =
| "auto"
| "extra-small"
| "small"
| "medium-small"
| "medium"
| "medium-large"
| "large"
| "extra-large";

export interface DialogProps extends ModalProps, TagProps {
/** Custom class name */
className?: string;
Expand Down
4 changes: 3 additions & 1 deletion src/components/dialog/dialog.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@ export const DIALOG_SIZES = [
"medium-large",
"large",
"extra-large",
];
] as const;
export const TOP_MARGIN = 20;
export const CONTENT_TOP_PADDING = 24;
export const HORIZONTAL_PADDING = 32;
export const CONTENT_BOTTOM_PADDING = 30;

export type DialogSizes = typeof DIALOG_SIZES[number];
1 change: 1 addition & 0 deletions src/components/dialog/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
export { default } from "./dialog.component";
export type { DialogProps } from "./dialog.component";
export type { DialogSizes } from "./dialog.config";

0 comments on commit 877f962

Please sign in to comment.