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

feat(Popover): New Popover component #1595

Draft
wants to merge 5 commits into
base: dev
Choose a base branch
from

Conversation

nikitaorliak-cengage
Copy link
Collaborator

Issue: #927

What I did

Created a new Popover component.

Screenshots:

Checklist

  • changeset has been added
  • Pull request description is descriptive
  • I have made corresponding changes to the documentation
  • New and existing unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works

How to test

@nikitaorliak-cengage nikitaorliak-cengage added the draft Pull requests that are drafts and not ready for review label Dec 9, 2024
@nikitaorliak-cengage nikitaorliak-cengage self-assigned this Dec 9, 2024
Copy link

changeset-bot bot commented Dec 9, 2024

🦋 Changeset detected

Latest commit: cfee18f

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

This PR includes changesets to release 1 package
Name Type
react-magma-dom Minor

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

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Contributor

Copy link
Collaborator

@silvalaura silvalaura left a comment

Choose a reason for hiding this comment

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

Looking good!

import { useIsInverse } from '../../inverse';
import { ButtonGroupContext } from '../ButtonGroup';

export enum PopoverPositioning {
Copy link
Collaborator

Choose a reason for hiding this comment

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

To match all our other similar props, let's rename this PopoverPosition

Comment on lines 18 to 19
left = 'left',
right = 'right',
Copy link
Collaborator

Choose a reason for hiding this comment

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

From the requirements, it's unclear to me if we want to support left and right as well. @orion-cengage ?

right = 'right',
}

export interface PopoverProps extends React.HTMLAttributes<HTMLDivElement> {
Copy link
Collaborator

Choose a reason for hiding this comment

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

We should add descriptions to all of these props

focusable?: boolean;
isInverse?: boolean;
isDisabled?: boolean;
matchedWidth?: boolean;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I wonder if we can somehow combine width and matchedWidth so we only use one prop to manage the width

Copy link
Collaborator

@silvalaura silvalaura Dec 11, 2024

Choose a reason for hiding this comment

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

Mantine does width="target" for matching the width to the target element, or it takes a number for it to be a fixed width. Maybe we can do the same?

isInverse?: boolean;
isDisabled?: boolean;
matchedWidth?: boolean;
withoutPointer?: boolean;
Copy link
Collaborator

@silvalaura silvalaura Dec 11, 2024

Choose a reason for hiding this comment

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

Maybe we make this positive and rename it hasPointer or hasArrow

Comment on lines 137 to 141
/* display: grid; */
/* grid-template-rows: 1fr auto 1fr; */
/* flex-wrap: wrap; */
/* justify-content: center; */
/* align-items: center; */
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can be deleted?

z-index: 2;
`;

const PopoverChildrenContent = styled.div``;
Copy link
Collaborator

Choose a reason for hiding this comment

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

If there are no styles, we can just use a div without the name

>
<StyledAnnounce maxHeight={context.maxHeight}>
{!content.length ? (
'Content must be passed'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not sure we should announce an "error" for the developers. I think we can assume there is content?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Are the header and footer practically the same?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We should add more examples to match all the ones provided in the designs

@silvalaura silvalaura linked an issue Dec 11, 2024 that may be closed by this pull request
…e props, change matchedWidth to width=target, add more examples, fix errors
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
draft Pull requests that are drafts and not ready for review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

New component: Popover
2 participants