-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs:
menuPortalZIndex
docs improvements (#2484)
* docs: make menuPortalZIndex docs more explicit * refactor: copy implementation to all stories * refactor: warn when menuPortalZIndex used without menuPortalTarget * chore: add changeset * refactor: change and externalize implementation of warning * refactor: dry * refactor: dry part 2 * chore: rename * chore: rename
- Loading branch information
Showing
47 changed files
with
723 additions
and
479 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
'@commercetools-uikit/async-creatable-select-field': patch | ||
'@commercetools-uikit/async-creatable-select-input': patch | ||
'@commercetools-uikit/selectable-search-input': patch | ||
'@commercetools-uikit/creatable-select-field': patch | ||
'@commercetools-uikit/creatable-select-input': patch | ||
'@commercetools-uikit/search-select-field': patch | ||
'@commercetools-uikit/search-select-input': patch | ||
'@commercetools-uikit/async-select-field': patch | ||
'@commercetools-uikit/async-select-input': patch | ||
'@commercetools-uikit/select-field': patch | ||
'@commercetools-uikit/select-input': patch | ||
'@commercetools-uikit/select-utils': patch | ||
'@commercetools-uikit/money-field': patch | ||
'@commercetools-uikit/money-input': patch | ||
--- | ||
|
||
Improve docs regarding the use of `menuPortalZIndex` prop. | ||
Warn when `menuPortalZIndex` is used without setting `menuPortalTarget`. |
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 |
---|---|---|
@@ -1,2 +1,3 @@ | ||
export { default as FormikBox } from './formik-box'; | ||
export { default as Section } from './section'; | ||
export { default as NeighbouringStackingContext } from './neighbouring-stacking-context'; |
1 change: 1 addition & 0 deletions
1
docs/.storybook/decorators/neighbouring-stacking-context/index.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 @@ | ||
export { default } from './neighbouring-stacking-context'; |
28 changes: 28 additions & 0 deletions
28
docs/.storybook/decorators/neighbouring-stacking-context/neighbouring-stacking-context.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,28 @@ | ||
import Card from '@commercetools-uikit/card'; | ||
import styled from '@emotion/styled'; | ||
import { boolean } from '@storybook/addon-knobs/react'; | ||
|
||
const StackingContext = styled.div` | ||
width: 300px; | ||
height: 50px; | ||
position: relative; | ||
z-index: 2; | ||
`; | ||
|
||
const NeighbouringStackingContext = () => { | ||
const isActive = boolean( | ||
'menuPortalZIndex-show-neighbouring-stacking-context', | ||
false | ||
); | ||
return ( | ||
isActive && ( | ||
<StackingContext> | ||
<Card theme="dark"> | ||
Stacking context with <code>z-index: 2</code> | ||
</Card> | ||
</StackingContext> | ||
) | ||
); | ||
}; | ||
|
||
export default NeighbouringStackingContext; |
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,21 @@ | ||
import { select } from '@storybook/addon-knobs/react'; | ||
|
||
const getMenuPortalTargetValue = (menuPortalTarget) => { | ||
if (menuPortalTarget === 'document.body') { | ||
return document.body; | ||
} | ||
return undefined; | ||
}; | ||
|
||
export const addMenuPortalProps = () => { | ||
const menuPortalZIndex = select('menuPortalZIndex', [1, 2, 3], 1); | ||
const menuPortalTarget = select( | ||
'menuPortalTarget', | ||
['undefined', 'document.body'], | ||
'undefined' | ||
); | ||
return { | ||
menuPortalZIndex, | ||
menuPortalTarget: getMenuPortalTargetValue(menuPortalTarget), | ||
}; | ||
}; |
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 @@ | ||
export { addMenuPortalProps } from './add-menu-portal-props'; |
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
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
Oops, something went wrong.
75da6b8
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:
ui-kit – ./
ui-kit-five-rho.vercel.app
ui-kit-git-main-commercetools.vercel.app
ui-kit-commercetools.vercel.app
uikit.commercetools.com