Skip to content
Open
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
2 changes: 1 addition & 1 deletion a11y/index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!doctype html>
<html lang="en">
<html lang="ko">

<head>
<meta charset="UTF-8" />
Expand Down
8 changes: 4 additions & 4 deletions a11y/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import FlightBooking from "./components/FlightBooking";
function App() {
return (
<div className="app">
<div className="app-main">
<div className="flight-booking-container">
<main className="app-main">
<section className="flight-booking-container">
<FlightBooking />
</div>
</div>
</section>
</main>
</div>
);
}
Expand Down
5 changes: 5 additions & 0 deletions a11y/src/Typography.css
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,8 @@
font-weight: 500;
line-height: 100%;
}

.button-text:disabled {
color: #c0c0c042;
cursor: not-allowed;
}
13 changes: 12 additions & 1 deletion a11y/src/components/FlightBooking.css
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -61,3 +61,14 @@
border-radius: 4px;
cursor: pointer;
}

.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
margin: -1px;
padding: 0;
overflow: hidden;
clip: rect(0, 0, 0, 0);
border: 0;
}
29 changes: 26 additions & 3 deletions a11y/src/components/FlightBooking.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,43 @@ const FlightBooking = () => {
setAdultCount((prev) => Math.max(1, prev - 1));
};

const getLimitMessage = () => {
if (adultCount <= 1) {
return "최소 승객 수에 도달했습니다.";
}
if (adultCount === MAX_PASSENGERS) {
return "최대 승객 수에 도달했습니다.";
}
return "";
};

return (
<div className="flight-booking">
<h2 className="heading-2-text">항공권 예매</h2>
<div className="passenger-count">
<span className="body-text">성인</span>
<div className="counter">
<button className="button-text" onClick={decrementCount}>
<button
aria-label="성인 승객 감소"
className="button-text"
disabled={adultCount === 1}
onClick={decrementCount}
>
-
</button>
<span>{adultCount}</span>
<button className="button-text" onClick={incrementCount}>
<span aria-live="polite">{adultCount}</span>
<button
aria-label="성인 승객 증가"
className="button-text"
disabled={adultCount >= MAX_PASSENGERS}
onClick={incrementCount}
>
+
</button>
</div>
<div className="visually-hidden" aria-live="polite">
{getLimitMessage()}
</div>
</div>
<button className="search-button">항공편 검색</button>
</div>
Expand Down
3 changes: 3 additions & 0 deletions a11y/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,7 @@ import react from "@vitejs/plugin-react";
// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
server: {
host: "0.0.0.0",
},
});
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.