Skip to content

Etu 63197 oppdatere badge og tag i kode#182

Open
ceciliehrr wants to merge 12 commits intomainfrom
ETU-63197-oppdatere-badge-og-tag-i-kode
Open

Etu 63197 oppdatere badge og tag i kode#182
ceciliehrr wants to merge 12 commits intomainfrom
ETU-63197-oppdatere-badge-og-tag-i-kode

Conversation

@ceciliehrr
Copy link
Contributor

💡 Hvorfor?

Badge-forbedringer:

  • Badge trengte bedre styling med design tokens for å være konsistent med designsystemet
  • Støtte for ulike størrelser (small, medium, large) manglet
  • Tekst skal bruke riktig typografi-komponent
  • Leading icon support - for å kunne legge for eksempel en required-badge på formelementer

Tag deprecation:

  • Tag-komponenten er overflødig ettersom Badge med variant="neutral" kan dekke samme bruksområde
  • Ved å deprecate Tag reduserer vi duplikering og vedlikeholdsbyrde

Nytt ikon:

  • Required ikon for obligatoriske form-elementer

🔧 Hvordan?

Badge-forbedringer:

  1. Ny size prop - Støtte for small, medium (default), large
  2. Typography integration - Bruker <Text> fra @entur/typography/beta for riktig tekststyling
  3. Leading icon support - Detekterer og håndterer ikoner først i children
  4. Design tokens - Byttet hardkodede verdier med tokens fra badge-tokens.scss:
    • Høyde, padding, border-radius bruker nå CSS custom properties
    • Bedre struktur for variants (primary, success, warning, negative, information, neutral)
  5. Forbedret contrast mode - Bedre styling for .eds-contrast context
  6. Icon farger - Ikoner får automatisk riktig farge basert på variant

Tag deprecation:

  1. Oppdatert Tag styling - Tag bruker nå identiske CSS-tokens som Badge neutral
  2. Deprecation-advarsler - JSDoc @deprecated tags med migrasjonsguide
  3. Dokumentasjon - Warning Alert om deprecated tag

🧩 Type endring

  • 🐞 Feilretting
  • 🚀 Ny funksjonalitet (Badge size prop, leading icon support)
  • 💥 Breaking change (bare visuell i tag)
  • 📝 Dokumentasjonsoppdatering
  • 🧹 Refaktorering (Badge styling, Tag deprecation)
  • ⚡️ Ytelsesforbedring
  • 🏗️ Bygg-/CI-endring

🖼️ Skjermbilder

Tag før:
Screenshot 2025-10-30 at 13 32 16

Tag etter:
Screenshot 2025-10-30 at 13 34 00

💬 Tilleggsnotater

  • Ikke en breaking change ennå - Tag fungerer fortsatt
  • Brukere vil se deprecation warnings

✅ Sjekkliste

  • Navnestandarder følges
  • Kode og Figma reflekterer hverandre
  • Dokumentasjonen er oppdatert (tag.mdx med deprecation-varsel)
  • Ingen ubrukte imports / varsler / console.logs

🧪 Testing

  • Testet med skjermleser
  • Testet i Safari og Firefox
  • Testet i dokumentasjonsiden

Copilot AI review requested due to automatic review settings October 30, 2025 12:38
@ceciliehrr ceciliehrr requested a review from a team as a code owner October 30, 2025 12:38
Copy link
Contributor

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 adds icon color support to the Badge component and deprecates the Tag component in favor of Badge. The changes introduce icon-specific color tokens and update Badge styling to support icons with proper color theming.

Key Changes:

  • Added icon color tokens for all badge variants (primary, neutral, information, success, warning, negative) in both standard and contrast modes
  • Enhanced Badge component to support leading icons with proper text wrapping and icon sizing
  • Deprecated Tag component with migration guidance to use Badge with variant="neutral"

Reviewed Changes

Copilot reviewed 9 out of 13 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/tokens/src/component.json Adds icon color tokens for all badge variants in both light and dark themes
packages/layout/src/componentColors.scss Defines CSS custom properties for badge icon colors
packages/layout/src/Tag.tsx Adds deprecation notices and migration guide for Tag component
packages/layout/src/Tag.scss Updates Tag styles to align with Badge neutral variant styling
packages/layout/src/Badge/badge-tokens.scss New file defining badge size and spacing tokens
packages/layout/src/Badge/Badge.tsx Adds size prop, leading icon detection, and Text component wrapping
packages/layout/src/Badge/Badge.scss Updates styling for icon support and size variants
packages/icons/src/svgs/UI/Required*.svg Adds new Required icon variants (Small, Filled, FilledSmall)
apps/documentation/src/pages/komponenter/layout-og-flater/tag.mdx Adds deprecation warning banner
apps/documentation/src/data/props/feedback-props.tsx Adds size and showZero props to badge documentation

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 326 to 328
width: 0.41631rem;
height: 0.46881rem;
margin: 0.17rem 0.17rem 0.14rem 0.17rem;
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

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

Magic numbers are used for icon dimensions and margins. These should be defined as CSS custom properties in badge-tokens.scss for consistency with the rest of the design system (e.g., --layout-badge-status-icon-small already exists at line 71 but isn't being used here).

Copilot uses AI. Check for mistakes.
Comment on lines 361 to 363
width: 0.55506rem;
height: 0.62506rem;
margin: 0.22rem 0.22rem 0.19rem 0.22rem;
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

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

Magic numbers are used for icon dimensions and margins. These should be defined as CSS custom properties in badge-tokens.scss for consistency with the rest of the design system.

Copilot uses AI. Check for mistakes.
Comment on lines 396 to 398
margin: 0.22247rem 0.22247rem 0.18747rem 0.22247rem;
width: 0.69381rem;
height: 0.78131rem;
Copy link

Copilot AI Oct 30, 2025

Choose a reason for hiding this comment

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

Magic numbers are used for icon dimensions and margins. These should be defined as CSS custom properties in badge-tokens.scss for consistency with the rest of the design system.

Copilot uses AI. Check for mistakes.
@ceciliehrr ceciliehrr force-pushed the ETU-63197-oppdatere-badge-og-tag-i-kode branch from 53148a1 to b9a7db3 Compare October 30, 2025 12:41
@github-actions
Copy link

Preview for this PR in prd is available at https://entur-design-system--preview-182-etu-63197-oppdatere-b-9fgkct6v.web.app (Expires in 7d)

@magnusrand magnusrand force-pushed the ETU-63197-oppdatere-badge-og-tag-i-kode branch from d500731 to 316c140 Compare November 21, 2025 08:00
@github-actions
Copy link

Preview for this PR in prd is available at https://entur-design-system--preview-182-etu-63197-oppdatere-b-t6ge0ths.web.app (Expires in 7d)

}

/* Standard */
[view-mode='standard'] {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Endre disse til å være data-view-mode

@@ -0,0 +1,258 @@
@use '@entur/utils/dist/breakpoints.scss' as *;

:root {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Legg ved en kommentar om at disse på sikt skal hentes fra @entur/tokens

displayValue = children > max ? `${max}+` : children;
const displayValue = children > max ? `${max}+` : children;
content = (
<Text as="span" variant="caption" spacing="none">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Usikker på hvor lurt det er av oss å bruke beta-typografien vår i en ikke-beta-komponent

* <Tag compact>Content</Tag>
*
* // New
* <Badge variant="neutral" type="status">Content</Badge>
Copy link
Collaborator

Choose a reason for hiding this comment

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

Burde vi muligens sette neutral som en default? Per nå er det ingen default variant

@magnusrand magnusrand force-pushed the ETU-63197-oppdatere-badge-og-tag-i-kode branch from 316c140 to 4d6f088 Compare December 1, 2025 17:35
@github-actions
Copy link

github-actions bot commented Dec 2, 2025

Preview for this PR in prd is available at https://entur-design-system--preview-182-etu-63197-oppdatere-b-m871toki.web.app (Expires in 7d)

@magnusrand magnusrand force-pushed the ETU-63197-oppdatere-badge-og-tag-i-kode branch from a106c56 to cf1c73d Compare December 3, 2025 10:11
@github-actions
Copy link

github-actions bot commented Dec 3, 2025

Preview for this PR in prd is available at https://entur-design-system--preview-182-etu-63197-oppdatere-b-m871toki.web.app (Expires in 7d)

@magnusrand magnusrand force-pushed the main branch 2 times, most recently from 28d25b2 to 9f8fc08 Compare February 5, 2026 08:25
@magnusrand magnusrand force-pushed the ETU-63197-oppdatere-badge-og-tag-i-kode branch from cf1c73d to b7d72cd Compare February 23, 2026 14:08
@github-actions
Copy link

Preview for this PR in prd (updated for commit b7d72cd):

https://entur-design-system--preview-182-etu-63197-oppdatere-b-p3aydjtf.web.app
(Expires Mon, 02 Mar 2026 14:23:07 GMT)

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.

3 participants