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 Popover menu component #944

Merged
merged 22 commits into from
Jun 18, 2021
Merged

Add Popover menu component #944

merged 22 commits into from
Jun 18, 2021

Conversation

amelako
Copy link
Contributor

@amelako amelako commented May 17, 2021

Addresses #723.

Purpose

Introduces the new Popover component.
Popover menus are a common pattern to display a list of subsequent action options, when interacting with an actionable component.

Screenshot 2021-06-17 at 11 59 16

Screenshot 2021-06-17 at 11 59 28

Approach and changes

  • The Popover Item component was added as an action item represented by an appropriate HTML element (button or a) with an optional leading icon and label.
  • The new Popover component takes isOpen and onClose as props to control the open Popover, actions to distinguish PopoverItem and Divider.
  • The Popover is powered by React Popper which means you can easily change the Popover placement by simply passing the placement prop.
  • The triggers or the reference elements of the Popover can be primary, secondary, tertiary buttons, an overflow icons, or components with embedded buttons such as image upload component.
  • The states of the popover are added and can be Default, Hover, Active, Focus.
  • The Destructive variant is added that changes the color of label and icon from blue to red to signal to the user that the action is irreversible or otherwise dangerous.

Note: some things have been left out of this PR's scope and will be addressed in later versions:

  • the focus of the popover item (focus needs to be moved to the menu once it has been opened)
  • accessibility keyboard implementation
  • add disabled state

Definition of done

  • Development completed
  • Reviewers assigned
  • Unit and integration tests
  • Meets minimum browser support
  • Meets accessibility requirements

@changeset-bot
Copy link

changeset-bot bot commented May 17, 2021

🦋 Changeset detected

Latest commit: fcad3d8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sumup/circuit-ui Major

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented May 17, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/sumup/oss-circuit-ui/BLrof6J89BDx9L52aGgBTwwZ9EFh
✅ Preview: https://oss-circuit-ui-git-popover-menu-sumup.vercel.app

@sumup-clark
Copy link

sumup-clark bot commented May 17, 2021

Hey @amelako,
we are super excited that you are contributing! 🎉There's one more thing you need to do. Please accept our Contributor License Agreement. It helps you and us to collaborate on clear terms and focus on what we love most: code.

Thanks!

Copy link
Contributor

@robinmetral robinmetral left a comment

Choose a reason for hiding this comment

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

Nice! 🙌

Just a high-level initial review, let me know if you have questions or need support 🙂 I'll also take a look at the docs and stories after they're ready for review

packages/circuit-ui/index.ts Outdated Show resolved Hide resolved
packages/circuit-ui/styles/style-mixins.ts Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.spec.tsx Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.spec.tsx Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.tsx Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.tsx Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.tsx Outdated Show resolved Hide resolved
packages/circuit-ui/package.json Outdated Show resolved Hide resolved
packages/circuit-ui/package.json Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.tsx Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.tsx Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.tsx Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.tsx Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.spec.tsx Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.spec.tsx Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.spec.tsx Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.spec.tsx Outdated Show resolved Hide resolved
@robinmetral
Copy link
Contributor

(also a small note: this PR should target next)

@codecov
Copy link

codecov bot commented Jun 17, 2021

Codecov Report

Merging #944 (fcad3d8) into next (9548803) will decrease coverage by 0.04%.
The diff coverage is 93.54%.

Impacted file tree graph

@@            Coverage Diff             @@
##             next     #944      +/-   ##
==========================================
- Coverage   91.67%   91.62%   -0.05%     
==========================================
  Files         165      164       -1     
  Lines        3063     3069       +6     
  Branches      754      752       -2     
==========================================
+ Hits         2808     2812       +4     
  Misses        227      227              
- Partials       28       30       +2     
Impacted Files Coverage Δ
packages/circuit-ui/styles/style-mixins.ts 97.61% <85.71%> (-1.10%) ⬇️
packages/circuit-ui/components/Popover/Popover.tsx 94.54% <94.54%> (ø)
packages/circuit-ui/components/Portal/Portal.js 0.00% <0.00%> (-5.72%) ⬇️

packages/circuit-ui/components/Popover/Popover.stories.tsx Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.stories.tsx Outdated Show resolved Hide resolved
.changeset/tame-mayflies-move.md Outdated Show resolved Hide resolved
.changeset/tame-mayflies-move.md Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.tsx Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.tsx Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.tsx Outdated Show resolved Hide resolved
packages/circuit-ui/components/Popover/Popover.tsx Outdated Show resolved Hide resolved
Copy link
Contributor

@robinmetral robinmetral left a comment

Choose a reason for hiding this comment

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

🐩

@amelako amelako merged commit 2628fce into next Jun 18, 2021
@amelako amelako deleted the popover-menu branch June 18, 2021 10:05
@github-actions github-actions bot mentioned this pull request Jun 18, 2021
@connor-baer connor-baer linked an issue Jun 29, 2021 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add popover menu component
3 participants