diff --git a/packages/documentation-framework/components/example/example.css b/packages/documentation-framework/components/example/example.css index 0e646106f2..a9750d46c4 100644 --- a/packages/documentation-framework/components/example/example.css +++ b/packages/documentation-framework/components/example/example.css @@ -72,12 +72,48 @@ .ws-full-page-utils { position: fixed; - inset-inline-start: 0; inset-block-end: 0; - padding: var(--pf-t--global--spacer--lg); + padding: var(--pf-t--global--spacer--xl); z-index: var(--pf-t--global--z-index--2xl); } +.ws-full-page-utils-position-btn { + --ws-full-page-utils-btn--inset: var(--pf-t--global--spacer--xs); + position: absolute; +} + +:is(.ws-full-page-utils, .ws-full-page-utils-position-btn).pf-m-top-right { + top: var(--ws-full-page-utils-btn--inset, 0); + right: var(--ws-full-page-utils-btn--inset, 0); + bottom: auto; + left: auto; +} + +:is(.ws-full-page-utils, .ws-full-page-utils-position-btn).pf-m-bottom-right { + top: auto; + right: var(--ws-full-page-utils-btn--inset, 0); + bottom: var(--ws-full-page-utils-btn--inset, 0); + left: auto; +} + +:is(.ws-full-page-utils, .ws-full-page-utils-position-btn).pf-m-bottom-left { + top: auto; + right: auto; + bottom: var(--ws-full-page-utils-btn--inset, 0); + left: var(--ws-full-page-utils-btn--inset, 0); +} + +:is(.ws-full-page-utils, .ws-full-page-utils-position-btn).pf-m-top-left { + top: var(--ws-full-page-utils-btn--inset, 0); + right: auto; + bottom: auto; + left: var(--ws-full-page-utils-btn--inset, 0); +} + +.ws-full-page-utils-position-btn.pf-m-clicked { + --pf-v6-c-button__icon--Color: var(--pf-t--global--text--color--regular); +} + .ws-full-page-utils::before { position: absolute; inset: 0; diff --git a/packages/documentation-framework/components/example/example.js b/packages/documentation-framework/components/example/example.js index ab00910be7..8ee8de60fb 100644 --- a/packages/documentation-framework/components/example/example.js +++ b/packages/documentation-framework/components/example/example.js @@ -34,6 +34,15 @@ import missingThumbnail from './missing-thumbnail.jpg'; import { RtlContext } from '../../layouts'; import { ThemeSelector } from '../themeSelector/themeSelector'; +import RhUiArrowCircleDownRightIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-arrow-circle-down-right-icon'; +import RhUiArrowCircleDownLeftIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-arrow-circle-down-left-icon'; +import RhUiArrowCircleUpRightIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-arrow-circle-up-right-icon'; +import RhUiArrowCircleUpLeftIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-arrow-circle-up-left-icon'; +import RhUiArrowCircleDownRightFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-arrow-circle-down-right-fill-icon'; +import RhUiArrowCircleDownLeftFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-arrow-circle-down-left-fill-icon'; +import RhUiArrowCircleUpRightFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-arrow-circle-up-right-fill-icon'; +import RhUiArrowCircleUpLeftFillIcon from '@patternfly/react-icons/dist/esm/icons/rh-ui-arrow-circle-up-left-fill-icon'; + const errorComponent = (err) =>
{err.toString()};
class ErrorBoundary extends React.Component {
@@ -137,8 +146,22 @@ export const Example = ({
}
const [editorCode, setEditorCode] = React.useState(code);
+ const isBrowser = typeof window !== 'undefined' && window.localStorage;
+ const [fullPageUtilsPosition, setFullPageUtilsPosition] = React.useState(() => {
+ if (isBrowser) {
+ return localStorage.getItem('fullPageUtilsPosition') || 'pf-m-bottom-left';
+ }
+ return 'pf-m-bottom-left';
+ });
const loc = useLocation();
const isRTL = useContext(RtlContext);
+
+ // Save fullPageUtilsPosition to localStorage when it changes
+ useEffect(() => {
+ if (isBrowser) {
+ localStorage.setItem('fullPageUtilsPosition', fullPageUtilsPosition);
+ }
+ }, [fullPageUtilsPosition]);
const scope = {
...liveContext,
// These 2 are in the bundle anyways for the site since we dogfood
@@ -186,15 +209,51 @@ export const Example = ({
const previewId = getExampleId(source, section[0], id, title);
const className = getExampleClassName(source, section[0], id);
+ // Four corner position button props
+ const fullPageUtilsPositionProps = {
+ topLeft: {
+ className: 'pf-m-top-left',
+ label: 'Move to the top left corner',
+ tooltipPosition: 'bottom-start',
+ icon: