Skip to content

[Appdir] Thumbnail recoloring #3776

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open

[Appdir] Thumbnail recoloring #3776

wants to merge 9 commits into from

Conversation

KenAJoh
Copy link
Collaborator

@KenAJoh KenAJoh commented May 7, 2025

Description

Colors thumbnail based on status
Screenshot 2025-05-07 at 14 18 56
Screenshot 2025-05-07 at 14 19 02

Component Checklist 📝

  • JSDoc
  • Examples
  • Documentation / Decision Records
  • Storybook
  • Style mappings (@navikt/core/css/config/_mappings.js)
  • Component tokens (@navikt/core/css/tokens.json)
  • CSS class deprecations (@navikt/aksel-stylelint/src/deprecations.ts)
  • Exports (@navikt/core/react/src/index.ts and @navikt/core/react/package.json)
  • New component? CSS import (@navikt/core/css/index.css)
  • Breaking change? Update migration guide. Consider codemod.
  • Changeset (Format: <Component>: <gitmoji?> <Text>. E.g. "Button: ✨ Add feature xyz.")

@KenAJoh KenAJoh requested a review from Copilot May 7, 2025 12:20
Copy link

changeset-bot bot commented May 7, 2025

⚠️ No Changeset found

Latest commit: 9df11c5

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the thumbnail rendering by recoloring images based on status, migrating from NextImage and custom SVG fallbacks to a new utility component, ImageAsThemedSvg.

  • Replaces NextImage with ImageAsThemedSvg in DesignsystemetOverviewCard
  • Updates DesignsystemetPage and DesignsystemetThumbnail to use the new thumbnail URL and rendering logic
  • Introduces a new utility component for fetching and sanitizing SVG images with dynamic color replacements

Reviewed Changes

Copilot reviewed 4 out of 7 changed files in this pull request and generated no comments.

File Description
aksel.nav.no/website/app/dev/(designsystemet)/_ui/overview/DesignsystemetOverview.tsx Replaces NextImage/FallbackSvg with ImageAsThemedSvg and re-arranges layout for status tag positioning
aksel.nav.no/website/app/dev/(designsystemet)/_ui/DesignsystemetPage.tsx Passes thumbnailUrl to DesignsystemetThumbnail and adds data attributes for styling
aksel.nav.no/website/app/dev/(designsystemet)/_ui/Designsystemet.thumbnail.tsx Refactors thumbnail component to conditionally render SVG based on thumbnailUrl
aksel.nav.no/website/app/_ui/image-as-svg/ImageAsSvg.tsx Adds a new async component for fetching, recoloring, and sanitizing SVG images using DOMPurify
Files not reviewed (3)
  • aksel.nav.no/website/app/_ui/image-as-svg/ImageAsSvg.module.css: Language not supported
  • aksel.nav.no/website/app/dev/(designsystemet)/_ui/Designsystemet.module.css: Language not supported
  • aksel.nav.no/website/app/dev/(designsystemet)/_ui/overview/DesignsystemetOverview.module.css: Language not supported
Comments suppressed due to low confidence (1)

aksel.nav.no/website/app/_ui/image-as-svg/ImageAsSvg.tsx:7

  • The async component ImageAsThemedSvg is used directly within JSX in other components. Please ensure that its asynchronous behavior is properly handled by its consumers (e.g., by using server components or Suspense) to prevent potential rendering issues.
async function ImageAsThemedSvg({

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant