Skip to content

Commit

Permalink
feat(design): dialog could assign width (#1107)
Browse files Browse the repository at this point in the history
  • Loading branch information
wzhudev authored Jan 11, 2024
1 parent 2fa1683 commit eda5cc5
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export const DialogOperation: ICommand = {
children: { title: 'Draggable Dialog Content' },
title: { title: 'Draggable Dialog' },
draggable: true,
width: 350,
onClose() {
dialogService.close('draggable');
},
Expand Down
14 changes: 13 additions & 1 deletion packages/design/src/components/dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { ConfigContext } from '../config-provider/ConfigProvider';
import styles from './index.module.less';

export interface IDialogProps {
width?: number | string;

children: React.ReactNode;

/**
Expand Down Expand Up @@ -61,7 +63,16 @@ export interface IDialogProps {
}

export function Dialog(props: IDialogProps) {
const { children, visible = false, title, draggable = false, closeIcon = <CloseSingle />, footer, onClose } = props;
const {
children,
visible = false,
title,
draggable = false,
closeIcon = <CloseSingle />,
footer,
onClose,
width,
} = props;
const [dragDisabled, setDragDisabled] = useState(false);

const { mountContainer } = useContext(ConfigContext);
Expand Down Expand Up @@ -94,6 +105,7 @@ export function Dialog(props: IDialogProps) {

return (
<RcDialog
width={width}
prefixCls={styles.dialog}
rootClassName={draggable ? styles.dialogRootDraggable : styles.dialogRoot}
getContainer={() => mountContainer}
Expand Down

0 comments on commit eda5cc5

Please sign in to comment.