diff --git a/a11y/index.html b/a11y/index.html index 12fa3e7..e525729 100644 --- a/a11y/index.html +++ b/a11y/index.html @@ -1,16 +1,14 @@ - - - - - - - - Accessibility - - - -
- - + + + + + + + Accessibility + + +
+ + diff --git a/a11y/src/components/FlightBooking.css b/a11y/src/components/FlightBooking.css index d9d6083..5235c41 100644 --- a/a11y/src/components/FlightBooking.css +++ b/a11y/src/components/FlightBooking.css @@ -34,7 +34,7 @@ width: 30px; height: 30px; border-radius: 16px; - border: 1px solid #C0C0C0; + border: 1px solid #c0c0c0; background-color: #fff; cursor: pointer; display: flex; @@ -61,3 +61,15 @@ 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..7b23b69 100644 --- a/a11y/src/components/FlightBooking.tsx +++ b/a11y/src/components/FlightBooking.tsx @@ -1,37 +1,59 @@ -import { useState } from "react"; +import { useState } from 'react'; -import "./FlightBooking.css"; +import './FlightBooking.css'; const MAX_PASSENGERS = 3; const FlightBooking = () => { const [adultCount, setAdultCount] = useState(1); + const [passengerLimitMessage, setPassengerLimitMessage] = useState(''); const incrementCount = () => { + if (adultCount === MAX_PASSENGERS) { + setPassengerLimitMessage('최대 승객 수에 도달했습니다.'); + return; + } setAdultCount((prev) => Math.min(MAX_PASSENGERS, prev + 1)); }; const decrementCount = () => { + if (adultCount === 1) { + setPassengerLimitMessage('최소 1명의 승객이 필요합니다.'); + return; + } setAdultCount((prev) => Math.max(1, prev - 1)); }; return ( -
+

항공권 예매

성인
- - {adultCount} -
+ {passengerLimitMessage && ( + + {passengerLimitMessage} + + )} -
+ ); }; diff --git a/a11y/vite.config.ts b/a11y/vite.config.ts index 9cc50ea..11017cb 100644 --- a/a11y/vite.config.ts +++ b/a11y/vite.config.ts @@ -1,7 +1,10 @@ -import { defineConfig } from "vite"; -import react from "@vitejs/plugin-react"; +import { defineConfig } from 'vite'; +import react from '@vitejs/plugin-react'; // https://vitejs.dev/config/ export default defineConfig({ plugins: [react()], + server: { + host: '0.0.0.0', + }, });