Skip to content

[Aksel.nav.no] Migrated more components over to new PortableText component #3689

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

Merged
merged 21 commits into from
Mar 24, 2025

Conversation

KenAJoh
Copy link
Collaborator

@KenAJoh KenAJoh commented Mar 24, 2025

Description

Flyttet/Skrevet om "moduler" til å fungere med App-router og ny PortableText struktur. Bruker nå typene hentet direkte fra sanity for bedre typesjekking.

Endringer i Sanity

Fjernet ubrukte/unike typer som ikke var nødvendige:

Type removals:

  • Removed the Innholdskort type definition.
  • Removed the Tastatur_modul type definition.
  • Removed the Herobilde type definition.

Property removals:

  • Removed the hero_bilde property from the Aksel_prinsipp type.
  • Removed the Tastatur_modul from the Riktekst_komponent type.

Property additions:

  • Added return, params, and example properties to the Ds_props type.

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 March 24, 2025 08:48
Copy link

changeset-bot bot commented Mar 24, 2025

⚠️ No Changeset found

Latest commit: bbd1928

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 migrates several components over to use the new PortableText component and cleans up unused Sanity types. Key changes include updating UI components (such as RelatertInnhold, Bilde, PropsSeksjon, Tips, etc.) to work with the new structure, removing obsolete Sanity type definitions and properties, and adjusting utility functions (e.g. getStatusTag) to support the migration.

Reviewed Changes

Copilot reviewed 42 out of 48 changed files in this pull request and generated no comments.

Show a summary per file
File Description
RelatertInnhold.tsx Introduces a new component for rendering related content links.
Bilde.tsx Updates the image component to work with the new Sanity image utilities.
PropsSeksjon.tsx Refactors the prop table component including injection of an overridable prop.
Tips.tsx Adds a component for rendering tip blocks.
types.ts Removes unused types and adds new properties to Ds_props for better type‐checking.
query-types.ts Cleans up deprecated type definitions and properties in the Sanity schema.
theme-config.ts Updates getStatusTag to accept an additional parameter for excluding stable tags.
Sidebar.item.tsx Adjusts sidebar item rendering to use the updated status tag logic.
CustomPortableText.components.tsx Integrates new portable text component mappings for a variety of content types.
TableV2.tsx, DoDont.tsx, etc. Additional UI components updated as part of the migration.
Files not reviewed (6)
  • aksel.nav.no/website/app/_ui/bilde/Bilde.module.css: Language not supported
  • aksel.nav.no/website/app/_ui/do-dont/DoDont.module.css: Language not supported
  • aksel.nav.no/website/app/_ui/props-seksjon/PropsSeksjon.module.css: Language not supported
  • aksel.nav.no/website/app/_ui/relatert-innhold/RelatertInnhold.module.css: Language not supported
  • aksel.nav.no/website/app/_ui/tips/Tips.module.css: Language not supported
  • aksel.nav.no/website/app/_ui/typography/Typography.module.css: Language not supported
Comments suppressed due to low confidence (2)

aksel.nav.no/website/app/_ui/theme-config.ts:35

  • The new optional parameter 'ignoreStable' should be documented clearly to ensure that its behavior is well understood by future maintainers and that its usage at call sites (such as in Sidebar.item.tsx) remains intentional.
function getStatusTag(statusTag: StatusTagT, ignoreStable = false) {

aksel.nav.no/website/app/_ui/props-seksjon/PropsSeksjon.tsx:33

  • [nitpick] Since 'propList' is obtained from a filter (thus creating a new array), using push here is acceptable, but consider using a non-mutating approach (like concatenation) if immutability is a concern for future refactors.
if (overridable) { propList.push({ description: "OverridableComponent-api", required: false, name: "as", type: "React.ElementType", _type: "prop", _key: "overridable", }); }

@KenAJoh KenAJoh merged commit be5578a into main Mar 24, 2025
6 of 7 checks passed
@KenAJoh KenAJoh deleted the concat-ds-module-types branch March 24, 2025 18:32
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