Skip to content

Storybook global mock useDetectOS and NodeReleasesProvider #5460

@HinataKah0

Description

@HinataKah0

Enter your suggestions in details:

NodeReleasesProvider is used in Storybook now. However, it is reading from generated public/node-releases-data.json file now.
https://github.com/nodejs/nodejs.org/blob/main/next.app.tsx#L30-L34

And similarly with useDetectOS hook, it will detect your PC/laptop's OS and use it for generating the Storybook snapshots.
See this generated snapshot.

Notice that the Mac's DownloadCard is having downloadCardActive class:

<li class="DownloadCard_downloadCard__eWZZG DownloadCard_downloadCardActive__mwG_u"
    role="tab"
    id="tabdownload-card-MAC"
    aria-selected="false"
    aria-disabled="false"
    aria-controls="paneldownload-card-MAC"
    tabindex="0"
    data-rttab="true"
>

I think we need a global mock since many components depend on Node releases data and user OS information.

Metadata

Metadata

Assignees

No one assigned

    Labels

    infrastructureIssues/PRs related to the Repository Infra

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions