-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* done * del effect * ver * del pt * fix nav name --------- Co-authored-by: Aleksej Tre <[email protected]>
- Loading branch information
Showing
6 changed files
with
116 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import React from "react" | ||
import { OverlayPanel as PrimeOverlayPanel } from "primereact/overlaypanel" | ||
|
||
import { pickDataAttributes } from "../../utils" | ||
|
||
export const OverlayPanel = React.forwardRef( | ||
( | ||
{ | ||
ariaCloseLabel, | ||
breakpoints, | ||
closeIcon, | ||
closeOnEscape = true, | ||
dismissable = true, | ||
showCloseIcon = false, | ||
transitionOptions, | ||
unstyled = false, | ||
onShow, | ||
onHide, | ||
children, | ||
...props | ||
}, | ||
ref) => { | ||
const dataAttributes = pickDataAttributes(props) | ||
|
||
return ( | ||
<PrimeOverlayPanel | ||
ref={ref} | ||
ariaCloseLabel={ariaCloseLabel} | ||
breakpoints={breakpoints} | ||
closeIcon={closeIcon} | ||
closeOnEscape={closeOnEscape} | ||
dismissable={dismissable} | ||
showCloseIcon={showCloseIcon} | ||
transitionOptions={transitionOptions} | ||
unstyled={unstyled} | ||
onShow={onShow} | ||
onHide={onHide} | ||
{...dataAttributes} | ||
> | ||
{children} | ||
</PrimeOverlayPanel> | ||
) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
content: OverlayPanel, also known as Popover, is a container component that can overlay other components on page. | ||
props: | ||
ariaCloseLabel: Aria label of the close icon. | ||
breakpoints: Object literal to define widths per screen size. | ||
children: Used to get the child elements of the component. | ||
closeIcon: Icon to display as close icon. | ||
closeOnEscape: Specifies if pressing escape key should hide the preview. | ||
dismissable: Enables to hide the overlay when outside is clicked. | ||
showCloseIcon: When enabled, displays a close icon at top right corner. | ||
transitionOptions: The properties of CSSTransition can be customized, except for "nodeRef" and "in" properties. | ||
unstyled: When enabled, it removes component related styles in the core. | ||
onHide: Callback to invoke when overlay becomes hidden. | ||
onShow: Callback to invoke when overlay becomes visible. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* eslint-disable max-len */ | ||
import { OverlayPanel, Button } from "@cadolabs/sphere-ui" | ||
|
||
import i18n from "@i18n" | ||
|
||
const I18N_PREFIX = "stories.overlayPanel" | ||
|
||
const code = ` | ||
function OverlayPanelExample() { | ||
const op = React.useRef(null); | ||
return ( | ||
<div className="card flex justify-content-center"> | ||
<Button type="button" icon="pi pi-image" label="Image" onClick={(e) => op.current.toggle(e)} /> | ||
<OverlayPanel ref={op}> | ||
<img src={'https://primefaces.org/cdn/primereact/images/product/bamboo-watch.jpg'} alt="Bamboo Watch"></img> | ||
</OverlayPanel> | ||
</div> | ||
); | ||
} | ||
` | ||
|
||
export const overlayPanel = { | ||
component: "OverlayPanel", | ||
content: { | ||
description: i18n.t(`${I18N_PREFIX}.content`), | ||
}, | ||
code, | ||
scope: { OverlayPanel, Button }, | ||
descriptionProps: [ | ||
{ name: "ariaCloseLabel", type: "string", default: "close", description: `${I18N_PREFIX}.props.ariaCloseLabel` }, | ||
{ name: "breakpoints", type: "OverlayPanelBreakpoints", default: null, description: `${I18N_PREFIX}.props.breakpoints` }, | ||
{ name: "children", type: "ReactNode", default: null, description: `${I18N_PREFIX}.props.children` }, | ||
{ name: "closeIcon", type: "IconType<OverlayPanelProps>", default: null, description: `${I18N_PREFIX}.props.closeIcon` }, | ||
{ name: "closeOnEscape", type: "boolean", default: true, description: `${I18N_PREFIX}.props.closeOnEscape` }, | ||
{ name: "dismissable", type: "boolean", default: true, description: `${I18N_PREFIX}.props.dismissable` }, | ||
{ name: "showCloseIcon", type: "boolean", default: false, description: `${I18N_PREFIX}.props.showCloseIcon` }, | ||
{ name: "transitionOptions", type: "CSSTransitionProps", default: null, description: `${I18N_PREFIX}.props.transitionOptions` }, | ||
{ name: "unstyled", type: "boolean", default: false, description: `${I18N_PREFIX}.props.unstyled` }, | ||
], | ||
eventDescriptionProps: [ | ||
{ name: "onHide", description: `${I18N_PREFIX}.props.onHide` }, | ||
{ name: "onShow", description: `${I18N_PREFIX}.props.onShow` }, | ||
], | ||
} |
13 changes: 13 additions & 0 deletions
13
storybook/stories/display/OverlayPanel/overlayPanel.stories.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import React from "react" | ||
|
||
import { StoryPage } from "@components" | ||
|
||
import { overlayPanel } from "./overlayPanel" | ||
|
||
export default { | ||
title: "Components / Display", | ||
} | ||
|
||
export const OverlayPanel = context => <StoryPage {...overlayPanel} {...context} /> | ||
|
||
OverlayPanel.storyName = "OverlayPanel" |