diff --git a/ui/components/ui/popover/README.mdx b/ui/components/ui/popover/README.mdx
deleted file mode 100644
index 3a4c922db..000000000
--- a/ui/components/ui/popover/README.mdx
+++ /dev/null
@@ -1,16 +0,0 @@
-import { Story, Canvas, ArgsTable } from '@storybook/addon-docs';
-
-import Popover from './popover.component';
-
-# Popover
-
-A modal component to show info
-
-
-
-## Component API
-
-
-
diff --git a/ui/components/ui/popover/popover.component.js b/ui/components/ui/popover/popover.component.js
index 4904046bb..09424163e 100644
--- a/ui/components/ui/popover/popover.component.js
+++ b/ui/components/ui/popover/popover.component.js
@@ -3,6 +3,7 @@ import ReactDOM from 'react-dom';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { useI18nContext } from '../../../hooks/useI18nContext';
+import Box from '../box';
const Popover = ({
title,
@@ -18,9 +19,47 @@ const Popover = ({
CustomBackground,
popoverRef,
centerTitle,
+ headerProps = {},
+ contentProps = {},
+ footerProps = {},
}) => {
const t = useI18nContext();
const showHeader = title || onBack || subtitle || onClose;
+ const Header = () => {
+ return (
+
+
+
+ {onBack ? (
+
+ ) : null}
+ {title}
+
+ {onClose ? (
+
+ ) : null}
+
+ {subtitle ? (
+ {subtitle}
+ ) : null}
+
+ );
+ };
+
return (
{CustomBackground ? (
@@ -33,47 +72,22 @@ const Popover = ({
ref={popoverRef}
>
{showArrow ?
: null}
- {showHeader && (
-
- )}
+ {showHeader &&
}
{children ? (
-
+
{children}
-
+
) : null}
{footer ? (
-
+
) : null}
@@ -132,6 +146,18 @@ Popover.propTypes = {
* Check if use centered title
*/
centerTitle: PropTypes.bool,
+ /**
+ * Box props for the header
+ */
+ headerProps: PropTypes.shape({ ...Box.propTypes }),
+ /**
+ * Box props for the content
+ */
+ contentProps: PropTypes.shape({ ...Box.propTypes }),
+ /**
+ * Box props for the footer
+ */
+ footerProps: PropTypes.shape({ ...Box.propTypes }),
};
export default class PopoverPortal extends PureComponent {
diff --git a/ui/components/ui/popover/popover.stories.js b/ui/components/ui/popover/popover.stories.js
index e23bd91c4..ef9f8e041 100644
--- a/ui/components/ui/popover/popover.stories.js
+++ b/ui/components/ui/popover/popover.stories.js
@@ -1,18 +1,12 @@
import React, { useState } from 'react';
import Button from '../button';
import Box from '../box';
-import README from './README.mdx';
import Popover from './popover.component';
export default {
title: 'Components/UI/Popover',
id: __filename,
component: Popover,
- parameters: {
- docs: {
- page: README,
- },
- },
argTypes: {
title: { control: 'text' },
subtitle: { control: 'text' },
@@ -26,6 +20,21 @@ export default {
showArrow: { control: 'boolean' },
popoverRef: { control: 'object' },
centerTitle: { control: 'boolean' },
+ headerProps: {
+ control: 'object',
+ description:
+ 'Box component props used to add container CSS for the header',
+ },
+ contentProps: {
+ control: 'object',
+ description:
+ 'Box component props used to add container CSS for the content',
+ },
+ footerProps: {
+ control: 'object',
+ description:
+ 'Box component props used to add container CSS for the footer',
+ },
},
};