Skip to content

[docs] Add support for Tailwind CSS and plain CSS demos#37319

Merged
mnajdova merged 44 commits intomui:masterfrom
mnajdova:docs/base-demos-tailwind
Jun 20, 2023
Merged

[docs] Add support for Tailwind CSS and plain CSS demos#37319
mnajdova merged 44 commits intomui:masterfrom
mnajdova:docs/base-demos-tailwind

Conversation

@mnajdova
Copy link
Member

@mnajdova mnajdova commented May 18, 2023

This PR adds support for Tailwind CSS and plan CSS demos (in Base UI - the new infrastructure), but we can move this everywhere. For each demo that supports multiple styling solutions we should have a directory in the structure:

DemoName/
  tailwind/
    index.tsx
  system/
    index.tsx
  css/
    index.tsx

If this structure exists, a select component with the styling options will appear above the demo preview.

I am using the default Tailwind CSS setup - it is added globally on the docs. For the CodeSandbox and StackBlitz demos, I am simply loading the tailwind CDN - https://tailwindcss.com/docs/installation/play-cdn - this seemed like the easiest solution.

Preview: https://deploy-preview-37319--material-ui.netlify.app/base/react-button/#basics

gif

To-dos:

  • clean up the code
  • add tests
  • Improve the select focus styles
  • Fix the toolbar navigation
  • validate the design for the Tailwind CSS and plain CSS demos

@mnajdova mnajdova added the scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305). label May 18, 2023
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label May 18, 2023
Signed-off-by: Marija Najdova <mnajdova@gmail.com>
mnajdova added 2 commits May 18, 2023 11:29
Signed-off-by: Marija Najdova <mnajdova@gmail.com>
@mui-bot
Copy link

mui-bot commented May 18, 2023

Netlify deploy preview

Bundle size report

No bundle size changes

Generated by 🚫 dangerJS against 6e32a19

@mnajdova mnajdova marked this pull request as ready for review May 18, 2023 13:02
}

if (!demoOptions.demo.endsWith('.js') && demoOptions.hideToolbar !== true) {
if (
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 new demos structure uses the folder name as a prop, so we need to adjust this check.


const demoData = useDemoData(codeVariant, demo, githubLocation, styleSolution);

const showSelect = demo.rawTailwind || demo.rawTailwindTS;
Copy link
Member Author

Choose a reason for hiding this comment

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

Once we support plain CSS, we should update this check.

Signed-off-by: Marija Najdova <mnajdova@gmail.com>
@oliviertassinari oliviertassinari changed the title [docs] Add support for Tailwind demos [docs] Add support for Tailwind CSS demos May 18, 2023
@github-actions github-actions bot added PR: out-of-date The pull request has merge conflicts and can't be merged. and removed PR: out-of-date The pull request has merge conflicts and can't be merged. labels May 22, 2023
@mnajdova mnajdova changed the title [docs] Add support for Tailwind CSS demos [docs] Add support for Tailwind CSS and plan CSS demos May 24, 2023
@zanivan
Copy link
Collaborator

zanivan commented May 31, 2023

This is looking good, I really liked the new toolbar!
I've just added the Cyan color palette on the plain CSS button, and also removed the active and hover states from the disabled buttons.

@siriwatknp siriwatknp changed the title [docs] Add support for Tailwind CSS and plan CSS demos [docs] Add support for Tailwind CSS and plain CSS demos Jun 1, 2023
Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

👍 This looks good to me! the CodeSandbox works great.

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jun 12, 2023
Signed-off-by: Marija Najdova <mnajdova@gmail.com>
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged. label Jun 19, 2023
@mnajdova mnajdova merged commit f26df6a into mui:master Jun 20, 2023
@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 20, 2023

I love the new design of the demo, very clean, close to https://vercel.com/design/button

Screenshot 2023-06-21 at 00 04 25

I think that it would be great to update Joy UI, the background feels a bit annoying, it moves the demo a bit further away to how it will feel once rendered in your app.

Screenshot 2023-06-21 at 00 04 56

@mnajdova There is one issue with the warnings, it floods now on HEAD in dev mode 😁, we really need to fix it.

Screenshot 2023-06-20 at 23 58 35

@danilo-leal
Copy link
Collaborator

@oliviertassinari thanks, glad you enjoyed it! I was already keen on rolling back with the tiled patterns on Joy ⎯ on it 🤙

@oliviertassinari
Copy link
Member

oliviertassinari commented Aug 20, 2023

Beyond, the warnings ⬆️,

I think that we should remove the Tailwind CSS dev tool pollution to properly understand the styles in the dev tools, for example:

Screenshot 2023-08-21 at 00 33 04

maybe by scoping them to a specific div or only importing Tailwind CSS entry points in pages that demo it.

It is also important because Tailwind CSS styles slow the page when loading unused CSS: https://youtu.be/nWcexTnvIKI?si=dOaSJEMNi5aQJesf&t=1313.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to the documentation. scope: docs-infra Involves the docs-infra product (https://www.notion.so/mui-org/b9f676062eb94747b6768209f7751305).

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants