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

Setup the foundation for Twenty UI library. #4423

Merged
merged 12 commits into from
Mar 13, 2024

Conversation

mabdullahabaid
Copy link
Contributor

Creating this PR to get the package for twenty-ui up and running. The following list contains the step-by-step details for changes in this PR.

  • Created a new package using the command for NX storybook configuration: nx g @nx/storybook:configuration twenty-ui. This command updated the root level nx.json and added packages to the root level package.json (which we might be able to move to package level package.json - need to experiment, not messing with the setup for now).
  • Duplicated the theme from twenty-front into twenty-ui and updated AppThemeProvider inside twenty-front to use the theme within twenty-ui. Have not removed the theme from twenty-front altogether due to dependencies, which we can resolve as the next step (or delay till we have extracted all the components).
  • Extracted the Pill component out of twenty-front without any changes to the component code.
  • Ensured that every occurrence of Pill component inside twenty-front imports from twenty-ui instead of modules/ui.
  • Added details to README inside twenty-ui for anyone planning to play around with the library on their local machine.

Have not updated twenty-docs in this PR - need a little experimentation to get started with Docusaurus and MDX.

@lucasbordeau lucasbordeau self-assigned this Mar 13, 2024
@lucasbordeau
Copy link
Contributor

Nice ! Thank you @mabdullahabaid

I just copied the preview-head so that it renders correctly as in the twenty-front storybooks, we'll see later how we can fix that if we can get the font-family from theme instead of preview head.

- Added theme addon for light/dark switch
- Added ComponentDecorator
@lucasbordeau
Copy link
Contributor

Also added what's needed for light/dark theme switch and ComponentDecorator we use everywhere.

@lucasbordeau lucasbordeau merged commit 8c0680b into twentyhq:main Mar 13, 2024
6 checks passed
@mabdullahabaid
Copy link
Contributor Author

Sounds amazing! Thank you for making the setup more complete, @lucasbordeau - just learned how to add a theme switch to storybook by revisiting your changes.

Time for me to extract more components! 😃

arnavsaxena17 pushed a commit to arnavsaxena17/twenty that referenced this pull request Oct 6, 2024
* feat: create a separate package for twenty-ui, extract the pill component with hard-coded theme values into it, and use the component inside twenty-front to complete the setup

* feat: extract the light and the dark theme into twenty-ui and update the AppThemeProvider component inside twenty-front to consume themes from twenty-ui

* fix: create a decorator inside preview.tsx to provide a default theme to storybook development server

* fix: remove redundant type declarations and revert back the naming convention for theme declarations

* fix: introduce a default value for pill label within the story for development server

* fix: introduce the nx script into package.json for twenty-ui and resolve imports for theme type within the package

* fix: remove the pill component from the twenty-front package along with the story for it

* fix: revert the package versions to those before running the nx cli command for storybook init

* feat: update readme to include details for building the ui library and starting the storybook development server

* fix: include details about twenty-ui inside jest.config for twenty-front to complete front-jest job

* - Added preview head for font
- Added theme addon for light/dark switch
- Added ComponentDecorator

---------

Co-authored-by: Lucas Bordeau <[email protected]>
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.

2 participants