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

BREAKING: Button components change #830

Merged
merged 1 commit into from
Jul 4, 2024
Merged

BREAKING: Button components change #830

merged 1 commit into from
Jul 4, 2024

Conversation

gnapse
Copy link
Contributor

@gnapse gnapse commented Jul 4, 2024

Short description

BeforeAfter
  • Button always render semantic buttons, and has an API that allows it to render both as
    • a button with a visual text label and optional icon
    • or an icon-only button
  • ButtonLink
    • a mirror of Button, but that is meant to render links that visually look like buttons
    • it has all the same capabilities to render with or without a visible text label
  • Button renders always a button-like element with a visible text label
    • it offers ways to render semantically as a link, while keeping its visuals intact
    • it is not able to render an icon-only button
  • IconButton
    • it offers ways to render semantically as a link, while keeping its visuals intact
    • it is not able to render a button with a visual label, only with an icon (label is kept semantically and shown as a tooltip)
// Visually labelled button
<Button variant="primary">Save</Button>

// Visually labelled link
// (that looks like a button)
<ButtonLink
  variant="primary"
  href="/whatever"
>
 Open
</Button>

// Icon-only button
<Button
  variant="primary"
  aria-label="Save"
  icon={<svg/>}
/>

// Link that looks like
// an icon-only button
<ButtonLink
  variant="primary"
  aria-label="Open"
  icon={<svg/>}
  href="/whatever"
/>
// Visually labelled button
<Button variant="primary">Save</Button>

// Visually labelled link
// (that looks like a button)
<Button
  variant="primary"
  render={<a href="/whatever" />}
>
  Open
</Button>

// Icon-only button
<IconButton
  variant="primary"
  aria-label="Save"
  icon={<svg/>}
/>

// Link that looks like
// an icon-only button
<IconButton
  variant="primary"
  aria-label="Open"
  icon={<svg/>}
  render={<a href="/whatever" />}
/>

PR Checklist

  • Added tests for bugs / new features
  • Updated docs (storybooks, readme)
  • Executed npm run validate and made sure no errors / warnings were shown
  • Described changes in CHANGELOG.md
  • Bumped version in package.json and package-lock.json (npm --no-git-tag-version version <major|minor|patch>) ref
  • Reviewed and approved Chromatic visual regression tests in CI

Versioning

@gnapse gnapse self-assigned this Jul 4, 2024
@gnapse gnapse changed the title Ernesto/button refactor BREAKING: Button components change Jul 4, 2024
@gnapse gnapse changed the base branch from main to next July 4, 2024 16:32
@gnapse gnapse marked this pull request as ready for review July 4, 2024 16:35
@gnapse gnapse force-pushed the ernesto/button-refactor branch 2 times, most recently from 2768600 to 12cc4f4 Compare July 4, 2024 19:55
@gnapse gnapse force-pushed the ernesto/button-refactor branch from 12cc4f4 to 6010cfe Compare July 4, 2024 20:15
@gnapse gnapse merged commit 79b9440 into next Jul 4, 2024
3 of 5 checks passed
@gnapse gnapse deleted the ernesto/button-refactor branch July 4, 2024 22:41
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.

1 participant