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

🏷️ Conditional ExpansionCard-prop #1944

Merged
merged 3 commits into from
Apr 27, 2023
Merged

🏷️ Conditional ExpansionCard-prop #1944

merged 3 commits into from
Apr 27, 2023

Conversation

KenAJoh
Copy link
Collaborator

@KenAJoh KenAJoh commented Apr 27, 2023

Tilbyr muligheten til å sette aria-label eller aria-labelledby. En av dem må være satt, så er brukt conditionals

Resolves #1931

@changeset-bot
Copy link

changeset-bot bot commented Apr 27, 2023

🦋 Changeset detected

Latest commit: c1f60f3

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

This PR includes changesets to release 10 packages
Name Type
@navikt/ds-react Patch
@navikt/ds-react-internal Patch
@navikt/ds-css Patch
@navikt/ds-tokens Patch
@navikt/ds-tailwind Patch
@navikt/ds-css-internal Patch
@navikt/ds-codemod Patch
@navikt/aksel-icons Patch
@navikt/aksel Patch
@navikt/ds-icons 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

@github-actions
Copy link
Contributor

github-actions bot commented Apr 27, 2023

Endringer til review: 1

42ef0bc10 | 44 komponenter | 258 stories

}

type ExpansionCardConditionalProps =
Copy link
Contributor

Choose a reason for hiding this comment

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

type ValueOf<Obj> = Obj[keyof Obj];
type OneOnly<Obj, Key extends keyof Obj> = {
  [key in Exclude<keyof Obj, Key>]+?: null;
} & Pick<Obj, Key>;
type OneOfByKey<Obj> = { [key in keyof Obj]: OneOnly<Obj, key> };
type OneOf<Obj> = ValueOf<OneOfByKey<Obj>>;

type ExpansionCardConditionalProps = OneOf<{
    ["aria-label"]: string;
    ["aria-labelledby"]: string;
}>;

funker, men er ikke "perfect" feil melding fra TS heller, men den viser i hvert fall valgmulighetene (ser fortsatt ut til å vise siste gyldige verdi i nederste linje.

image

@KenAJoh KenAJoh merged commit 1afdee4 into main Apr 27, 2023
@KenAJoh KenAJoh deleted the expansioncard-props branch April 27, 2023 12:38
@github-actions github-actions bot mentioned this pull request Apr 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Innspill til komponent]: <ExpansionCard />
2 participants