diff --git a/a11y/index.html b/a11y/index.html
index 12fa3e7..73a1d92 100644
--- a/a11y/index.html
+++ b/a11y/index.html
@@ -1,5 +1,5 @@
-
+
diff --git a/a11y/package.json b/a11y/package.json
index 1148c94..aa440de 100644
--- a/a11y/package.json
+++ b/a11y/package.json
@@ -4,7 +4,7 @@
"version": "0.0.0",
"type": "module",
"scripts": {
- "dev": "vite",
+ "dev": "vite --host 0.0.0.0",
"build": "tsc -b && vite build",
"lint": "eslint .",
"preview": "vite preview"
diff --git a/a11y/src/App.tsx b/a11y/src/App.tsx
index a8159f9..15db74d 100644
--- a/a11y/src/App.tsx
+++ b/a11y/src/App.tsx
@@ -5,13 +5,13 @@ import FlightBooking from "./components/FlightBooking";
function App() {
return (
-
+
+
+
);
}
diff --git a/a11y/src/components/FlightBooking.css b/a11y/src/components/FlightBooking.css
index d9d6083..35c9944 100644
--- a/a11y/src/components/FlightBooking.css
+++ b/a11y/src/components/FlightBooking.css
@@ -61,3 +61,8 @@
border-radius: 4px;
cursor: pointer;
}
+
+.visually-hidden {
+ position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
+ overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
+}
diff --git a/a11y/src/components/FlightBooking.tsx b/a11y/src/components/FlightBooking.tsx
index 313cab3..2e1757b 100644
--- a/a11y/src/components/FlightBooking.tsx
+++ b/a11y/src/components/FlightBooking.tsx
@@ -1,37 +1,70 @@
import { useState } from "react";
-
import "./FlightBooking.css";
const MAX_PASSENGERS = 3;
const FlightBooking = () => {
const [adultCount, setAdultCount] = useState(1);
+ const [statusMessage, setStatusMessage] = useState("");
const incrementCount = () => {
- setAdultCount((prev) => Math.min(MAX_PASSENGERS, prev + 1));
+ setAdultCount((prev) => {
+ if (prev >= MAX_PASSENGERS) {
+ setStatusMessage("최대 승객 수에 도달했습니다.");
+ return prev;
+ }
+ setStatusMessage("");
+ return prev + 1;
+ });
};
const decrementCount = () => {
- setAdultCount((prev) => Math.max(1, prev - 1));
+ setAdultCount((prev) => {
+ if (prev <= 1) {
+ setStatusMessage("최소 1명의 승객이 필요합니다.");
+ return prev;
+ }
+ setStatusMessage("");
+ return prev - 1;
+ });
};
return (
-
+
항공권 예매
+
-
성인
+
+ 성인
+
+
-
+
+ {statusMessage}
+
항공편 검색
-
+
);
};