Skip to content
Closed
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
93 changes: 92 additions & 1 deletion src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@
}

.app-header {
margin-bottom: 24px;
background-color: #fce4ec;
padding: 24px;
text-align: center;
margin: -24px -24px 24px -24px;
}

.app-header h1 {
color: #c2185b;
font-family: Georgia, serif;
font-size: 32px;
margin: 0;
}

.app-content {
Expand All @@ -27,6 +37,87 @@
min-width: 0;
}

.song-controls {
display: flex;
gap: 12px;
margin-bottom: 24px;
}

.sidebar button,
.sidebar select {
background-color: #fce4ec;
width: 100%;
padding: 8px 12px;
border: none;
cursor: pointer;
transition: background-color 0.2s;
display: inline-flex;
align-items: center;
}

.sidebar button:hover {
background-color: #f48fb1;
}

.sidebar button:active {
background-color: #f48fb1;
}

.sidebar button.active {
background-color: #f48fb1;
}

.sidebar ul {
list-style: none;
padding: 0;
}

.sidebar li {
margin-bottom: 8px;
}

.sidebar > section > div {
margin-bottom: 16px;
}

.song-controls {
align-items: center;
}

.song-controls button {
padding: 8px 12px;
border: none;
cursor: pointer;
transition: background-color 0.2s;
display: inline-flex;
align-items: center;
}

.song-controls nav {
display: flex;
gap: 12px;
}

.song-controls nav button {
background-color: #e0e0e0;
padding: 8px 16px;
}

.song-controls nav button:hover {
background-color: #b3b3b3;
}

.song-controls nav button:active {
background-color: #b3b3b3;
}

.song-controls nav button:disabled {
opacity: 0.5;
cursor: not-allowed;
}

/* album image styling removed per user request */

@media (max-width: 768px) {
.app {
padding: 16px;
Expand Down
19 changes: 10 additions & 9 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,21 +51,22 @@ function App() {
<section className='app-content'>
<aside className='sidebar'>
<FilterSortBar selectedAlbum={selectedAlbum} onAlbumChange={handleAlbumChange} sortBy={sortBy} onSortByChange={handleSortByChange}/>
<SongList songs={sortedSongs} onSelectSong={handleSelectSong} />
<SongList songs={sortedSongs} onSelectSong={handleSelectSong} currentSong={currentSong} />
</aside>

<section className='song-section' aria-label='Valgt sang'>
<FavoriteButton isFavorite={favorites.includes(currentSong.id)} onToggle={() => handleToggleFavorites(currentSong.id)}/>
<div className='song-controls'>
<FavoriteButton isFavorite={favorites.includes(currentSong.id)} onToggle={() => handleToggleFavorites(currentSong.id)}/>
<Navigation
isFirst={currentSongIndex == 0}
isLast={currentSongIndex == sortedSongs.length - 1}
onPrevious={() => setCurrentSongIndex(currentSongIndex - 1)}
onNext={() => setCurrentSongIndex(currentSongIndex + 1)}
/>
</div>

<SongCard song={currentSong} />

<Navigation
isFirst={currentSongIndex == 0}
isLast={currentSongIndex == sortedSongs.length - 1}
onPrevious={() => setCurrentSongIndex(currentSongIndex - 1)}
onNext={() => setCurrentSongIndex(currentSongIndex + 1)}
/>

</section>

</section>
Expand Down
4 changes: 2 additions & 2 deletions src/components/SongCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ export function SongCard({ song }: SongCardProps) {
return (
<article>
<h2>{song.title}</h2>
<p>{song.artist}</p>
<p>{song.album}</p>
<p>Artist: {song.artist}</p>
<p>Album: {song.album}</p>

<div>
<p>{isLoading ? 'Laster…' : error || data?.error ? 'Fant ingen sangtekst for denne sangen' : data?.lyrics}</p>
Expand Down
5 changes: 3 additions & 2 deletions src/components/SongList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ import type { Song } from '../data/songs'
type SongListProps = {
songs: Song[]
onSelectSong: (song: Song) => void
currentSong: Song
}

export function SongList({songs, onSelectSong}: SongListProps) {
export function SongList({songs, onSelectSong, currentSong}: SongListProps) {
return (
<section aria-labelledby='song-list-heading'>
<h2 id="song-list-heading">
Expand All @@ -15,7 +16,7 @@ export function SongList({songs, onSelectSong}: SongListProps) {
<ul>
{songs.map((song) => (
<li key={song.id}>
<button type='button' onClick={() => onSelectSong(song)}>
<button type='button' onClick={() => onSelectSong(song)} className={song.id === currentSong.id ? 'active' : ''}>
{song.title} - {song.artist}
</button>
</li>
Expand Down