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

Feature/#246_스타일 개선 #247

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
21 changes: 21 additions & 0 deletions client/src/components/modal/modal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { motion, AnimatePresence } from "framer-motion";
import { useEffect } from "react";
import { createPortal } from "react-dom";
import { TextButton } from "../button/textButton";
import { modalContainerAnimation, overlayAnimation } from "./modal.animation";
Expand Down Expand Up @@ -29,6 +30,26 @@ export const Modal = ({
}: ModalProps) => {
const portal = document.getElementById("modal") as HTMLElement;

useEffect(() => {
const handleKeyPress = (event: KeyboardEvent) => {
if (isOpen && event.key === "Enter") {
event.preventDefault();
primaryButtonOnClick?.();
}
};

// 모달이 열려있을 때만 이벤트 리스너 추가
if (isOpen) {
window.addEventListener("keydown", handleKeyPress);
}

// 클린업 함수
return () => {
window.removeEventListener("keydown", handleKeyPress);
};
}, [isOpen, primaryButtonOnClick]);

if (!isOpen) return null;
return createPortal(
<AnimatePresence>
{isOpen && (
Expand Down
12 changes: 6 additions & 6 deletions client/src/constants/color.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ export const COLOR = {
GRAY_700: "#4E637C",
GRAY_900: "#2B4158",
SHADOW: "#004585",
RED: "#F24150",
YELLOW: "#FEA642",
GREEN: "#1BBF44",
PURPLE: "#A142FE",
BROWN: "#8B4513",
BLUE: "#4285F4",
RED: "#E25D68",
YELLOW: "#EEAF66",
GREEN: "#3BC05C",
PURPLE: "#9862CD",
BROWN: "#985728",
BLUE: "#6293E5",
};
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ export const colorOptionButton = css({
const colorVariants: ColorVariants = {
transparent: { backgroundColor: "#C1D7F4" },
black: { backgroundColor: "#2B4158" },
red: { backgroundColor: "#F24150" },
green: { backgroundColor: "#1BBF44" },
blue: { backgroundColor: "#4285F4" },
yellow: { backgroundColor: "#FEA642" },
purple: { backgroundColor: "#A142FE" },
brown: { backgroundColor: "#8B4513" },
red: { backgroundColor: "#E25D68" },
green: { backgroundColor: "#3BC05C" },
blue: { backgroundColor: "#6293E5" },
yellow: { backgroundColor: "#EEAF66" },
purple: { backgroundColor: "#9862CD" },
brown: { backgroundColor: "#985728" },
white: { backgroundColor: "#EEEEEE" },
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,13 @@ export const colorOptionButton = css({

const colorVariants: ColorVariants = {
black: { color: "#2B4158" },
red: { color: "#F24150" },
green: { color: "#1BBF44" },
blue: { color: "#4285F4" },
yellow: { color: "#FEA642" },
purple: { color: "#A142FE" },
brown: { color: "#8B4513" },
white: { color: "#C1D7F4" },
red: { color: "#E25D68" },
green: { color: "#3BC05C" },
blue: { color: "#6293E5" },
yellow: { color: "#EEAF66" },
purple: { color: "#9862CD" },
brown: { color: "#985728" },
white: { color: "#EEEEEE" },
};

export const textColorIndicator = cva({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ export const pageTitleContainer = css({
gap: "8px",
flexDirection: "row",
alignItems: "center",
overflow: "hidden",
});

export const pageTitle = css({
textStyle: "display-medium24",
display: "flex",
alignItems: "center",
paddingTop: "3px",
color: "gray.500",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export const PageTitle = ({ title, icon }: PageTitleProps) => {
const { icon: IconComponent, color } = iconComponents[icon];
return (
<div className={pageTitleContainer}>
<IconComponent color={color} size="24px" />
<IconComponent color={color} size="24px" style={{ flexShrink: 0 }} />
<p className={pageTitle}>{title || "Title"}</p>
</div>
);
Expand Down
Loading