-
Notifications
You must be signed in to change notification settings - Fork 784
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(components): add content for popover (#2947)
* chore(data): update react docgen * feat(components): add content for popover * chore: update tabs for popover Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
- Loading branch information
1 parent
73502ea
commit 64af1b6
Showing
7 changed files
with
286 additions
and
5 deletions.
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
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,55 @@ | ||
import './styles.scss'; | ||
|
||
import { Checkbox } from '@carbon/icons-react'; | ||
import React from 'react'; | ||
import ComponentDemo from '../../../components/ComponentDemo'; | ||
import ComponentVariant from '../../../components/ComponentDemo/ComponentVariant'; | ||
|
||
const content = ` | ||
<Popover open> | ||
<div className="popover-trigger"> | ||
<Checkbox /> | ||
</div> | ||
<PopoverContent> | ||
<div className="popover-example-content"> | ||
<p className="popover-title">Available storage</p> | ||
<p className="popover-details"> | ||
This server has 150 GB of block storage remaining. | ||
</p> | ||
</div> | ||
</PopoverContent> | ||
</Popover> | ||
`; | ||
|
||
const components = [ | ||
{ | ||
id: 'popover', | ||
label: 'Popover', | ||
}, | ||
]; | ||
|
||
const knobs = { | ||
Popover: ['align', 'caret', 'dropShadow', 'highContrast'], | ||
}; | ||
|
||
const links = { | ||
React: | ||
'https://react.carbondesignsystem.com/?path=/story/components-popover--playground', | ||
}; | ||
|
||
function PopoverComponentDemo() { | ||
return ( | ||
<ComponentDemo | ||
components={components} | ||
scope={{ | ||
Checkbox, | ||
}} | ||
> | ||
<ComponentVariant id="popover" knobs={knobs} links={links}> | ||
{content} | ||
</ComponentVariant> | ||
</ComponentDemo> | ||
); | ||
} | ||
|
||
export default PopoverComponentDemo; |
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,34 @@ | ||
--- | ||
title: Popover | ||
description: | ||
A popover is a layer that pops up over all other elements on a page. | ||
tabs: ['Usage', 'Style', 'Code'] | ||
--- | ||
|
||
import PopoverComponentDemo from './ComponentDemo'; | ||
|
||
<PageDescription> | ||
|
||
Preview the popover component with the React live demo. For detailed code usage | ||
documentation, see the Storybooks for each framework below. | ||
|
||
</PageDescription> | ||
|
||
## Documentation | ||
|
||
<Row className="resource-card-group"> | ||
<Column colLg={4} colMd={4} noGutterSm> | ||
<ResourceCard | ||
subTitle="React" | ||
href="https://react.carbondesignsystem.com/?path=/story/components-search--default" | ||
> | ||
|
||
<MdxIcon name="react" /> | ||
|
||
</ResourceCard> | ||
</Column> | ||
</Row> | ||
|
||
## Live demo | ||
|
||
<PopoverComponentDemo /> |
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,36 @@ | ||
@use '@carbon/react/scss/theme'; | ||
@use '@carbon/react/scss/spacing'; | ||
@use '@carbon/react/scss/type'; | ||
|
||
.popover-trigger { | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
width: 2rem; | ||
height: 2rem; | ||
border: 1px solid theme.$border-subtle; | ||
} | ||
|
||
.popover-trigger svg { | ||
fill: theme.$background-inverse; | ||
} | ||
|
||
.popover-example-content { | ||
padding: 1rem; | ||
} | ||
|
||
.popover-title { | ||
@include type.type-style('heading-compact-01'); | ||
margin-bottom: spacing.$spacing-01; | ||
} | ||
|
||
.popover-details { | ||
@include type.type-style('body-compact-01'); | ||
} | ||
|
||
.popover-story { | ||
width: 100%; | ||
height: 100%; | ||
display: flex; | ||
flex-direction: column; | ||
} |
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
64af1b6
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.
Successfully deployed to the following URLs:
carbondesignsystem – ./
carbondesignsystem.vercel.app
carbondesignsystem-carbon-design-system.vercel.app
carbondesignsystem-git-main-carbon-design-system.vercel.app