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

[pigment-css][docs] Add small edits on the README #41646

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

danilo-leal
Copy link
Contributor

Little improvement opportunities I realized while testing Pigment CSS on a fresh new repo.

@danilo-leal danilo-leal added docs Improvements or additions to the documentation package: pigment-css Specific to @pigment-css/* labels Mar 25, 2024
@danilo-leal danilo-leal self-assigned this Mar 25, 2024
@mui-bot
Copy link

mui-bot commented Mar 25, 2024

Netlify deploy preview

https://deploy-preview-41646--material-ui.netlify.app/

Bundle size report

No bundle size changes (Toolpad)
No bundle size changes

Generated by 🚫 dangerJS against da42686

Comment on lines +211 to +216
```tsx
interface ButtonProps {
size?: 'small' | 'large';
}

const Button = styled('button')<ButtonProps>({
Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, I started out with the Vite example app and just copying and pasting this code snippet doesn't work because of TypeScript. Given both example apps (Vite & Next.js) are using it by default, I wonder if we shouldn't do something like this? Y'all tell me if this is the best way to do this, as I know there are others. But I guess having these snippets tailored to work seamlessly with the example apps should be the way to go.

This point was what motivated me to open the PR. Depending on what we discuss here, we can change other snippets throughout the README!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, I just realized (sorry 😅) we have the "Typing props" header a few lines below this code snippet. This sort of solves my point there, but I do still wonder if we shouldn't tailor the docs to TypeScript by default and warn the opposite: instead of saying "If you use TS, add this", say "if you're not using TS, remove this"?

Copy link
Contributor

Choose a reason for hiding this comment

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

I would rather see code that works right away when copying and pasting—the user shouldn't need to keep reading further down the page to understand why this doesn't work. You could add a small comment above the TS to let JS users know to remove it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Definitely—I can also do the opposite (add a comment about heading over to the TS adaptation) if we're not in the mood to debate making them use TypeScript by default right now. I personally feel like it'd be good to do it, though... the example apps use it, and our own codebase also largely uses it, so I think the consistency would be great there.

Copy link
Contributor

Choose a reason for hiding this comment

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

We do have a Typescript section in this README. So we can target ts there. Anyways, there are only 2 points to note for TS (as of now). Rest can just target JS even for TS code.
I am OK with either. One data point to figure out would how many people report issues in our repo specific to writing code for JS and not TS.

@@ -39,7 +39,9 @@ Pigment CSS is built on top of [WyW-in-JS](https://wyw-in-js.dev/), enabling to

### Start with Next.js

Use the following commands to create a new Next.js project with Pigment CSS set up:
#### Quickstart
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Felt like a title like this one was missing in opposition to the "Manual installation". I know it can sound a bit dumb, but I wondered about this for a couple of seconds before starting 😅 The extra clarity could be worth it.

@danilo-leal
Copy link
Contributor Author

Little bump on this one! :)

@danilo-leal
Copy link
Contributor Author

@brijeshb42 just want to confirm what you think about making the code snippets use TypeScript by default (and then instruct about removing it if that's not the case) rather than the other way around?

@siriwatknp siriwatknp merged commit b2ffd02 into mui:next Apr 3, 2024
21 checks passed
@danilo-leal danilo-leal deleted the pigment-readme-tweaks branch April 3, 2024 22:04
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 package: pigment-css Specific to @pigment-css/*
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants