-
Notifications
You must be signed in to change notification settings - Fork 0
feat(Popover): new component #220
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
…gene-ui-components into feature/popover-component
| /** | ||
| * Size of the popover: `xLarge`, `large`, `medium`, `small`, or `mobile`. | ||
| */ | ||
| size: "xLarge" | "large" | "medium" | "small" | "mobile"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can have default size for example medium and make the size prop optional.
package.json
Outdated
| "typings": "index.d.ts", | ||
| "scripts": { | ||
| "start": "npm run test && storybook dev -p 6006", | ||
| "start": "storybook dev -p 6006", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add run test.
| "start": "storybook dev -p 6006", | |
| "start": "npm run test && storybook dev -p 6006", |
| switch (position) { | ||
| case "top": | ||
| return { | ||
| top: currentPopoverRect.top - popoverHeight, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can use destructuring to prevent repeating currentPopoverRect.
const { top, right, bottom, left } = currentPopoverRect;
| top: currentPopoverRect.top - popoverHeight, | |
| top: top - popoverHeight, | |
| left, | |
| ....... |
| </div> | ||
| {primaryButton && ( | ||
| <div className="popover__footer"> | ||
| {size !== "small" && footerContent && footerContent} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why we need to repeat ?
| {size !== "small" && footerContent && footerContent} | |
| {size !== "small" && footerContent} |
|
|
||
| isOpen?: boolean; | ||
| /** | ||
| * Size of the popover: `xLarge`, `large`, `medium`, `small`, or `mobile`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| * Size of the popover: `xLarge`, `large`, `medium`, `small`, or `mobile`. | |
| * Size of the popover.<br> | |
| * Possible values: `xLarge`, `large`, `medium`, `small`, or `mobile`. |
| /** | ||
| * Padding between the popover and the target element. | ||
| */ | ||
| padding: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why padding is required for this component?
| primaryButton, | ||
| secondaryButton, | ||
| footerContent, | ||
| withArrow = true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As in most cases we use Popover component withArrow: false ( DatePicker, Menu, Dropdown...) i think better to set the default value to false.
| size, | ||
| position = "bottom-center", | ||
| padding = 10, | ||
| isOpen = false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need the default value for isOpen prop.
| } | ||
| }); | ||
|
|
||
| if (leastOverlap > 0) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'if' statement can be simplified.
| if (leastOverlap > 0) { | |
| hasOverlap = leastOverlap > 0; |
| */ | ||
|
|
||
| const Popover: FC<IPopoverProps> = ({ | ||
| size, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to add default value.
…onents into feature/popover-component
hamikhambardzumyan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
Chromatic Build Summary
Build URL: https://www.chromatic.com/build?appId=66daee7859a843dd87bfb3d7&number=301
Storybook URL: https://66daee7859a843dd87bfb3d7-fvhqkuhova.chromatic.com/