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/src/App.tsx b/a11y/src/App.tsx index a8159f9..b8fecc8 100644 --- a/a11y/src/App.tsx +++ b/a11y/src/App.tsx @@ -6,11 +6,11 @@ import FlightBooking from "./components/FlightBooking"; function App() { return (
-
-
+
+
-
-
+ +
); } diff --git a/a11y/src/components/FlightBooking.css b/a11y/src/components/FlightBooking.css index d9d6083..554c250 100644 --- a/a11y/src/components/FlightBooking.css +++ b/a11y/src/components/FlightBooking.css @@ -61,3 +61,15 @@ border-radius: 4px; cursor: pointer; } + +.visually-hidden { + position: absolute !important; + width: 1px; + height: 1px; + padding: 0; + margin: -1px; + overflow: hidden; + clip: rect(0, 0, 0, 0); + border: 0; + white-space: nowrap; +} \ No newline at end of file diff --git a/a11y/src/components/FlightBooking.tsx b/a11y/src/components/FlightBooking.tsx index 313cab3..ee0a53f 100644 --- a/a11y/src/components/FlightBooking.tsx +++ b/a11y/src/components/FlightBooking.tsx @@ -3,35 +3,50 @@ import { useState } from "react"; import "./FlightBooking.css"; const MAX_PASSENGERS = 3; +const MIN_PASSENGERS = 1; const FlightBooking = () => { const [adultCount, setAdultCount] = useState(1); + const [statusMessage, setStatusMessage] = useState(""); const incrementCount = () => { + if (adultCount === MAX_PASSENGERS) { + setStatusMessage("최대 승객 수에 도달했습니다"); + return; + } + setAdultCount((prev) => Math.min(MAX_PASSENGERS, prev + 1)); }; - + const decrementCount = () => { + if (adultCount === MIN_PASSENGERS) { + setStatusMessage("최소 1명의 승객이 필요합니다"); + return; + } + setAdultCount((prev) => Math.max(1, prev - 1)); }; return ( -
+

항공권 예매

성인
- - {adultCount} -
- -
+
+ {statusMessage} +
+ + ); }; diff --git a/a11y/vite.config.ts b/a11y/vite.config.ts index 9cc50ea..f047934 100644 --- a/a11y/vite.config.ts +++ b/a11y/vite.config.ts @@ -4,4 +4,8 @@ import react from "@vitejs/plugin-react"; // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], -}); + server: { + host: "0.0.0.0", + port: 5173, + }, +}); \ No newline at end of file