Skip to content
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

Ikke rendre child som ikke er valid element i ErrorSummary #2484

Merged
merged 1 commit into from Nov 17, 2023

Conversation

torkjels
Copy link
Contributor

Description

Hvis man i dag prøver å rendre noe conditionally i ErrorSummary vil man se et listepunkt (aka bullet point) selvom conditionen evaluerer til false. Eksempel:
image

Denne fiksen gjør det mulig å conditionally rendre barn i ErrorSummary. For eksempel kan man nå gjøre:

const shouldShow = false

return (
  <ErrorSummary>
    {shouldShow && <ErrorSummary.Item href="#id1">Jeg er en feilmelding, men vises ikke</ErrorSummary.Item>}
    <ErrorSummary.Item href="#id2">Jeg er en feilmelding som vises!</ErrorSummary.Item>
  </ErrorSummary>
)

Change summary

  • Fikset bug slik at man kan conditionally rendre ting i ErrorSummary

Copy link

changeset-bot bot commented Nov 16, 2023

🦋 Changeset detected

Latest commit: d41b2de

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@navikt/ds-react Patch
@navikt/ds-css Patch
@navikt/ds-tokens Patch
@navikt/ds-tailwind Patch
@navikt/aksel-icons Patch
@navikt/aksel Patch
@navikt/aksel-stylelint Patch

Not sure what this means? Click here to learn what changesets are.

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

@torkjels torkjels force-pushed the err-summary-ikke-rendre-undefined branch from 1c5abba to 994b0f4 Compare November 16, 2023 16:32
Copy link
Contributor

github-actions bot commented Nov 16, 2023

Storybook demo

0a703a9eb | 61 komponenter | 398 stories

@torkjels torkjels force-pushed the err-summary-ikke-rendre-undefined branch from 994b0f4 to 2aa1a72 Compare November 17, 2023 08:58
@torkjels torkjels force-pushed the err-summary-ikke-rendre-undefined branch from 2aa1a72 to 020e598 Compare November 17, 2023 11:28
@torkjels torkjels changed the title Ikke rendre falsy child i ErrorSummary Ikke rendre child som ikke er valid element i ErrorSummary Nov 17, 2023
Dette gjør det mulig å conditionally rendre barn i ErrorSummary. For eksempel kan man nå gjøre:

```
const shouldShow = false

return (
  <ErrorSummary>
    {shouldShow && <ErrorSummary.Item href="#id1">Jeg er en feilmelding, men vises ikke</ErrorSummary.Item>}
    <ErrorSummary.Item href="#id2">Jeg er en feilmelding som vises!</ErrorSummary.Item>
  </ErrorSummary>
)
```
@torkjels torkjels force-pushed the err-summary-ikke-rendre-undefined branch from 020e598 to d41b2de Compare November 17, 2023 11:40
@KenAJoh KenAJoh merged commit a44b2e2 into main Nov 17, 2023
2 checks passed
@KenAJoh KenAJoh deleted the err-summary-ikke-rendre-undefined branch November 17, 2023 11:47
@github-actions github-actions bot mentioned this pull request Nov 17, 2023
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.

None yet

2 participants