Skip to content

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

Merged
merged 9 commits into from
Sep 21, 2022
Merged

Conversation

davezuch
Copy link
Member

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.

  • You should see the new pill buttons demo'd:
    Screen Shot 2022-09-20 at 1 24 40 PM

Dave Zuch added 8 commits September 14, 2022 15:49
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.
@davezuch davezuch requested review from a team and citizengabe and removed request for a team September 20, 2022 20:25
Although Ocelot is no longer used by Quicksight, so we should be able to
drop this step when creating new releases.
@davezuch davezuch merged commit d47a840 into main Sep 21, 2022
@davezuch davezuch deleted the FBCM-5076/davezuch/Add_pill_blocks branch September 21, 2022 00:34
@arthurxavierx
Copy link
Contributor

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?

@davezuch
Copy link
Member Author

davezuch commented Sep 21, 2022

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 props. Although for our use case, where we're just using them to display selected filters, I think we should use the pill anchors instead, with a link that removes the filter from the query params.

@arthurxavierx
Copy link
Contributor

For the button you just provide a Halogen action to the props.

Ah that makes sense, thanks!

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.

2 participants