diff --git a/.storybook/preview-head.html b/.storybook/preview-head.html index ba4ed6b24..3e25d9cd8 100644 --- a/.storybook/preview-head.html +++ b/.storybook/preview-head.html @@ -58,6 +58,17 @@ color: #35376a !important; font-weight: 700 !important; } + + #experimental-banner { + position: sticky; + top: 0; + padding: var(--spacing-sm) var(--spacing-xl); + z-index: var(--z-index-sticky); + font-size: 1rem !important; + font-weight: 600; + background-color: rgb(var(--colors-alert)); + color: rgb(var(--colors-on-alert)); + } diff --git a/.storybook/preview.jsx b/.storybook/preview.jsx index 4cb807d3e..3cf9c81e1 100644 --- a/.storybook/preview.jsx +++ b/.storybook/preview.jsx @@ -8,9 +8,24 @@ import './sb-theming.css' import { ToC } from '@docs/helpers/ToC' const ExampleContainer = ({ children, ...props }) => { + const shouldDisplayExperimentalBanner = (() => { + const docsPrepared = props.context.channel.data.docsPrepared + if (!docsPrepared) return false + + return docsPrepared.some(doc => { + if (!doc.id) return false + return doc.id.includes('experimental-') + }) + })() + return ( - {children} + + {shouldDisplayExperimentalBanner && + This component is still experimental. Avoid usage in production features + } + {children} + )
+ This component is still experimental. Avoid usage in production features +