-
Notifications
You must be signed in to change notification settings - Fork 15
FBCM-5076 Add pill buttons #244
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
Conversation
We want to drop `Block` from our module namespaces, as it's not useful information, and makes usage with fully qualified imports more verbose. Our plan is to migrate modules as we work on them, so we don't have to do too much at once. Since we're about to make changes to `Ocelot.Block.Button`, first we rename it to `Ocelot.Button`.
We refactor `Ocelot.Button` to fully qualify all imports—with the exception of the infix `<&>` operator—before working on it.
It's a good habit to be explicit about which definitions are part of a module's API and which are private. In this case, everything happens to be public, so maybe it's less useful to make the distinction, but it's also a good idea to be consistent in habits.
The definitions in this module have ended up a bit disorganized over time. We sort them alphabetically in an effort to make the module easier to navigate, and in hopes that it'll help the module to stay organized. The diff may be hard to read, but the only change is that definitions were moved around.
`Ocelot.Button.buttonClearCenter` was the only button without a null props alternate. Obviously that hasn't been an issue, but we add the alternate for completeness.
The CSS builds didn't have any of the source files as dependencies, so weren't being triggered when the source files changed.
We add variants style buttons to `Button` which we call "pills". These are intended for button-like elements that require a more "flat" appearance. We depart a bit from the traditional "block" pattern here, which has proved difficult to scale, when there are a multiplicity of variants. Instead, we use `Option` to provide a convenient API for taking advantage of the various configurations we offer. We won't know for sure without enough usage, but this does seem a major improvement over the current "block" pattern, and we ought to consider adopting it more broadly.
With the addition of pill buttons, we demonstrate some of the different variations that are possible from the UI Guide. Worth noting is that while with the old "block" pattern we were forced to use `<button>` elements, with the new pattern we not only offer a `<button>` and an `<a>` option, but we could actually use any HTML element we want.
Although Ocelot is no longer used by Quicksight, so we should be able to drop this step when creating new releases.
I'm not sure I understand from this PR and from the examples how the pill buttons should be used. Like, how can I, as a developer, write code that reacts to, say, clicks on a pill button? |
For the button you just provide a Halogen action to the |
Ah that makes sense, thanks! |
What does this pull request do?
We're adding a variant of buttons to be used for selected filters in a list view.
Where should the reviewer start?
Commit-by-commit.
How should this be manually tested?
Optional, but you can run
make ui-guide
locally then load http://localhost:1234/#buttons.