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

feat(ui): add ui-components package #7223

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

RedYetiDev
Copy link
Member

@RedYetiDev RedYetiDev commented Nov 13, 2024

This PR moves the first few components into the ui-components package.

For now, only the Icons/ folder has been moved, as it's quite simple to move (unlike some other components), and it gives a good basis of what this package will look like.

Over coming PRs, I'll slowly move more pieces into this package.

Copy link

vercel bot commented Nov 13, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
nodejs-org ✅ Ready (Inspect) Visit Preview Nov 20, 2024 11:42pm

@RedYetiDev
Copy link
Member Author

Any idea why Vercel is failing?

@AugustinMauroy
Copy link
Member

Maybe create a package stories ?

@AugustinMauroy
Copy link
Member

Any idea why Vercel is failing?

cc @ovflowd and @bmuenzenmeyer

@RedYetiDev RedYetiDev marked this pull request as draft November 14, 2024 23:33
@RedYetiDev
Copy link
Member Author

RedYetiDev commented Nov 14, 2024

FYI I'm drafting until the Next.js update is done.

Feel free to review, this just can't land until that does (given that it modifies the package-lock.json files along with other configuration/storybook files, which is also being done by that more important upgrade).

@RedYetiDev
Copy link
Member Author

Hey, can someone let me know why Vercel is failing?

import {
STORYBOOK_MODES,
STORYBOOK_SIZES,
} from '../../../.storybook/constants';
Copy link
Member

@ovflowd ovflowd Nov 17, 2024

Choose a reason for hiding this comment

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

FYI Storybook should exist only within the UI components package :) -- not within the root of the repository.

Copy link
Member Author

Choose a reason for hiding this comment

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

Storybook is in use in both the UI components, and the app/site. To prevent duplicate code, I moved it to the repo root (like Tailwind), what do you have in mind?

Copy link
Member

Choose a reason for hiding this comment

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

Which components are on app/site that use Storybook? IMO, Storybook should ONLY exist for the UI components package.

Because semantically, that's what it is supposed to be used for. For describing components. I think we use it on apps/site only for visual regression, for whose I don't think they should be storybooks but just snapshots. We should probably make that change before we make this package then.

Copy link
Member

Choose a reason for hiding this comment

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

We can still use Chromatic for that: https://www.chromatic.com/features/visual-test.

IMO you can do that on this PR, decoupling stories from website-only components (which actually are combination of the base components) and simply use Cypress or Node.js or whatever for the visual regression tests with Chromatic.

Copy link
Member Author

@RedYetiDev RedYetiDev Nov 18, 2024

Choose a reason for hiding this comment

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

I agree with this overall, I just don't think that this should be done now. Currently, while only a subset of features are available in the UI package, I think it's okay to share a storybook config, as both the UI package and the apps/site package ned it. Later on, once more stuff is moved into the package, the storybook should only exist there, just not yet. Not while only the icons have been transferred.

But, in the future, this is probably the best direction to go in.

Copy link
Member

Choose a reason for hiding this comment

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

I get it, I just believe this gives an excellent opportunity for so; This PR is already going to be huge, and I would say that ensuring that Storybooks only exist for actual UI components (instead of composite components/fragments/sections of a page) and that we still ensure visual regression on everything is definitely part of the goal of this package IMO.

We don't need to rush here, so if the issue is time, take your time :)

Copy link
Member Author

Choose a reason for hiding this comment

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

The current Storybook configuration in /apps/site differs from the one in packages/ui-components because the ui-components package doesn't rely on Next.js internally. If we were to move the Storybook setup into ui-components now, we'd have to introduce Next.js dependencies, as the configuration in apps/site depends on Next.js internals. The goal of this package is to not have Next.js dependencies.

A more effective approach IMO would be to gradually migrate components to the packages/ui-components package while removing Next.js-related elements from their Storybook configurations. Once all configurations are free of Next.js and consolidated in packages/ui-components, transferring the entire Storybook setup to this package will be much smoother.

By "Next.js-free," I mean the removal of dependencies like next-intl, Link, and similar Next.js-specific elements.

tailwind.config.ts Outdated Show resolved Hide resolved
Copy link
Member

@ovflowd ovflowd left a comment

Choose a reason for hiding this comment

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

I left an initial round of comments 🙏

@RedYetiDev
Copy link
Member Author

Hey @ovflowd. I've responded to some of your concerns, but I still have my reservations about the storybook / tailwind concerns, PTAL when you get a chance, thanks!

@ovflowd
Copy link
Member

ovflowd commented Nov 20, 2024

Thanks @RedYetiDev I've replied to your points ;)

@RedYetiDev
Copy link
Member Author

The deployment was successful!!

@RedYetiDev RedYetiDev marked this pull request as ready for review November 20, 2024 23:42
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