-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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] boolean vs enum API #10023
[docs] boolean vs enum API #10023
Conversation
a195d57
to
ed5ba55
Compare
docs/src/pages/guides/api.md
Outdated
### boolean vs enum | ||
|
||
You can potentially expose the variations of a component with a *boolean* or an *enum*. | ||
For instance, let's say you have a button of different types. You can use one of the two following options. Each has pros and cons: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"You can use one of the two following options, each with its pros and cons:"
docs/src/pages/guides/api.md
Outdated
You can potentially expose the variations of a component with a *boolean* or an *enum*. | ||
For instance, let's say you have a button of different types. You can use one of the two following options. Each has pros and cons: | ||
- Option 1 *boolean*: `<Button>`, `<Button raised />`, `<Button fab />`. | ||
With this API, people can use the shorthand notation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"you can use"?
docs/src/pages/guides/api.md
Outdated
``` | ||
|
||
- Option 2 *enum*: `<Button>`, `<Button type="raised">`, `<Button type="fab">`. | ||
With this API, you prevent invalid combination from being used, you bound the number of properties you exposes and you can easily support new values in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"you exposes, and you"
(Oxford comma)
docs/src/pages/guides/api.md
Outdated
- We use an *enum* when the degrees of freedom required is **> 2**. | ||
|
||
Going back to the previous button example, it requires 3 degrees of freedom. | ||
We use an *enum*. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Going back to the previous button example; since it requires 3 degrees of freedom, we use an enum.
(Connect cause and effect clauses in a single sentence.)
Or use something other than |
It's an option too. It's 3 additional characters and more component to change. |
docs/src/pages/guides/api.md
Outdated
@@ -81,7 +82,7 @@ type Props = { | |||
``` | |||
|
|||
- Option 2 *enum*: `<Button>`, `<Button type="raised">`, `<Button type="fab">`. | |||
With this API, you prevent invalid combination from being used, you bound the number of properties you exposes and you can easily support new values in the future. | |||
With this API, you prevent invalid combination from being used, you bound the number of properties you exposes, and you can easily support new values in the future. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"you expose" (sorry, don't know how I missed it!)
Write down the solution so we enforce it everywhere.