Skip to content

Conversation

@NarekArshakyan
Copy link
Contributor

@NarekArshakyan NarekArshakyan commented Nov 21, 2024

@NarekArshakyan NarekArshakyan self-assigned this Nov 21, 2024
@NarekArshakyan NarekArshakyan changed the title Feature/popover component feat(Popover): new component Nov 21, 2024
/**
* Size of the popover: `xLarge`, `large`, `medium`, `small`, or `mobile`.
*/
size: "xLarge" | "large" | "medium" | "small" | "mobile";
Copy link
Collaborator

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",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please add run test.

Suggested change
"start": "storybook dev -p 6006",
"start": "npm run test && storybook dev -p 6006",

switch (position) {
case "top":
return {
top: currentPopoverRect.top - popoverHeight,
Copy link
Collaborator

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;

Suggested change
top: currentPopoverRect.top - popoverHeight,
top: top - popoverHeight,
left,
.......

</div>
{primaryButton && (
<div className="popover__footer">
{size !== "small" && footerContent && footerContent}
Copy link
Collaborator

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 ?

Suggested change
{size !== "small" && footerContent && footerContent}
{size !== "small" && footerContent}


isOpen?: boolean;
/**
* Size of the popover: `xLarge`, `large`, `medium`, `small`, or `mobile`.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
* 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;
Copy link
Collaborator

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,
Copy link
Collaborator

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,
Copy link
Collaborator

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) {
Copy link
Collaborator

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.

Suggested change
if (leastOverlap > 0) {
hasOverlap = leastOverlap > 0;

*/

const Popover: FC<IPopoverProps> = ({
size,
Copy link
Collaborator

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.

@hamikhambardzumyan hamikhambardzumyan linked an issue Jan 15, 2025 that may be closed by this pull request
6 tasks
Copy link
Contributor

@hamikhambardzumyan hamikhambardzumyan left a 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

@hamikhambardzumyan hamikhambardzumyan merged commit ca44d76 into release/3.0.0 Feb 15, 2025
4 of 6 checks passed
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.

[Feat]: New Popover component

5 participants