-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(popover): update documentation to use new mdx format and components
- Loading branch information
1 parent
a04782e
commit 0ff7bd0
Showing
2 changed files
with
193 additions
and
146 deletions.
There are no files selected for viewing
190 changes: 190 additions & 0 deletions
190
libs/core/src/components/pds-popover/docs/pds-popover.mdx
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,190 @@ | ||
import {DocArgsTable, DocCanvas} from '@pine-ds/doc-components'; | ||
import { components } from '../../../../dist/docs.json'; | ||
|
||
# Popover | ||
|
||
Popover is a discrete UI element that displays over the main content to present extra information or user options. It's designed for minimal disruption, appearing only when necessary and allowing for a clutter-free, user-centric experience. | ||
|
||
## Properties | ||
|
||
<DocArgsTable componentName="pds-popover" docSource={components} /> | ||
|
||
## Variants | ||
|
||
### Trigger | ||
The trigger can be a button, `pds-button`, another Pine component, or an HTML element. There is just one trigger for each Popover, making its use straightforward. | ||
There can only be one trigger for the Popover. | ||
|
||
#### Button trigger | ||
|
||
<DocCanvas mdxSource={{ | ||
react: `<PdsPopover placement="bottom-right" htmlContent={true}> | ||
<div slot="content"> | ||
<p><strong>This is a popover</strong></p> | ||
</div> | ||
<PdsButton variant="secondary">Click</PdsButton> | ||
</PdsPopover>`, | ||
webComponent: `<pds-popover placement="bottom-right" html-content="true"> | ||
<div slot="content"> | ||
<p><strong>This is a popover</strong></p> | ||
</div> | ||
<pds-button variant="secondary">Click</pds-button> | ||
</pds-popover> | ||
`}}> | ||
<div style={{ height: '100px' }}> | ||
<pds-popover placement="bottom-start" html-content="true"> | ||
<div slot="content"> | ||
<p><strong>This is a popover</strong></p> | ||
</div> | ||
<pds-button variant="secondary">Click</pds-button> | ||
</pds-popover> | ||
</div> | ||
</DocCanvas> | ||
|
||
#### Avatar trigger | ||
<DocCanvas mdxSource={{ | ||
react: `<PdsPopover placement="bottom-start" htmlContent={true}> | ||
<div slot="content"> | ||
<p><strong>This is a popover</strong></p> | ||
</div> | ||
<PdsAvatar dropdown="true"></PdsAvatar> | ||
</PdsPopover>`, | ||
webComponent: `<pds-popover placement="bottom-start" html-content="true"> | ||
<div slot="content"> | ||
<p><strong>This is a popover</strong></p> | ||
</div> | ||
<pds-avatar dropdown="true"></pds-avatar> | ||
</pds-popover> | ||
`}}> | ||
<div style={{ height: '125px' }}> | ||
<pds-popover has-arrow="true" placement="bottom-start" html-content="true"> | ||
<div slot="content"> | ||
<p><strong>This is a popover</strong></p> | ||
</div> | ||
<pds-avatar dropdown="true"></pds-avatar> | ||
</pds-popover> | ||
</div> | ||
</DocCanvas> | ||
|
||
### Content | ||
The popover content is placed in a container with the slot, `content`. This is where you can place any HTML content you want to display in the popover. | ||
|
||
<DocCanvas mdxSource={{ | ||
react: `<PdsPopover placement="bottom-start"> | ||
<div slot="content"> | ||
<p>Pastrami chuck leberkas, swine biltong tail fatback jowl landjaeger</p> | ||
<div> | ||
<PdsButton variant="secondary">Cancel</PdsButton> | ||
<PdsButton>Get Started</PdsButton> | ||
</div> | ||
</div> | ||
<PdsButton variant="secondary">Popover trigger</PdsButton> | ||
</PdsPopover>`, | ||
webComponent: `<pds-popover placement="bottom-start"> | ||
<div slot="content"> | ||
<p>Pastrami chuck leberkas, swine biltong tail fatback jowl landjaeger</p> | ||
<div> | ||
<pds-button variant="secondary">Cancel</pds-button> | ||
<pds-button>Get Started</pds-button> | ||
</div> | ||
</div> | ||
<pds-button variant="secondary">Popover trigger</pds-button> | ||
</pds-popover> | ||
`}}> | ||
<div style={{ height: '150px' }}> | ||
<pds-popover placement="bottom-start"> | ||
<div slot="content"> | ||
<p>Pastrami chuck leberkas, swine biltong tail fatback jowl landjaeger.</p> | ||
<div> | ||
<pds-button variant="secondary">Cancel</pds-button> | ||
<pds-button>Get Started</pds-button> | ||
</div> | ||
</div> | ||
<pds-button variant="secondary">Popover trigger</pds-button> | ||
</pds-popover> | ||
</div> | ||
</DocCanvas> | ||
|
||
### Placement | ||
The placement property enables precise control over the positioning of your Popover. By utilizing this | ||
property, you can dictate the specific location of the popover relative to the trigger element. This | ||
customization ensures optimal visibility and alignment per your page's layout and design requirements. | ||
To see more example, navigate to the [playground](#playground). | ||
|
||
Example `top-start` placement: | ||
<DocCanvas mdxSource={{ | ||
react: `<PdsPopover hasArrow={true} placement="top-start"> | ||
<div slot="content"> | ||
<p><strong>Popover Content</strong></p> | ||
</div> | ||
<PdsButton variant="secondary">top-start</PdsButton> | ||
</PdsPopover>`, | ||
webComponent: `<pds-popover has-arrow="true" placement="top-start"> | ||
<div slot="content"> | ||
<p><strong>Popover Content</strong></p> | ||
</div> | ||
<pds-button variant="secondary">top-start</pds-button> | ||
</pds-popover> | ||
`}}> | ||
<pds-popover has-arrow="true" placement="top-start"> | ||
<div slot="content"> | ||
<p><strong>Popover Content</strong></p> | ||
</div> | ||
<pds-button variant="secondary">top-start</pds-button> | ||
</pds-popover> | ||
</DocCanvas> | ||
|
||
Example `right-start` placement: | ||
<DocCanvas mdxSource={{ | ||
react: `<PdsPopover hasArrow={true} placement="right-start"> | ||
<div slot="content"> | ||
<p><strong>Popover Content</strong></p> | ||
</div> | ||
<PdsButton variant="secondary">right-start</PdsButton> | ||
</PdsPopover>`, | ||
webComponent: `<pds-popover has-arrow="true" placement="right-start"> | ||
<div slot="content"> | ||
<p><strong>Popover Content</strong></p> | ||
</div> | ||
<pds-button variant="secondary">right-start</pds-button> | ||
</pds-popover> | ||
`}}> | ||
<pds-popover has-arrow="true" placement="right-start"> | ||
<div slot="content"> | ||
<p><strong>Popover Content</strong></p> | ||
</div> | ||
<pds-button variant="secondary">right-start</pds-button> | ||
</pds-popover> | ||
</DocCanvas> | ||
|
||
|
||
|
||
### Arrow | ||
By default the arrow is hidden. It can be shown by setting `has-arrow` to `true`. | ||
|
||
<DocCanvas mdxSource={{ | ||
react: `<PdsPopover hasArrow={true} placement="bottom-start"> | ||
<div slot="content"> | ||
<p><strong>This is a popover</strong></p> | ||
<p><strong>This is a popover</strong></p> | ||
</div> | ||
<PdsAvatar dropdown="true"></PdsAvatar> | ||
</PdsPopover>`, | ||
webComponent: `<pds-popover has-arrow="true" placement="bottom-start"> | ||
<div slot="content"> | ||
<p><strong>This is a popover</strong></p> | ||
<p><strong>This is a popover</strong></p> | ||
</div> | ||
<pds-avatar dropdown="true"></pds-avatar> | ||
</pds-popover> | ||
`}}> | ||
<div style={{ height: '150px' }}> | ||
<pds-popover has-arrow="true" placement="bottom-start"> | ||
<div slot="content"> | ||
<p><strong>This is a popover</strong></p> | ||
<p><strong>This is a popover</strong></p> | ||
</div> | ||
<pds-button variant="secondary">Click</pds-button> | ||
</pds-popover> | ||
</div> | ||
</DocCanvas> |
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