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

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

Merged
merged 44 commits into from
Jun 20, 2023

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 Specific to the docs-infra product 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>
packages/markdown/loader.js Outdated Show resolved Hide resolved
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
@@ -339,7 +373,10 @@ export default function Demo(props) {
}
}

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
Contributor

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
21 checks passed
@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
Contributor

@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 Specific to the docs-infra product
Projects
Status: Recently completed
Development

Successfully merging this pull request may close these issues.

None yet

6 participants