feat(#421): add CreatorCardSkeleton matching CreatorCard layout#471
Open
Topmatrixmor2014 wants to merge 1 commit into
Open
feat(#421): add CreatorCardSkeleton matching CreatorCard layout#471Topmatrixmor2014 wants to merge 1 commit into
Topmatrixmor2014 wants to merge 1 commit into
Conversation
…d layout - Add new CreatorCardSkeleton component that mirrors CreatorCard's dimensions (avatar, name + verified/change/supply/recent-activity badges, handle, bio, sparkline placeholder, 3 mini stat chips, 3 meta rows, social links, action row, helper text) so it acts as a layout-stable placeholder while the creator list is fetching. - Use the existing dark-theme .skeleton-shimmer animation and CREATOR_CARD_MEDIA_RADIUS_CLASS token so the skeleton visually matches the rest of the marketplace. - Respect prefers-reduced-motion via the shared CSS rule and a disableShimmer prop, matching CreatorSkeleton's API. - Add a CreatorCardGridSkeleton helper that defaults to count = 6 to satisfy the acceptance criterion. - Wire CreatorCardGridSkeleton into LandingPage's initial-loading branch so the marketplace shows 6 stable skeleton cards instead of the generic grid skeleton. - Cover the new component with vitest tests asserting role/aria coverage, 6-by-default grid, disableShimmer propagation, className merging, and shimmer-vs-static block toggling.
|
@Topmatrixmor2014 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a dedicated CreatorCardSkeleton component that mirrors the dimensions of the live
CreatorCardso the marketplace shows a layout-stable loading placeholder while the creator list is still fetching. Previously the page rendered a generic grid skeleton that did not match card dimensions, causing context loss when real cards arrived.Fixes #421.
Acceptance criteria
LandingPageswapsCreatorGridSkeleton→CreatorCardGridSkeletonin the initial-loading branch..skeleton-shimmerkeyframe / class already defined insrc/index.css. Blocks usebg-white/12with a slightly brighter static ring (bg-white/16 ring-1 ring-white/15) for the reduced-motion fallback — identical tokens used by the siblingCreatorSkeletoncomponent.CreatorCardat the same height / width / spacing tokens (avatar, name+badges row, handle, bio, sparkline placeholder, mini stat chips, 3 meta rows, social links, action row, helper text).CreatorCardGridSkeletondefaults tocount = 6, matching the live first-page footprint onLandingPage.What changed
New files
src/components/common/CreatorCardSkeleton.tsx— single-card placeholder that replicatesCreatorCardsection by section. Exposes a matchingdisableShimmerprop for parity withCreatorSkeleton. Includesrole="status"+aria-label="Loading creator card"+ sr-only span, mirroring the accessibility pattern used byCreatorProfileHeaderSkeleton.src/components/common/__tests__/CreatorCardSkeleton.test.tsx— 7 vitest specs covering: shimmer rendering,disableShimmerstatic fallback,classNamemerging, defaultcount === 6, customcount,disableShimmerpropagation to every grid card, and gridclassNamemerging. Each assertion uses real RTL queries (getByRole,getByTestId,querySelectorAll) so the tests fail loudly if dimensions or structure regress.Modified files
src/pages/LandingPage.tsx— initial-loading branch now renders<CreatorCardGridSkeleton count={6} />instead of<CreatorGridSkeleton count={6} />so the marketplace shows dimensionally-stable placeholders while data is fetching. The genericCreatorGridSkeletonexport is left in place for any callers that still rely on it.Untouched
src/components/common/CreatorSkeleton.tsx,src/utils/creatorCardTokens.ts,src/index.css— the new component reuses the existing.skeleton-shimmerCSS keyframe and theCREATOR_CARD_MEDIA_RADIUS_CLASStoken, so no style or token regressions are introduced.How the new skeleton maps to
CreatorCardCreatorCardsectionCreatorCardSkeletonblockrounded-2xl border p-4 marketplace-card-surfacesize-8 rounded-fullplaceholderaspect-square)aspect-square overflow-hidden ${CREATOR_CARD_MEDIA_RADIUS_CLASS}h-6name + 3 small badge placeholders.marketplace-label-muted)h-4lineCreatorBio)h-3linesh-10 w-full rounded-lgCreatorCardalready uses these exact tokens)h-6rounded placeholdersCreatorListRowDividerNetworkFeeHint+ Buy button)h-4fee hint +h-9 w-24 rounded-xlbuttonBuyActionHelperText)h-3trailing barBecause the structure and sizes are identical, swapping the skeleton for real cards produces zero visible reflow.
Reduced-motion
The
.skeleton-shimmerCSS rule already includes its own@media (prefers-reduced-motion: reduce)fallback (stops the animation and flattens the gradient). On top of that, every block carries Tailwindmotion-reduce:bg-white/18 motion-reduce:ring-1 motion-reduce:ring-white/15for users whose motion setting prefers a hard-edged static state. Callers that already suppress shimmer at a higher level can passdisableShimmerto opt out per-instance.Accessibility
role="status"on the wrapper announces the loading state to assistive tech.aria-label="Loading creator card"on the wrapper (verified viagetByRole(status, { name: ... })in tests).CreatorProfileHeaderSkeletonpattern.Testing
New tests (all passing locally)
Full validation suite (local)
pnpm tsc -p tsconfig.app.json --noEmitpnpm vitest run src/components/common/__tests__/CreatorCardSkeleton.test.tsx src/components/common/__tests__/CreatorSkeleton.test.tsxpnpm eslint src/components/common/CreatorCardSkeleton.tsx src/components/common/__tests__/CreatorCardSkeleton.test.tsx src/pages/LandingPage.tsxKnown unrelated issue (transparency)
src/pages/__tests__/LandingPage.keyboard.test.tsxfails on pristinemaintoo (verified withgit stash+ rerun). The failure isError: useLocation() may be used only in the context of a <Router> component.atLandingPage.tsx:284because the test renders<LandingPage />without a<MemoryRouter>wrapper. It pre-dates this PR and is intentionally left out of scope.Suggested CI follow-up
This is the natural time to land a small fix for the LandingPage keyboard test (wrap the render in
<MemoryRouter>). Happy to follow up with that in a separate PR if wanted.Risk / impact
LandingPage. Once creators resolve, the sameCreatorCardpath renders as before. The genericCreatorGridSkeletonis still exported, so any out-of-tree consumer keeps working.Checklist
pnpm tsc -p tsconfig.app.json --noEmitcleanpnpm eslinton touched files cleanpnpm vitest runon touched files cleanCreatorGridSkeletonfrom the named-imports block)feat/issue-421-creator-card-skeletonpushed to forkdevper the project'spr-target-check.ymlworkflow/closes #421
closes #421