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

Add v1 Button migration and spec files #1157

Merged
merged 10 commits into from
Nov 23, 2021

Conversation

rurikoaraki
Copy link
Collaborator

Platforms Impacted

  • iOS
  • macOS
  • win32 (Office)
  • windows
  • android

Description of changes

Adding documentation for v1 for spec and migration.
Shamelessly taking the layout from the fluentui repo.

The specs/migration steps are a first-pass level, nothing is finalized yet. Figured I'd get the documentation started so that it's easier to add to as we finalize things.

Pull request checklist

This PR has considered (when applicable):

  • Automated Tests
  • Documentation and examples
  • Keyboard Accessibility
  • Voiceover
  • Internationalization and Right-to-left Layouts

Copy link
Collaborator

@Saadnajmi Saadnajmi left a comment

Choose a reason for hiding this comment

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

Realized a bunch of these comments might not be relevant because the doc is copied from web, so I stopped myself before I went further!

- `children`
- `disabled`
- `icon`
- `onClick`
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I would vote to rename this onPress, to better match pressable, but that's a followup for me on my other code review #1070 anyway

Copy link
Collaborator Author

@rurikoaraki rurikoaraki Nov 13, 2021

Choose a reason for hiding this comment

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

Ah I forgot about that conversation. I think this will be a case of balancing alignment with web vs. what is intuitively native/RN, since I think web is named onClick to align with the HTML API while onPress is used across RN. I think it's worth a discussion @ejlayne

packages/experimental/Button/MIGRATION.md Show resolved Hide resolved
packages/experimental/Button/MIGRATION.md Show resolved Hide resolved
Comment on lines +32 to +33
- `endIcon` => Use `right` value for `iconPosition` prop and pass icon information into `icon` prop instead
- `startIcon` => Use `left` value for `iconPosition` prop and pass icon information into `icon` prop instead
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: I would say we pass start and end to iconPosition for better internationalization

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can bring this feedback to web. @ejlayne

Copy link
Contributor

Choose a reason for hiding this comment

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

Fair point, let's bring up with web folks.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar platform difference that is a point of discussion

packages/experimental/Button/MIGRATION.md Show resolved Hide resolved
packages/experimental/Button/SPEC.md Show resolved Hide resolved
packages/experimental/Button/SPEC.md Show resolved Hide resolved
Comment on lines +59 to +63
### Slots

- `root` - The outer container representing the `Button` itself that wraps everything passed via the `children` prop.
- `icon` - If specified, renders an `icon` either before or after the `children` as specified by the `iconPosition` prop.
- `loader` - If specified, renders a `loader` before the `icon` and `children` while the `loading` flag is set to `true`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: (and I'm opening a can of worms), I somewhat feel the public API should just be the props and tokens of a component, and not slots. That's mostly because slots tend to change as design evolves, which makes it harder to be part of the public API.

Granted, as things are now, clients have access to slots, so we should at least document them.

@rurikoaraki
Copy link
Collaborator Author

Realized a bunch of these comments might not be relevant because the doc is copied from web, so I stopped myself before I went further!

The general answer is, "we are trying to align with the web API to make implementation across fluentui and FURN a smoother experience." We apparently get a lot of feedback around how different the APIs are across the platforms, so while some of these are easy to accomplish, it would be a quick ease of use thing to add props surfacing some defaults. There are some props we're not carrying over due to inherit differences between web and native (namely accessibility) but we're aiming to make the porting process smoother since it's a common scenario for clients.

packages/experimental/Button/SPEC.md Outdated Show resolved Hide resolved
packages/experimental/Button/SPEC.md Outdated Show resolved Hide resolved
Comment on lines +32 to +33
- `endIcon` => Use `right` value for `iconPosition` prop and pass icon information into `icon` prop instead
- `startIcon` => Use `left` value for `iconPosition` prop and pass icon information into `icon` prop instead
Copy link
Contributor

Choose a reason for hiding this comment

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

Fair point, let's bring up with web folks.

@rurikoaraki
Copy link
Collaborator Author

@ejlayne @Saadnajmi @chiuam Any other comments? Otherwise I will merge this at EOD.

packages/experimental/Button/SPEC.md Outdated Show resolved Hide resolved
// * Loader slot that, if specified, renders a `loader` before the `icon` and `children` while the `loading` flag
// * is set to `true`.
// */
loader?: TBD;
Copy link
Collaborator

Choose a reason for hiding this comment

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

TBD? The user will pass in the slot? Is that even possible?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

TBD as in I don't know the type of the loader slot yet since that was still in discussion. I think I will change this to be ActivityIndicator

Copy link
Collaborator

Choose a reason for hiding this comment

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

If we do that, I think it would be a simple change to have FURN ActivityIndicator fall back to the RN base ActivityIndicator for not iOS/Android. But that's a whole different thing =)

packages/experimental/Button/SPEC.md Outdated Show resolved Hide resolved
packages/experimental/Button/SPEC.md Outdated Show resolved Hide resolved
Comment on lines 179 to 181
#### Touch interaction

The same behavior as above translated for touch events. This means that there is no equivalent for `mouseenter` and `mouseleave`, which makes it so that the hovered state cannot be accessed.
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is part of why I want to push for #1070 to make this API a lot simpler. It would be great if we could just communicate that a Button is a Pressable, which supports PressableProps, which includes hover / keyboard focus / touch / click interaction. This last bit of documentation to me feels a bit too web and less RN.
I don't consider that blocking this review though, since this is all iteration.

packages/experimental/Button/SPEC.md Show resolved Hide resolved
@rurikoaraki
Copy link
Collaborator Author

@Saadnajmi Any other feedback before I merge?

Copy link
Collaborator

@Saadnajmi Saadnajmi left a comment

Choose a reason for hiding this comment

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

I don't consider any comment I just left as blocking. Thanks for doing this!

packages/experimental/Button/MIGRATION.md Outdated Show resolved Hide resolved
packages/experimental/Button/MIGRATION.md Show resolved Hide resolved
Comment on lines +32 to +33
- `endIcon` => Use `right` value for `iconPosition` prop and pass icon information into `icon` prop instead
- `startIcon` => Use `left` value for `iconPosition` prop and pass icon information into `icon` prop instead
Copy link
Collaborator

Choose a reason for hiding this comment

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

Similar platform difference that is a point of discussion

packages/experimental/Button/SPEC.md Outdated Show resolved Hide resolved
@rurikoaraki rurikoaraki merged commit 82a73fb into microsoft:master Nov 23, 2021
@rurikoaraki rurikoaraki deleted the button_migration_spec branch January 6, 2022 21:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants