Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[DS-13] Dialog 디자인 검수 & 스타일 수정 #177

Merged
merged 7 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 17 additions & 10 deletions packages/design-system/src/components/Dialog/Dialog.styled.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,47 +20,49 @@ const DIALOG_WRAPPER_STYLE: DialogElementStyle = {
},
modal: {
position: "relative",
boxShadow:
"0px 12px 24px 8px rgba(0, 0, 0, 0.12), 0px 12px 44px 3px rgba(0, 0, 0, 0.18)",
},
nonModal: {
position: "fixed",
top: "30px",
right: "30px",
boxShadow:
"0px 12px 24px 8px rgba(0, 0, 0, 0.36), 0px 12px 44px 3px rgba(0, 0, 0, 0.48)",
},
};

const DIALOG_TITLE_STYLE: DialogElementStyle = {
small: {
display: "flex",
alignItems: "center",
height: "52px",
maxHeight: "100%",
padding: "20px 20px 8px 20px",
padding: "20px 20px 4px 20px", // Title's X button pluses 2px to paddingTop and Bottom
},
medium: {
display: "flex",
alignItems: "center",
height: "64px",
maxHeight: "100%",
padding: "30px 32px 6px 32px",
padding: "30px 32px 6px 32px", // Title's X button pluses 2px to paddingTop and Bottom
},
};

const DIALOG_CONTENT_STYLE: DialogElementStyle = {
small: {
paddingInline: "20px calc(20px - 10px)",
paddingTop: "8px",
paddingBottom: "28px",
},
smallAction: {
paddingInline: "20px calc(20px - 10px)",
paddingBottom: "8px",
paddingBlock: "8px",
},
medium: {
paddingInline: "32px calc(32px - 14px)",
paddingTop: "16px",
paddingBottom: "32px",
},
mediumAction: {
paddingInline: "32px calc(32px - 14px)",
paddingBottom: "16px",
paddingBlock: "16px",
},
};

Expand Down Expand Up @@ -154,8 +156,13 @@ export const StyledDialogTitleIconWrapper = styled("div")({
justifyContent: "center",
width: "20px",
height: "20px",
position: "relative",
marginBottom: "1px",
"& .MuiSvgIcon-root": {
display: "flex",
justifyContent: "center",
width: "20px",
height: "20px",
fontSize: "20px",
},
});

export const StyledDialogContent = styled("div")(({ theme }) => ({
Expand Down
13 changes: 4 additions & 9 deletions packages/design-system/src/components/Dialog/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface DialogBase {
titleVariant?: TypographyProps["variant"];
children: React.ReactNode;
actions?: React.ReactNode;
enableBackButtonClose?: boolean;
enableBackButtonClose?: boolean; // only for passive dialog
enableBackdropClose?: boolean;
size?: "small" | "medium"; // default "small"
sx?: SxProps;
Expand All @@ -43,7 +43,7 @@ export interface PassiveDialogType extends DialogBase {
export interface ActionDialogType extends DialogBase {
type: "action";
actions: React.ReactNode;
enableBackButtonClose?: boolean;
enableBackButtonClose?: false;
enableBackdropClose?: boolean;
}

Expand Down Expand Up @@ -84,12 +84,7 @@ function Dialog(props: DialogProps) {
}

useEffect(() => {
const isClosable =
isOpen &&
(isPassiveModal ||
(isActionModal && props.enableBackdropClose) ||
(isActionNonModal && props.enableBackButtonClose));

const isClosable = isOpen && isPassiveModal;
if (!isClosable) return;

function handleEscClose(event: KeyboardEvent) {
Expand Down Expand Up @@ -152,7 +147,7 @@ function DialogBase({ dialogProps }: { dialogProps: DialogBase }) {
...sx,
}}
style={style}
className={`dialog ${className ?? ""}`}
className={`dialog elevation2 ${className ?? ""}`}
>
<StyledDialogTitle id="dialog-title" className="dialog-title-wrapper">
{titleIcon && (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const StyledDialogActions = styled("div")({
flex: "0 0 auto",
alignItems: "center",
justifyContent: "flex-end",
gap: 8,
gap: 12,
});

export function DialogAction(props: DialogActionProps) {
Expand Down
Loading