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

[Ny komponent] Skeleton #1821

Merged
merged 20 commits into from
Jun 8, 2023
Merged

[Ny komponent] Skeleton #1821

merged 20 commits into from
Jun 8, 2023

Conversation

KenAJoh
Copy link
Collaborator

@KenAJoh KenAJoh commented Feb 23, 2023

Tester enkel implementasjon av MUI sin skeleton-løsning

Snippet fra MUI docs

Accessibility
Skeleton screens provide an alternative to the traditional spinner method. Rather than showing an abstract widget, skeleton screens create anticipation of what is to come and reduce cognitive load.

The background color of the skeleton uses the least amount of luminance to be visible in good conditions (good ambient light, good screen, no visual impairments).

Demo

@changeset-bot
Copy link

changeset-bot bot commented Feb 23, 2023

🦋 Changeset detected

Latest commit: 1cae71a

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-css Minor
@navikt/ds-react Minor
@navikt/aksel-stylelint Minor
@navikt/aksel Minor
@navikt/ds-tokens Minor
@navikt/ds-tailwind Minor
@navikt/aksel-icons Minor

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 Feb 23, 2023

Endringer til review: 6

5b69ac85d | 45 komponenter | 267 stories

@KenAJoh KenAJoh marked this pull request as ready for review May 26, 2023 07:14
@KenAJoh KenAJoh changed the title [Ny komponent WIP] Utforsker Skeleton-løsning [Ny komponent] Skeleton May 26, 2023
}

export const Skeleton = forwardRef<HTMLDivElement, SkeletonProps>(
({ className, variant = "text", ...rest }, ref) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Sitter og tenker på om denne koden hadde blitt enklere å lese og forholde seg til hvis man enten ikke hadde brukt destructuring i det hele tatt her, eller hadde brukt det på alle props som refereres. Det er litt "mentalt tungt" å huske på hvilke props som er igjen i rest når man leser resten av koden, spesielt når ytterligere to til fjernes i omit() under.

Bare en tanke. Det er jo ikke så mange props å forholde seg til uansett.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Har gjort en refactor nå slik at det blir litt enklere å følge props 👍

JulianNymark
JulianNymark previously approved these changes Jun 8, 2023
Copy link
Contributor

@JulianNymark JulianNymark left a comment

Choose a reason for hiding this comment

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

Så tanken er eget element som må legges i koden for å enable skeleton?

Har sett (feks. I https://blueprintjs.com/docs/#core/components/skeleton.css) at det bare er en class man legger på / kan legge på alle elementer. Er det enklere? Ser her vi kan bruke overrideableComponents sin as={Skeleton}

Litt åpent Spørsmål: er det da ekstra innsats for kunsumenter av komponent-APIet å "huske å toggle wrapper komponent når man venter på / får content"? Eller er det mulig for oss å ha skeleton "baked in" i komponentene våres? (falsy check på content eller noe "smart"?)

@KenAJoh KenAJoh merged commit db8c38a into main Jun 8, 2023
@KenAJoh KenAJoh deleted the skeleton-komponent branch June 8, 2023 12:44
@github-actions github-actions bot mentioned this pull request Jun 8, 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.

3 participants