Move Items Up and Down
Write the code, see it run, pass the checks.
The problem
- medium
- Code
The Playlist component gets a songs prop, a list of song names (the preview uses "Intro", "Sunrise", "Rain" and "Finale"). Show each song as a list item, in order, with two buttons named "Move Sunrise up" and "Move Sunrise down" (with the song's name, as visible text or an aria-label). Moving up swaps a song with the one above it; moving down swaps it with the one below. The top song's up button and the bottom song's down button are disabled. Below the list, show a line reading "Now playing first: Intro", always naming the song at the top.
Your code must pass
- Lists the songs with the end buttons disabled
- Move up swaps a song with the one above it
- Move down swaps a song with the one below it
- The disabled buttons and first song follow the new order