Problem statement
A reusable function that drives a notice banner through four states using Vanilla TypeScript and standard DOM APIs. The page provides an existing banner element — the function updates that element in place, and its appearance is driven by state rather than by styles set on the element.
Demo
The page, styles, banner element, and controls are already scaffolded and wired. Only the updateNoticeBanner function is missing — implement it in src/noticeBanner.ts so every test passes. Do not edit any other file.
What to implement
- Take a banner, a state, and a message, and put the banner into that state.
- Handle four states —
info,success,warning, anderror— each one looking different. - Show only one state at a time. When the state changes, the old one must go away.
- Show the message you were given, word for word. If the message looks like code, show it as plain words instead of letting it become part of the page.
- Let screen readers announce the banner, and match how urgent the state is.
- Let the banner be hidden. Hiding empties the message and leaves the banner in no state at all.
- Change how the banner looks by changing its state, never by styling the banner directly.
- Change the banner you were given, rather than building a new one to take its place.
- Leave anything else already on the banner alone.
- Everything the banner shows must come from what you were given. Nothing should be fixed in advance.
