diff --git a/packages/documentation-framework/components/example/example.js b/packages/documentation-framework/components/example/example.js index 8ee8de60fb..2f19941481 100644 --- a/packages/documentation-framework/components/example/example.js +++ b/packages/documentation-framework/components/example/example.js @@ -9,8 +9,7 @@ import { Label, Switch, Tooltip, - Stack, - StackItem, + Stack } from '@patternfly/react-core'; import * as reactCoreModule from '@patternfly/react-core'; import * as reactCoreNextModule from '@patternfly/react-core/next'; @@ -117,8 +116,6 @@ export const Example = ({ // absolute url to hosted file sourceLink = '' }) => { - - if (isFullscreenPreview) { isFullscreen = false; } @@ -284,7 +281,9 @@ export const Example = ({ className={css('ws-full-page-utils-position-btn', utilsProps.className)} isClicked={fullPageUtilsPosition === utilsProps.className} onClick={() => setFullPageUtilsPosition(utilsProps.className)} - aria-label={`${utilsProps.label}${fullPageUtilsPosition === utilsProps.className ? ', selected' : ''}`} + aria-label={`${utilsProps.label}${ + fullPageUtilsPosition === utilsProps.className ? ', selected' : '' + }`} icon={fullPageUtilsPosition === utilsProps.className ? utilsProps.iconClicked : utilsProps.icon} /> @@ -303,7 +302,7 @@ export const Example = ({ const fullscreenLink = (() => { const cleanPathname = loc.pathname.replace(/\/$/, ''); const sourcePath = `/${source}`; - + // Check if the source is already at the end of the pathname to avoid duplication // Using endsWith instead of includes to prevent false positives (e.g., /react-console matching /react) if (cleanPathname.endsWith(sourcePath)) { @@ -348,19 +347,19 @@ export const Example = ({ const metaText = hasMetaText && tooltips; const thumbnailDimensions = { - width: "800", - height: "450" - } + width: '800', + height: '450' + }; return ( - + {title} {children} - - + + {isFullscreen ? (
- {`${title} + {`${title}
) : ( @@ -377,8 +381,8 @@ export const Example = ({ {livePreview} )} - - +
+ - + ); }; diff --git a/packages/documentation-framework/templates/mdx.css b/packages/documentation-framework/templates/mdx.css index 17f6f13d0e..c9b508b922 100644 --- a/packages/documentation-framework/templates/mdx.css +++ b/packages/documentation-framework/templates/mdx.css @@ -1,9 +1,15 @@ @import './content-sources/ai-guidelines.css'; -p.pf-v6-c-content--p.ws-p { +/* Stack gutter already spaces direct children; don't also use paragraph margins. */ +.pf-v6-l-stack.pf-m-gutter > p.pf-v6-c-content--p.ws-p { margin: 0; } +/* Stack gutter provides spacing before template section headings. */ +.ws-example-page-wrapper.pf-m-gutter .ws-stack-section-heading { + margin-block-start: 0; +} + .ws-code { display: inline-block; background-color: var(--pf-t--global--background--color--secondary--default); diff --git a/packages/documentation-framework/templates/mdx.js b/packages/documentation-framework/templates/mdx.js index 24c3da8031..882d9f8b74 100644 --- a/packages/documentation-framework/templates/mdx.js +++ b/packages/documentation-framework/templates/mdx.js @@ -87,8 +87,6 @@ const MDXChildTemplate = ({ Component, source, toc = [], index = 0, id }) => { ensureID(toc); } - const isComponentCodeDocs = ['react', 'react-demos', 'html', 'html-demos', 'react-templates'].includes(source); - const InlineAlerts = (optIn || beta || deprecated || @@ -134,14 +132,17 @@ const MDXChildTemplate = ({ Component, source, toc = [], index = 0, id }) => { ); // Create dynamic component for @reach/router const ChildComponent = () => ( -
+
{toc.length > 1 && } - + {InlineAlerts} {source !== 'css-variables' && } {source !== 'css-variables' && functionDocumentation.length > 0 && ( - + Functions @@ -149,7 +150,7 @@ const MDXChildTemplate = ({ Component, source, toc = [], index = 0, id }) => { )} {source !== 'css-variables' && propsTitle && ( - + {propsTitle} {propComponents.map((component) => ( @@ -165,7 +166,7 @@ const MDXChildTemplate = ({ Component, source, toc = [], index = 0, id }) => { )} {source === 'css-variables' && cssPrefix.length > 0 && ( - + {cssVarsTitle} {cssPrefix.map((prefix, index) => (