tailwindlabs / tailwindcss.com

The Tailwind CSS documentation website.
https://tailwindcss.com
3.25k stars 1.72k forks source link

Adds support to multiple frameworks on code blocks #1854

Closed miguel-arrf closed 1 month ago

miguel-arrf commented 1 month ago

Hi!

I opened a pull request that adds support to multiple frameworks on code blocks. (the pull request - #1853 - has more information regarding the code changes)

Motivation:

Some websites (e.g., nuxt.com) have code blocks similar to those found on tailwindcss.com, but with the option to select different frameworks (e.g., npm, yarn, pnpm, bun) instead of just npm.

Design:

New button (displayed only when the code block has different framework configurations):

unselected-state

Different framework selected (bun ➜ npm):

changed-state

No changes if a code block doesn't have a specified framework:

one-has-other-doesnt-sate

Usage:

Before:

code: {
  name: 'Terminal',
  lang: 'terminal',
  code: 'npx nuxi init my-project\ncd my-project',
},

After:

code: {
  name: 'Terminal',
  lang: 'terminal',
  frameworks: [
    {
      name: 'npm',
      code: 'npx nuxi init my-project\ncd my-project',
    },
    {
      name: 'bun',
      code: 'bunx nuxi init my-project\ncd my-project',
    },
  ],
},

If you do not want to add more frameworks for a specific block, no changes are needed!

On the pull request (#1853) there's more info regarding the concrete code changes that were made.

What do you think of these changes? Are these worth exploring?