From 451a6d418b84f0661172b55f9624e75e3b3c77c1 Mon Sep 17 00:00:00 2001 From: Rachel Knutsen Stiansen Date: Sun, 8 Nov 2026 14:34:42 +0100 Subject: [PATCH 1/8] feat: #70 redesign album detail header --- client/src/pages/AlbumDetailPage.css | 52 +++++++++++++++-- client/src/pages/AlbumDetailPage.test.tsx | 69 +++++++++++++++++++++-- client/src/pages/AlbumDetailPage.tsx | 54 ++++++++++++------ 3 files changed, 148 insertions(+), 27 deletions(-) diff --git a/client/src/pages/AlbumDetailPage.css b/client/src/pages/AlbumDetailPage.css index b7ddb87..de0c456 100644 --- a/client/src/pages/AlbumDetailPage.css +++ b/client/src/pages/AlbumDetailPage.css @@ -6,19 +6,58 @@ font-weight: 700; } .album-detail__header { + display: grid; + grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); + align-items: center; + gap: clamp(2rem, 5vw, 4.5rem); border-bottom: 1px solid var(--border); - margin: 1.5rem 0; - padding-bottom: 1.5rem; + margin: 2rem 0; + padding-bottom: 2.5rem; +} +.album-detail__artwork { + width: 100%; + max-width: 26rem; + box-shadow: 0 0 4rem var(--surface-raised); +} +.album-detail__info { + min-width: 0; + overflow-wrap: anywhere; } .album-detail__header h1 { - font-size: clamp(2rem, 4vw, 3.5rem); + font-size: clamp(2rem, 4.8vw, 4.75rem); letter-spacing: -0.05em; line-height: 1.1; margin: 0; } .album-detail__artists { - font-size: 1.15rem; - margin: 0.5rem 0 0; + color: var(--muted); + font-size: 1.25rem; + margin: 0.75rem 0 0; +} +.album-detail__rating { + display: flex; + flex-wrap: wrap; + align-items: baseline; + gap: 0.375rem 0.75rem; + color: var(--muted); + font-size: 0.875rem; + margin: 1rem 0 1.25rem; +} +.album-detail__rating-value { + color: var(--accent); +} +.album-detail__rating strong { + font-size: 1.125rem; +} +.album-detail__info .genre-tags { + margin: 0 0 1.25rem; +} +.album-detail__info .genre-tags li { + border: 1px solid var(--border-strong); + border-radius: 100px; + padding: 0.25rem 0.625rem; + font-size: 0.75rem; + background: transparent; } .album-detail__columns { display: grid; @@ -79,6 +118,9 @@ font-size: 0.85rem; } @media (max-width: 700px) { + .album-detail__header { + grid-template-columns: 1fr; + } .album-detail__columns { grid-template-columns: 1fr; } diff --git a/client/src/pages/AlbumDetailPage.test.tsx b/client/src/pages/AlbumDetailPage.test.tsx index c223004..921a96d 100644 --- a/client/src/pages/AlbumDetailPage.test.tsx +++ b/client/src/pages/AlbumDetailPage.test.tsx @@ -2,7 +2,7 @@ import { MockedProvider } from '@apollo/client/testing/react'; import { fireEvent, render, screen, within } from '@testing-library/react'; import { expect, it } from 'vitest'; -import { ALBUM_DETAIL } from '../api/albumDetail.js'; +import { ALBUM_DETAIL, type AlbumDetail } from '../api/albumDetail.js'; import AlbumDetailPage from './AlbumDetailPage.js'; const variables = { id: '1', reviewFirst: 10, reviewAfter: null }; @@ -39,31 +39,90 @@ const detail = { }, }; -it('renders an album tracklist and its first page of reviews', async () => { - render( +function renderDetail(overrides: Partial = {}) { + return render( , ); +} + +it('renders an album tracklist and its first page of reviews', async () => { + renderDetail(); - expect(await screen.findByRole('heading', { name: 'Abbey Road' })).toBeInTheDocument(); + const heading = await screen.findByRole('heading', { name: 'Abbey Road' }); + const header = heading.closest('header')!; + expect(header).toHaveTextContent(/Album.*1969/); + expect(within(header).getByText('The Beatles')).toBeInTheDocument(); + expect(within(header).getByRole('list', { name: 'Genres' })).toHaveTextContent('Rock'); + expect(header).toHaveTextContent('4.5 out of 5'); + expect(within(header).getByText('1 review')).toBeInTheDocument(); + expect(within(header).getByRole('button', { name: 'Add to crate' })).toHaveAttribute( + 'aria-pressed', + 'false', + ); + expect(header.querySelector('.album-detail__artwork')).toHaveAttribute( + 'aria-hidden', + 'true', + ); + expect(header.querySelector('img')).not.toBeInTheDocument(); const tracklist = screen.getByRole('region', { name: 'Tracklist' }); expect(within(tracklist).getByText('Come Together')).toBeInTheDocument(); expect(within(tracklist).getByText('4:19')).toBeInTheDocument(); expect(within(tracklist).getByText('Something')).toBeInTheDocument(); const reviews = screen.getByRole('region', { name: 'Reviews' }); + expect(within(reviews).queryByText(/out of 5/)).not.toBeInTheDocument(); expect(within(reviews).getByText('Listener user-1')).toBeInTheDocument(); expect(within(reviews).getByText('A classic.')).toBeInTheDocument(); expect(within(reviews).getByLabelText('5 out of 5 stars')).toBeInTheDocument(); }); +it('omits missing secondary metadata and shows an unrated album without broken artwork', async () => { + renderDetail({ + title: '', + artists: [], + releaseYear: null, + genres: [], + averageRating: null, + reviewCount: 0, + reviews: { ...detail.reviews, edges: [], totalCount: 0 }, + }); + const header = (await screen.findByRole('heading', { name: 'Untitled album' })).closest( + 'header', + )!; + expect(within(header).getByText('Album')).toBeInTheDocument(); + expect(header.querySelector('.album-detail__artists')).not.toBeInTheDocument(); + expect(within(header).queryByRole('list', { name: 'Genres' })).not.toBeInTheDocument(); + expect(header).not.toHaveTextContent(/unknown|out of 5/i); + expect(header).toHaveTextContent('Not yet rated'); + expect(header).toHaveTextContent('0 reviews'); + expect(header.querySelector('img')).not.toBeInTheDocument(); + expect(within(header).getByRole('button', { name: 'Add to crate' })).toBeEnabled(); +}); + +it('keeps very long titles and multiple artist names in full', async () => { + const title = 'VeryLongAlbumTitle'.repeat(12); + const artist = 'AnArtistWithAnUnusuallyLongName'.repeat(6); + renderDetail({ + title, + artists: [ + { id: '1', name: artist }, + { id: '2', name: 'Guest artist' }, + ], + }); + expect( + await screen.findByRole('heading', { level: 1, name: title }), + ).toBeInTheDocument(); + expect(screen.getByText(artist + ', Guest artist')).toBeInTheDocument(); +}); + it.each([ ['1', 'You'], ['2', 'Listener user-1'], diff --git a/client/src/pages/AlbumDetailPage.tsx b/client/src/pages/AlbumDetailPage.tsx index a32170a..cde9f75 100644 --- a/client/src/pages/AlbumDetailPage.tsx +++ b/client/src/pages/AlbumDetailPage.tsx @@ -1,3 +1,4 @@ +import '../components/AlbumCard.css'; import './AlbumDetailPage.css'; import { useState } from 'react'; @@ -83,6 +84,11 @@ export default function AlbumDetailPage({ id }: { id: string }) { const { album } = data; const reviews = album.reviews.edges.map((edge) => edge.node); + const artists = album.artists + .map((artist) => artist.name) + .filter(Boolean) + .join(', '); + const rating = album.reviewCount > 0 ? album.averageRating : null; return (
@@ -90,18 +96,37 @@ export default function AlbumDetailPage({ id }: { id: string }) { ← Back to discovery
-

Album

-

{album.title}

-

- {album.artists.map((artist) => artist.name).join(', ')} -

-

{album.releaseYear ?? 'Release year unknown'}

- -
    - {album.genres.map((genre) => ( -
  • {genre.name}
  • - ))} -
+ +
+

+ Album{album.releaseYear !== null && <> · {album.releaseYear}} +

+

{album.title || 'Untitled album'}

+ {artists &&

{artists}

} +

+ {rating === null ? ( + Not yet rated + ) : ( + + {rating.toFixed(1)} out of 5 + + )} + + {album.reviewCount.toLocaleString('en-US')}{' '} + {album.reviewCount === 1 ? 'review' : 'reviews'} + +

+ {album.genres.length > 0 && ( +
    + {album.genres.map((genre) => ( +
  • {genre.name}
  • + ))} +
+ )} + +
@@ -123,11 +148,6 @@ export default function AlbumDetailPage({ id }: { id: string }) {

Reviews

-

- {album.averageRating === null - ? `Not yet rated · ${album.reviewCount} reviews` - : `${album.averageRating.toFixed(1)} out of 5 · ${album.reviewCount} reviews`} -

{reviews.length === 0 ? (

No reviews yet.

From ab0bbe7aa6b27a20788e7d7d7e19d60defe1cffd Mon Sep 17 00:00:00 2001 From: Rachel Knutsen Stiansen Date: Sun, 8 Nov 2026 15:03:12 +0100 Subject: [PATCH 2/8] feat: #70 redesign album detail tracklist --- client/src/pages/AlbumDetailPage.css | 33 ++++++++++-------- client/src/pages/AlbumDetailPage.test.tsx | 42 +++++++++++++++++++++++ client/src/pages/AlbumDetailPage.tsx | 24 +++++++++++-- 3 files changed, 83 insertions(+), 16 deletions(-) diff --git a/client/src/pages/AlbumDetailPage.css b/client/src/pages/AlbumDetailPage.css index de0c456..4394d27 100644 --- a/client/src/pages/AlbumDetailPage.css +++ b/client/src/pages/AlbumDetailPage.css @@ -73,24 +73,29 @@ padding: 0; list-style: none; } -.tracklist { - counter-reset: tracks; -} .tracklist li { border-bottom: 1px solid var(--border); - counter-increment: tracks; - display: flex; - gap: 0.75rem; - justify-content: space-between; - padding: 0.65rem 0; + display: grid; + grid-template-columns: 3ch minmax(0, 1fr) auto; + align-items: center; + gap: 0.5rem; + min-height: 4rem; + padding-block: 0.875rem; + font-size: 0.875rem; } -.tracklist li::before { +.tracklist__number, +.tracklist__duration { color: var(--muted); - content: counter(tracks); - min-width: 1.5rem; + font-size: 0.8125rem; + font-variant-numeric: tabular-nums; } -.tracklist li > span:first-of-type { - flex: 1; +.tracklist__duration { + text-align: right; + white-space: nowrap; +} +.tracklist__title { + min-width: 0; + overflow-wrap: anywhere; } .review-list { display: grid; @@ -122,6 +127,6 @@ grid-template-columns: 1fr; } .album-detail__columns { - grid-template-columns: 1fr; + grid-template-columns: minmax(0, 1fr); } } diff --git a/client/src/pages/AlbumDetailPage.test.tsx b/client/src/pages/AlbumDetailPage.test.tsx index 921a96d..c98f289 100644 --- a/client/src/pages/AlbumDetailPage.test.tsx +++ b/client/src/pages/AlbumDetailPage.test.tsx @@ -74,6 +74,8 @@ it('renders an album tracklist and its first page of reviews', async () => { ); expect(header.querySelector('img')).not.toBeInTheDocument(); const tracklist = screen.getByRole('region', { name: 'Tracklist' }); + expect(within(tracklist).getByText('On the record')).toBeInTheDocument(); + expect(tracklist.querySelector('a, button, [tabindex]')).toBeNull(); expect(within(tracklist).getByText('Come Together')).toBeInTheDocument(); expect(within(tracklist).getByText('4:19')).toBeInTheDocument(); expect(within(tracklist).getByText('Something')).toBeInTheDocument(); @@ -123,6 +125,46 @@ it('keeps very long titles and multiple artist names in full', async () => { expect(screen.getByText(artist + ', Guest artist')).toBeInTheDocument(); }); +it('shows API track numbers in returned order with full titles and formatted durations', async () => { + const title = 'VeryLongTrackTitle'.repeat(12); + renderDetail({ + tracks: [ + { id: 'a', trackNumber: 12, title, durationSeconds: 65 }, + { id: 'b', trackNumber: 3, title: 'Second track', durationSeconds: 0 }, + { id: 'c', trackNumber: 123, title: 'Final track', durationSeconds: 3601 }, + ], + }); + const rows = within( + await screen.findByRole('region', { name: 'Tracklist' }), + ).getAllByRole('listitem'); + expect(rows).toHaveLength(3); + expect(within(rows[0]!).getByText('12')).toBeInTheDocument(); + expect(within(rows[0]!).getByText(title)).toBeInTheDocument(); + expect(within(rows[0]!).getByText('1:05')).toBeInTheDocument(); + expect(within(rows[1]!).getByText('03')).toBeInTheDocument(); + expect(within(rows[1]!).getByText('0:00')).toBeInTheDocument(); + expect(within(rows[2]!).getByText('123')).toBeInTheDocument(); + expect(within(rows[2]!).getByText('60:01')).toBeInTheDocument(); +}); + +it('provides accessible fallbacks for unavailable track metadata', async () => { + renderDetail({ + tracks: [{ id: 'a', trackNumber: 0, title: 'Untimed track', durationSeconds: null }], + }); + const tracklist = await screen.findByRole('region', { name: 'Tracklist' }); + expect(within(tracklist).getByText('Untimed track')).toBeInTheDocument(); + expect(within(tracklist).getByText('Track number unavailable')).toBeInTheDocument(); + expect(within(tracklist).getByText('Duration unavailable')).toBeInTheDocument(); + expect(within(tracklist).queryByText('01')).not.toBeInTheDocument(); +}); + +it('preserves the empty-tracklist message', async () => { + renderDetail({ tracks: [] }); + const tracklist = await screen.findByRole('region', { name: 'Tracklist' }); + expect(within(tracklist).getByText('No tracklist is available.')).toBeInTheDocument(); + expect(within(tracklist).queryByRole('list')).not.toBeInTheDocument(); +}); + it.each([ ['1', 'You'], ['2', 'Listener user-1'], diff --git a/client/src/pages/AlbumDetailPage.tsx b/client/src/pages/AlbumDetailPage.tsx index cde9f75..c58a5b2 100644 --- a/client/src/pages/AlbumDetailPage.tsx +++ b/client/src/pages/AlbumDetailPage.tsx @@ -131,6 +131,7 @@ export default function AlbumDetailPage({ id }: { id: string }) {
+

On the record

Tracklist

{album.tracks.length === 0 ? (

No tracklist is available.

@@ -138,8 +139,27 @@ export default function AlbumDetailPage({ id }: { id: string }) {
    {album.tracks.map((track) => (
  1. - {track.title} - {formatDuration(track.durationSeconds)} + + {track.trackNumber > 0 ? ( + String(track.trackNumber).padStart(2, '0') + ) : ( + <> + + Track number unavailable + + )} + + {track.title} + + {track.durationSeconds === null ? ( + <> + + Duration unavailable + + ) : ( + formatDuration(track.durationSeconds) + )} +
  2. ))}
From f630bb08f90a053cc9e54dacdb41c25d81b0d9d6 Mon Sep 17 00:00:00 2001 From: Rachel Knutsen Stiansen Date: Sun, 8 Nov 2026 15:37:08 +0100 Subject: [PATCH 3/8] feat: #70 redesign ratings and reviews --- client/src/components/ReviewForm.css | 49 +++++++-- client/src/components/ReviewForm.test.tsx | 118 ++++++++++++++++++++-- client/src/components/ReviewForm.tsx | 35 ++++++- client/src/pages/AlbumDetailPage.css | 55 ++++++++-- client/src/pages/AlbumDetailPage.test.tsx | 115 ++++++++++++++++++++- client/src/pages/AlbumDetailPage.tsx | 65 +++++++++--- 6 files changed, 392 insertions(+), 45 deletions(-) diff --git a/client/src/components/ReviewForm.css b/client/src/components/ReviewForm.css index 6fa4480..fc39961 100644 --- a/client/src/components/ReviewForm.css +++ b/client/src/components/ReviewForm.css @@ -1,13 +1,19 @@ .review-form { - border-top: 1px solid var(--border); + border: 1px solid var(--border); + border-radius: 4px; + background: var(--surface); + min-width: 0; + overflow-wrap: anywhere; margin-top: 1.25rem; - padding-top: 1.25rem; + padding: clamp(0.75rem, 2.5vw, 1.5rem); } .review-form h3 { font-size: 1rem; + margin: 0 0 1rem; } .review-form fieldset { border: 0; + min-width: 0; margin: 0 0 1rem; padding: 0; } @@ -20,14 +26,35 @@ .review-form__ratings { display: flex; flex-wrap: wrap; - gap: 0.4rem 0.75rem; + gap: 0.375rem; } .review-form__ratings label { - align-items: center; + position: relative; cursor: pointer; - display: flex; - gap: 0.25rem; - padding: 0.35rem 0.5rem; + display: grid; + place-items: center; + min-width: 2.75rem; + min-height: 2.75rem; + padding: 0.25rem; + color: var(--border-strong); + border-radius: 3px; +} +.review-form__ratings .review-form__star--filled { + color: var(--accent); +} +.review-form__ratings label:has(input:focus-visible) { + outline: 3px solid var(--focus); + outline-offset: 3px; +} +.review-form__ratings svg { + display: block; + width: 1.5rem; + height: 1.5rem; +} +.review-form__rating-hint { + color: var(--muted); + font-size: 0.875rem; + margin: 0.5rem 0 0; } .review-form textarea { background: var(--surface); @@ -39,6 +66,8 @@ padding: 0.65rem 0.75rem; resize: vertical; width: 100%; + min-width: 0; + max-width: 100%; } .review-form__actions { display: flex; @@ -46,6 +75,12 @@ gap: 0.6rem; margin-top: 1rem; } +.review-form__actions button { + max-width: 100%; + min-height: 2.75rem; + white-space: normal; + overflow-wrap: anywhere; +} .secondary-button { background: transparent; border: 1px solid var(--accent); diff --git a/client/src/components/ReviewForm.test.tsx b/client/src/components/ReviewForm.test.tsx index 5703111..5bad403 100644 --- a/client/src/components/ReviewForm.test.tsx +++ b/client/src/components/ReviewForm.test.tsx @@ -2,7 +2,10 @@ import { MockedProvider } from '@apollo/client/testing/react'; import { fireEvent, render, screen, waitFor } from '@testing-library/react'; import { expect, it, vi } from 'vitest'; -import { UPSERT_REVIEW } from '../api/reviews.js'; +import userEvent from '@testing-library/user-event'; +import axe from 'axe-core'; + +import { DELETE_REVIEW, UPSERT_REVIEW } from '../api/reviews.js'; import ReviewForm from './ReviewForm.js'; it('requires an accessible 1 to 5 star choice before it saves', () => { @@ -24,7 +27,11 @@ it('requires an accessible 1 to 5 star choice before it saves', () => { ); }); -it('saves the selected rating and optional comment', async () => { +it.each([ + { review: null, comment: '' }, + { review: null, comment: 'A classic.' }, + { review: { id: '1', rating: 2, comment: 'Before' }, comment: 'A classic.' }, +])('publishes or updates a review with %j', async ({ review, comment }) => { const onChanged = vi.fn(() => Promise.resolve(undefined)); render( { { request: { query: UPSERT_REVIEW, - variables: { input: { albumId: '1', rating: 5, comment: 'A classic.' } }, + variables: { input: { albumId: '1', rating: 5, comment } }, }, result: { data: { upsertReview: { - review: { id: '1', rating: 5, comment: 'A classic.' }, + review: { id: '1', rating: 5, comment }, album: { id: '1' }, }, }, @@ -45,18 +52,113 @@ it('saves the selected rating and optional comment', async () => { }, ]} > - + , ); + if (review) { + expect(screen.getByRole('radio', { name: '2 stars' })).toBeChecked(); + expect(screen.getByRole('textbox')).toHaveValue('Before'); + } fireEvent.click(screen.getByRole('radio', { name: '5 stars' })); fireEvent.change(screen.getByRole('textbox', { name: /comment/i }), { - target: { value: 'A classic.' }, + target: { value: comment }, }); - fireEvent.click(screen.getByRole('button', { name: 'Publish review' })); + fireEvent.click( + screen.getByRole('button', { name: review ? 'Save changes' : 'Publish review' }), + ); await waitFor(() => expect(onChanged).toHaveBeenCalledOnce()); const status = await screen.findByRole('status'); - expect(status).toHaveTextContent('Your review was published.'); + expect(status).toHaveTextContent( + review ? 'Your review was updated.' : 'Your review was published.', + ); + expect(status).toHaveFocus(); +}); + +it('uses native radio keyboard navigation and exposes the selected rating', async () => { + const { container } = render( + +
+ +
+
, + ); + const user = userEvent.setup(); + await user.tab(); + expect(screen.getByRole('radio', { name: '1 star' })).toHaveFocus(); + await user.keyboard('{ArrowRight}{ArrowRight}{ArrowLeft}'); + const two = screen.getByRole('radio', { name: '2 stars' }); + expect(two).toBeChecked(); + expect(two).toHaveFocus(); + expect(screen.getByRole('group', { name: 'Rating' })).toHaveAccessibleDescription( + '2 out of 5 stars', + ); + await user.tab(); + expect(screen.getByRole('textbox')).toHaveFocus(); + const audit = await axe.run(container, { + rules: { 'color-contrast': { enabled: false } }, + }); + expect(audit.violations.map((v) => v.id)).toEqual([]); +}); + +it('deletes an existing review and clears the form', async () => { + const onChanged = vi.fn(async () => {}); + render( + + + , + ); + await userEvent.setup().click(screen.getByRole('button', { name: 'Delete review' })); + const status = await screen.findByRole('status'); + expect(status).toHaveTextContent('Your review was deleted.'); expect(status).toHaveFocus(); + expect(onChanged).toHaveBeenCalledOnce(); + expect(screen.getByRole('textbox')).toHaveValue(''); + expect(screen.queryByRole('radio', { checked: true })).not.toBeInTheDocument(); }); + +it.each(['save', 'delete'])( + 'keeps the review editable after a %s error', + async (action) => { + const onChanged = vi.fn(); + const request = + action === 'save' + ? { + query: UPSERT_REVIEW, + variables: { input: { albumId: '1', rating: 4, comment: 'My review' } }, + } + : { query: DELETE_REVIEW, variables: { id: 'r1' } }; + render( + + + , + ); + await userEvent.setup().click( + screen.getByRole('button', { + name: action === 'save' ? 'Save changes' : 'Delete review', + }), + ); + expect(await screen.findByRole('alert')).toHaveTextContent('Offline'); + expect(screen.getByRole('textbox')).toHaveValue('My review'); + expect(screen.getByRole('radio', { name: '4 stars' })).toBeChecked(); + expect(onChanged).not.toHaveBeenCalled(); + }, +); diff --git a/client/src/components/ReviewForm.tsx b/client/src/components/ReviewForm.tsx index 80ca9c2..248b909 100644 --- a/client/src/components/ReviewForm.tsx +++ b/client/src/components/ReviewForm.tsx @@ -70,24 +70,49 @@ export default function ReviewForm({ albumId, review, onChanged }: Props) { } return ( -
void submit(event)}> + void submit(event)} + >

{review ? 'Update your review' : 'Write a review'}

-
+
Rating
{[1, 2, 3, 4, 5].map((value) => ( -
+

+ {rating ? `${rating} out of 5 stars` : 'Select a rating'} +

-
-

Reviews

+
+

Community notes

+

Ratings & reviews

{reviews.length === 0 ? ( -

No reviews yet.

+

+ No reviews yet. Be the first to share what you think. +

) : (
    {reviews.map((review) => ( @@ -182,27 +206,44 @@ export default function AlbumDetailPage({ id }: { id: string }) { ? 'You' : review.user.displayName} - + {'★'.repeat(review.rating)} - {review.comment &&

    {review.comment}

    } + {review.comment &&

    {review.comment}

    } ))}
)} +

+ {loadingMoreReviews + ? 'Loading reviews…' + : reviews.length > 0 + ? `${reviews.length.toLocaleString('en-US')} of ${album.reviews.totalCount.toLocaleString('en-US')} reviews loaded.` + : ''} +

{album.reviews.pageInfo.hasNextPage && ( )} {reviewsError &&

{reviewsError}

} From 903f2d44273efe3293e59f5de5d067fcbb3da6f0 Mon Sep 17 00:00:00 2001 From: Rachel Knutsen Stiansen Date: Sun, 8 Nov 2026 15:52:05 +0100 Subject: [PATCH 4/8] style: #70 refine album detail back navigation --- client/src/pages/AlbumDetailPage.css | 23 +++++++++++++++++++++-- client/src/pages/AlbumDetailPage.test.tsx | 2 +- client/src/pages/AlbumDetailPage.tsx | 4 ++-- 3 files changed, 24 insertions(+), 5 deletions(-) diff --git a/client/src/pages/AlbumDetailPage.css b/client/src/pages/AlbumDetailPage.css index 96034b9..a9f0b93 100644 --- a/client/src/pages/AlbumDetailPage.css +++ b/client/src/pages/AlbumDetailPage.css @@ -1,9 +1,28 @@ .album-detail { padding-block: 2rem 3rem; } -.back-link { +.album-detail .back-link { + display: inline-flex; + align-items: center; + min-height: 44px; + max-width: 100%; + padding: 0.5rem 0.875rem; + border: 1px solid var(--border-strong); + border-radius: 999px; + background: var(--surface); color: var(--accent); - font-weight: 700; + font-size: 0.875rem; + font-weight: 600; + text-decoration: none; + overflow-wrap: anywhere; +} +.album-detail .back-link:hover { + background: var(--surface-raised); + border-color: var(--accent); +} +.album-detail .back-link:focus-visible { + outline: 3px solid var(--focus); + outline-offset: 4px; } .album-detail__header { display: grid; diff --git a/client/src/pages/AlbumDetailPage.test.tsx b/client/src/pages/AlbumDetailPage.test.tsx index a2307d3..2022376 100644 --- a/client/src/pages/AlbumDetailPage.test.tsx +++ b/client/src/pages/AlbumDetailPage.test.tsx @@ -215,7 +215,7 @@ it('shows a useful error state when an album cannot be loaded', async () => { ); expect(await screen.findByRole('alert')).toHaveTextContent('could not load this album'); - expect(screen.getByRole('link', { name: '← Back to discovery' })).toHaveAttribute( + expect(screen.getByRole('link', { name: '← Back to Discover' })).toHaveAttribute( 'href', `${import.meta.env.BASE_URL}?q=Abbey&sort=TITLE_ASC`, ); diff --git a/client/src/pages/AlbumDetailPage.tsx b/client/src/pages/AlbumDetailPage.tsx index d6c6bdb..36b9c6e 100644 --- a/client/src/pages/AlbumDetailPage.tsx +++ b/client/src/pages/AlbumDetailPage.tsx @@ -95,7 +95,7 @@ export default function AlbumDetailPage({ id }: { id: string }) { return (
- ← Back to discovery + ← Back to Discover

Album unavailable

We could not load this album. Please try again.

@@ -114,7 +114,7 @@ export default function AlbumDetailPage({ id }: { id: string }) { return (
- ← Back to discovery + ← Back to Discover