diff --git a/docs/001_develop/03_client-capabilities/007_forms/forms-index.js b/docs/001_develop/03_client-capabilities/007_forms/forms-index.js new file mode 100644 index 0000000000..60fa9606e1 --- /dev/null +++ b/docs/001_develop/03_client-capabilities/007_forms/forms-index.js @@ -0,0 +1,126 @@ +import LiveExampleBuilder from '@site/src/components/LiveExampleBuilder'; +import {useUpdateCSSVariable} from '@site/src/components/Hooks'; + +import ButtonDemo from '/examples/ui/client-capabilities/interaction/button.js'; +import CheckboxDemo from '/examples/ui/client-capabilities/interaction/checkbox.js'; +import ComboboxDemo from '/examples/ui/client-capabilities/interaction/combobox.js'; +import FileUploadDemo from '/examples/ui/client-capabilities/interaction/fileupload.js'; +import NumberFieldDemo from '/examples/ui/client-capabilities/interaction/number-field.js'; +import RadioGroupDemo from '/examples/ui/client-capabilities/interaction/radiogroup.js'; +import RadioDemo from '/examples/ui/client-capabilities/interaction/radio.js'; +import SelectDemo from '/examples/ui/client-capabilities/interaction/select.js'; +import SliderDemo from '/examples/ui/client-capabilities/interaction/slider.js'; +import StepperDemo from '/examples/ui/client-capabilities/interaction/stepper.js'; +import SwitchDemo from '/examples/ui/client-capabilities/interaction/switch.js'; +import TextAreaDemo from '/examples/ui/client-capabilities/interaction/text-area.js'; +import TextFieldDemo from '/examples/ui/client-capabilities/interaction/text-field.js'; +import ToolbarDemo from '/examples/ui/client-capabilities/interaction/toolbar.js'; + +import CriteriaSegmentedControlDemo from '/examples/ui/client-capabilities/interaction/criteria-segmented-control.js'; +import SegmentedControlDemo from '/examples/ui/client-capabilities/interaction/segmented-control.js'; + +const cardData = [ + { + "heading": "Button", + "link": "/develop/client-capabilities/forms/form-inputs/client-interaction-button/", + "text": "Clickable element to indicate action", + children: , + }, + { + "heading": "Checkbox", + "link": "/develop/client-capabilities/forms/form-inputs/client-interaction-checkbox/", + "text": "Control for selecting multiple options", + children: , + }, + { + "heading": "Criteria Segmented Control", + "link": "/develop/client-capabilities/forms/form-layout/client-interaction-criteria-segmented-control/", + "text": "Generate a criteria based on a selected item", + children: , + }, + { + "heading": "Combobox", + "link": "/develop/client-capabilities/forms/form-inputs/client-interaction-combobox/", + "text": "Combination of text input and dropdown list", + children: , + }, + { + "heading": "File Upload", + "link": "/develop/client-capabilities/forms/form-inputs/client-interaction-file-upload/", + "text": "Control for uploading files", + children: , + }, + { + "heading": "Number Field", + "link": "/develop/client-capabilities/forms/form-inputs/client-interaction-number-field/", + "text": "Input field for numerical values", + children: , + }, + { + "heading": "Radio Group", + "link": "/develop/client-capabilities/forms/form-inputs/client-interaction-radio-group/", + "text": "Group of mutually exclusive options", + children: , + }, + { + "heading": "Radio", + "link": "/develop/client-capabilities/forms/form-inputs/client-interaction-radio/", + "text": "Single selection control", + children: , + }, + { + "heading": "Segmented Control", + "link": "/develop/client-capabilities/forms/form-layout/client-interaction-segmented-control/", + "text": "Select a value from a set of buttons", + children: , + }, + { + "heading": "Select", + "link": "/develop/client-capabilities/forms/form-inputs/client-interaction-select/", + "text": "Dropdown menu for selecting options", + children: , + }, + { + "heading": "Slider", + "link": "/develop/client-capabilities/forms/form-inputs/client-interaction-slider/", + "text": "Control for selecting a value from a range", + children: , + }, + { + "heading": "Stepper", + "link": "/develop/client-capabilities/forms/form-inputs/client-interaction-stepper/", + "text": "Increment/decrement control for numbers", + children: , + }, + { + "heading": "Switch", + "link": "/develop/client-capabilities/forms/form-inputs/client-interaction-switch/", + "text": "Toggle between two states", + children: , + }, + { + "heading": "Text Area", + "link": "/develop/client-capabilities/forms/form-inputs/client-interaction-text-area/", + "text": "Multi-line text input field", + children: , + }, + { + "heading": "Text Field", + "link": "/develop/client-capabilities/forms/form-inputs/client-interaction-text-field/", + "text": "Single-line text input field", + children: , + }, + { + "heading": "Toolbar", + "link": "/develop/client-capabilities/forms/form-inputs/client-interaction-toolbar/", + "text": "Container for grouping related controls", + children: , + }, +]; + +export default function FormsIndex() { + useUpdateCSSVariable('--toc-sidebar-width', '0px') + return ( + + ); +} diff --git a/docs/001_develop/03_client-capabilities/007_forms/index.mdx b/docs/001_develop/03_client-capabilities/007_forms/index.mdx index b0770af619..9f78a94340 100644 --- a/docs/001_develop/03_client-capabilities/007_forms/index.mdx +++ b/docs/001_develop/03_client-capabilities/007_forms/index.mdx @@ -12,6 +12,6 @@ sidebar_position: 7 pagination_prev: develop/client-capabilities/charts/chart-html-api --- -Coming soon... +import FormsIndex from './forms-index.js' -Brief overview of what a form is used for + diff --git a/docs/001_develop/03_client-capabilities/008_interaction/index.mdx b/docs/001_develop/03_client-capabilities/008_interaction/index.mdx index 1e2c8f2104..54cd57a3ee 100644 --- a/docs/001_develop/03_client-capabilities/008_interaction/index.mdx +++ b/docs/001_develop/03_client-capabilities/008_interaction/index.mdx @@ -11,28 +11,6 @@ tags: sidebar_position: 8 --- -Coming soon... +import InteractionIndex from './interaction-index.jsx' -Accordion - -Anchor - -Anchored Region - -Dialog - -Dropdown Menu - -Flipper - -ListBox - -Menu - -Modal - -Tab - -Tooltip - -Tree View \ No newline at end of file + diff --git a/docs/001_develop/03_client-capabilities/008_interaction/interaction-index.jsx b/docs/001_develop/03_client-capabilities/008_interaction/interaction-index.jsx new file mode 100644 index 0000000000..5b0514f679 --- /dev/null +++ b/docs/001_develop/03_client-capabilities/008_interaction/interaction-index.jsx @@ -0,0 +1,97 @@ +import LiveExampleBuilder from '@site/src/components/LiveExampleBuilder'; +import {useUpdateCSSVariable} from '@site/src/components/Hooks'; + +import AccordionDemo from '/examples/ui/client-capabilities/interaction/accordion.js'; +import AnchorDemo from '/examples/ui/client-capabilities/interaction/anchor.js'; +import AnchoredRegionDemo from '/examples/ui/client-capabilities/interaction/anchored-region.js'; +import DialogDemo from '/examples/ui/client-capabilities/interaction/dialog.js'; +import DropdownMenuDemo from '/examples/ui/client-capabilities/interaction/dropdown-menu.js'; +import FlipperDemo from '/examples/ui/client-capabilities/interaction/flipper.js'; +import ListboxDemo from '/examples/ui/client-capabilities/interaction/listbox.js'; +import MenuDemo from '/examples/ui/client-capabilities/interaction/menu.js'; +import ModalDemo from '/examples/ui/client-capabilities/interaction/modal.js'; +import TabsDemo from '/examples/ui/client-capabilities/interaction/tabs.js'; +import TooltipDemo from '/examples/ui/client-capabilities/interaction/tooltip.js'; +import TreeViewDemo from '/examples/ui/client-capabilities/interaction/tree-view.js'; + +const cardData = [ + { + "heading": "Accordion", + "link": "/develop/client-capabilities/interaction/client-interaction-accordion/", + "text": "Expandable and collapsible sections", + children: , + }, + { + "heading": "Anchor", + "link": "/develop/client-capabilities/interaction/client-interaction-anchor/", + "text": "Create linkable document sections", + children: , + }, + { + "heading": "Anchored Region", + "link": "/develop/client-capabilities/interaction/client-interaction-anchored-region/", + "text": "Position content relative to other elements", + children: , + }, + { + "heading": "Dialog", + "link": "/develop/client-capabilities/interaction/client-interaction-dialog/", + "text": "Modal or non-modal message boxes", + children: , + }, + { + "heading": "Dropdown Menu", + "link": "/develop/client-capabilities/interaction/client-interaction-dropdown-menu/", + "text": "Expandable menu with selectable options", + children: , + }, + { + "heading": "Flipper", + "link": "/develop/client-capabilities/interaction/client-interaction-flipper/", + "text": "Navigate through a sequence of items", + children: , + }, + { + "heading": "Listbox", + "link": "/develop/client-capabilities/interaction/client-interaction-listbox/", + "text": "Select one or multiple options from a list", + children: , + }, + { + "heading": "Menu", + "link": "/develop/client-capabilities/interaction/client-interaction-menu/", + "text": "Navigation or command menu", + children: , + }, + { + "heading": "Modal", + "link": "/develop/client-capabilities/interaction/client-interaction-modal/", + "text": "Focused overlay content", + children: , + }, + { + "heading": "Tabs", + "link": "/develop/client-capabilities/interaction/client-interaction-tabs/", + "text": "Organize content into tabbed sections", + children: , + }, + { + "heading": "Tooltip", + "link": "/develop/client-capabilities/interaction/client-interaction-tooltip/", + "text": "Display additional information on hover", + children: , + }, + { + "heading": "Tree View", + "link": "/develop/client-capabilities/interaction/client-interaction-tree-view/", + "text": "Hierarchical list with expandable items", + children: , + } +]; + +export default function InteractionIndex() { + useUpdateCSSVariable('--toc-sidebar-width', '0px') + return ( + + ); +} diff --git a/docs/001_develop/03_client-capabilities/009_presentation/examples/banner.js b/docs/001_develop/03_client-capabilities/009_presentation/examples/banner.js index b5beaf0bcb..6ce2e3ff2e 100644 --- a/docs/001_develop/03_client-capabilities/009_presentation/examples/banner.js +++ b/docs/001_develop/03_client-capabilities/009_presentation/examples/banner.js @@ -23,7 +23,7 @@ export default function BannerDemo({ children, color }) { return (
-
+
A banner for displaying information... Click to dismiss! diff --git a/docs/001_develop/03_client-capabilities/009_presentation/examples/breadcrumb.js b/docs/001_develop/03_client-capabilities/009_presentation/examples/breadcrumb.js index 478da7da87..e1d00edac0 100644 --- a/docs/001_develop/03_client-capabilities/009_presentation/examples/breadcrumb.js +++ b/docs/001_develop/03_client-capabilities/009_presentation/examples/breadcrumb.js @@ -16,8 +16,8 @@ export default function BreadcrumbDemo({ children, color }) { return ( -
-
+
+
Breadcrumb item 1 Breadcrumb item 2 diff --git a/docs/001_develop/03_client-capabilities/009_presentation/examples/horizontal-scroll.js b/docs/001_develop/03_client-capabilities/009_presentation/examples/horizontal-scroll.js index bc43650233..43e6a9c9d6 100644 --- a/docs/001_develop/03_client-capabilities/009_presentation/examples/horizontal-scroll.js +++ b/docs/001_develop/03_client-capabilities/009_presentation/examples/horizontal-scroll.js @@ -11,7 +11,7 @@ function setup() { } } -export default function HorizontalScrollDemo({ children, color }) { +export default function HorizontalScrollDemo({ inIndex = false }) { setup(); return ( @@ -30,7 +30,8 @@ export default function HorizontalScrollDemo({ children, color }) { Card number 3 A button - + {!inIndex ? + (<> Card number 4 A button @@ -65,7 +66,7 @@ export default function HorizontalScrollDemo({ children, color }) { Card number 12 A button - + ) : null}
diff --git a/docs/001_develop/03_client-capabilities/009_presentation/index.mdx b/docs/001_develop/03_client-capabilities/009_presentation/index.mdx index 53b0ad1bb5..99c1bb3c8c 100644 --- a/docs/001_develop/03_client-capabilities/009_presentation/index.mdx +++ b/docs/001_develop/03_client-capabilities/009_presentation/index.mdx @@ -10,34 +10,7 @@ tags: sidebar_position: 9 --- -Coming soon... +import PresentationDemo from './presentation-index.js'; -Avatar + -Badge - -Banner - -Breadcrumb - -Basic Data Grid - -Card - -Chart - -Connection Indicator - -Disclosure - -Divider - -Horizontal Scroll - -Icon - -Progress Ring - -Progress - -Skeleton \ No newline at end of file diff --git a/docs/001_develop/03_client-capabilities/009_presentation/presentation-index.js b/docs/001_develop/03_client-capabilities/009_presentation/presentation-index.js new file mode 100644 index 0000000000..e798985520 --- /dev/null +++ b/docs/001_develop/03_client-capabilities/009_presentation/presentation-index.js @@ -0,0 +1,104 @@ +import LiveExampleBuilder from '@site/src/components/LiveExampleBuilder'; +import {useUpdateCSSVariable} from '@site/src/components/Hooks'; + +import AvatarDemo from './examples/avatar.js'; +import BadgeDemo from './examples/badge.js'; +import BannerDemo from './examples/banner.js'; +import BreadcrumbDemo from './examples/breadcrumb.js'; +import CardDemo from './examples/card.js'; +import ConnectionIndicatorDemo from './examples/connection-indicator.js'; +import DisclosureDemo from './examples/disclosure.js'; +import DividerDemo from './examples/divider.js'; +import HorizontalScrollDemo from './examples/horizontal-scroll.js'; +import IconDemo from './examples/icon.js'; +import ProgressRingDemo from './examples/progress-ring.js'; +import ProgressDemo from './examples/progress.js'; +import SkeletonDemo from './examples/skeleton.js'; + +const cardData = [ + { + "heading": "Avatar", + "link": "/develop/client-capabilities/presentation/client-presentation-avatar/", + "text": "Display image or text representing a person", + children: , + }, + { + "heading": "Badge", + "link": "/develop/client-capabilities/presentation/client-presentation-badge/", + "text": "Display a small count or status indicator", + children: , + }, + { + "heading": "Banner", + "link": "/develop/client-capabilities/presentation/client-presentation-banner/", + "text": "Display important messages or announcements", + children: , + }, + { + "heading": "Breadcrumb", + "link": "/develop/client-capabilities/presentation/client-presentation-breadcrumb/", + "text": "Show navigation hierarchy", + children: , + }, + { + "heading": "Card", + "link": "/develop/client-capabilities/presentation/client-presentation-card/", + "text": "Container for related content and actions", + children: , + }, + { + "heading": "Connection Indicator", + "link": "/develop/client-capabilities/presentation/client-presentation-connection-indicator/", + "text": "Display network connection status", + children: , + }, + { + "heading": "Disclosure", + "link": "/develop/client-capabilities/presentation/client-presentation-disclosure/", + "text": "Toggle visibility of content", + children: , + }, + { + "heading": "Divider", + "link": "/develop/client-capabilities/presentation/client-presentation-divider/", + "text": "Separate content visually", + children: , + }, + { + "heading": "Horizontal Scroll", + "link": "/develop/client-capabilities/presentation/client-presentation-horizontal-scroll/", + "text": "Horizontally scrollable container", + children: , + }, + { + "heading": "Icon", + "link": "/develop/client-capabilities/presentation/client-presentation-icon/", + "text": "Display symbolic visual elements", + children: , + }, + { + "heading": "Progress Ring", + "link": "/develop/client-capabilities/presentation/client-presentation-progress-ring/", + "text": "Show circular progress indicator", + children: , + }, + { + "heading": "Progress", + "link": "/develop/client-capabilities/presentation/client-presentation-progress/", + "text": "Display linear progress indicator", + children: , + }, + { + "heading": "Skeleton", + "link": "/develop/client-capabilities/presentation/client-presentation-skeleton/", + "text": "Show loading state placeholder", + children: , + }, +]; + +export default function PresentationIndex() { + useUpdateCSSVariable('--toc-sidebar-width', '0px') + return ( + + ); +} diff --git a/examples/ui/client-capabilities/interaction/anchor.js b/examples/ui/client-capabilities/interaction/anchor.js index 48100cf367..a56aee585b 100644 --- a/examples/ui/client-capabilities/interaction/anchor.js +++ b/examples/ui/client-capabilities/interaction/anchor.js @@ -1,7 +1,7 @@ import { CodeSection } from '../../documentationBase'; import useIsBrowser from '@docusaurus/useIsBrowser'; -export default function AnchorDemo({ children, color }) { +export default function AnchorDemo({ inIndex = false }) { const isBrowser = useIsBrowser(); @@ -18,7 +18,7 @@ export default function AnchorDemo({ children, color }) { return ( External link - Internal link + {!inIndex ? (Internal link) : null} Mail link ) } diff --git a/examples/ui/client-capabilities/interaction/anchored-region.js b/examples/ui/client-capabilities/interaction/anchored-region.js index 891615d800..604b6ff834 100644 --- a/examples/ui/client-capabilities/interaction/anchored-region.js +++ b/examples/ui/client-capabilities/interaction/anchored-region.js @@ -1,9 +1,11 @@ import { CodeSection } from '../../documentationBase'; import useIsBrowser from '@docusaurus/useIsBrowser'; +import {useWindowSize} from '@site/src/components/Hooks'; -export default function AnchoredRegionDemo({ children, color }) { - +export default function AnchoredRegionDemo({}) { const isBrowser = useIsBrowser(); + const windowSize = useWindowSize(); + const isSmall = windowSize.width < 1400; if (isBrowser) { const RapidImports = require('../../rapidImports'); @@ -13,14 +15,15 @@ export default function AnchoredRegionDemo({ children, color }) { return (
- - This content in the anchored region shows up above the button, even though it's after it in the DOM + {!isSmall ?

Content after button in DOM

:

Anchored content

}
) diff --git a/examples/ui/client-capabilities/interaction/combobox.js b/examples/ui/client-capabilities/interaction/combobox.js index b5a8a4e161..de72950a0e 100644 --- a/examples/ui/client-capabilities/interaction/combobox.js +++ b/examples/ui/client-capabilities/interaction/combobox.js @@ -1,7 +1,7 @@ -import { CodeLabel, CodeSection } from '../../documentationBase'; +import { CodeSection } from '../../documentationBase'; import useIsBrowser from '@docusaurus/useIsBrowser'; -export default function ComboboxDemo({ children, color }) { +export default function ComboboxDemo({ inIndex = false }) { const isBrowser = useIsBrowser(); if (isBrowser) { @@ -9,9 +9,11 @@ export default function ComboboxDemo({ children, color }) { RapidImports.registerComponents(); } + const styles = inIndex ? {minWidth: '0px', marginBottom: '120px', width: '100%'} : {} + return ( - + Small Medium Large diff --git a/examples/ui/client-capabilities/interaction/modal.js b/examples/ui/client-capabilities/interaction/modal.js index 6ea5337b2b..20214de06c 100644 --- a/examples/ui/client-capabilities/interaction/modal.js +++ b/examples/ui/client-capabilities/interaction/modal.js @@ -2,7 +2,7 @@ import { CodeLabel, CodeSection } from '../../documentationBase'; import React, { useEffect, useRef, useState } from 'react'; import useIsBrowser from '@docusaurus/useIsBrowser'; -export default function ModalDemo({ children, color }) { +export default function ModalDemo({ inIndex = false }) { const isBrowser = useIsBrowser(); @@ -61,6 +61,25 @@ export default function ModalDemo({ children, color }) { }, []); + if (inIndex) { + return ( + +
+
+ handleClick(modalRef)}> + Open modal + + + Modal example + +
+
+
) + } + return (Modal:
diff --git a/examples/ui/client-capabilities/interaction/select.js b/examples/ui/client-capabilities/interaction/select.js index ecc92da3a4..f5aa588c99 100644 --- a/examples/ui/client-capabilities/interaction/select.js +++ b/examples/ui/client-capabilities/interaction/select.js @@ -1,7 +1,7 @@ import { CodeLabel, CodeSection } from '../../documentationBase'; import useIsBrowser from '@docusaurus/useIsBrowser'; -export default function SelectDemo({ children, color }) { +export default function SelectDemo({inIndex = false}) { const isBrowser = useIsBrowser(); if (isBrowser) { @@ -9,5 +9,7 @@ export default function SelectDemo({ children, color }) { RapidImports.registerComponents(); } - return (SmallLarge) + const styles = inIndex ? {minWidth: '0px', width: '100%', marginBottom: '100px'} : {} + + return (SmallLarge) } diff --git a/examples/ui/client-capabilities/interaction/tabs.js b/examples/ui/client-capabilities/interaction/tabs.js index 28d6f48c4a..642d828d04 100644 --- a/examples/ui/client-capabilities/interaction/tabs.js +++ b/examples/ui/client-capabilities/interaction/tabs.js @@ -1,12 +1,11 @@ import { CodeSection } from '../../documentationBase'; import useIsBrowser from '@docusaurus/useIsBrowser'; -import { MenuItem } from '@genesislcap/rapid-design-system'; function ListItem({children}) { return (
  • {children}
  • ) } -export default function MenuDemo({ children, color }) { +export default function MenuDemo({ inIndex = false }) { const isBrowser = useIsBrowser(); @@ -20,7 +19,7 @@ export default function MenuDemo({ children, color }) { Appetizers Entrees - Desserts + {!inIndex ? (Desserts) : null}
      Stuffed artichokes @@ -33,12 +32,13 @@ export default function MenuDemo({ children, color }) { Grilled Fish with Artichoke Caponata
    - + {!inIndex ? + (
      Tiramisu limoncello and Ice Cream with Biscotti
    -
    +
    ) : null}
    ) diff --git a/examples/ui/client-capabilities/interaction/toolbar.js b/examples/ui/client-capabilities/interaction/toolbar.js index a5de07e1ed..9f840b94ce 100644 --- a/examples/ui/client-capabilities/interaction/toolbar.js +++ b/examples/ui/client-capabilities/interaction/toolbar.js @@ -1,7 +1,7 @@ import { CodeSection } from '../../documentationBase'; import useIsBrowser from '@docusaurus/useIsBrowser'; -export default function ToolbarDemo({ children, color }) { +export default function ToolbarDemo({ inIndex = false }) { const isBrowser = useIsBrowser(); @@ -10,19 +10,21 @@ export default function ToolbarDemo({ children, color }) { RapidImports.registerComponents(); } + const styles = inIndex ? {minWidth: '0px', marginBottom: '50px', width: '100%'} : {} + return ( Button - + Option 1 Second option - Option 3 + {!inIndex ? Option 3 : null} One Two - Three + {!inIndex ? Three : null} diff --git a/src/components/Card/Card.js b/src/components/Card/Card.js index 3fac1e1714..41b8620630 100644 --- a/src/components/Card/Card.js +++ b/src/components/Card/Card.js @@ -1,26 +1,44 @@ import React from "react"; import './Card.css' -export default function Card({ heading, text, link, imageUrl = '/svg/categories-icons/document-svgrepo-com.svg' }) { +export default function Card({ heading, text, link, imageUrl = '/svg/categories-icons/document-svgrepo-com.svg', children }) { + const wrapperStyle = !children ? {} : { + display: 'contents', + }; + + // Stops the link working when interacting with the live examples + const handleChildClick = (e) => { + e.preventDefault(); + e.stopPropagation(); + }; + return ( - -
    -
    - { imageUrl && ( - {heading} - )} -
    -
    -

    { heading }

    -

    - { text } -

    -
    +
    + + ) -} \ No newline at end of file +} diff --git a/src/components/Card/CardList.js b/src/components/Card/CardList.js index a8b3d0ce2e..984d05dcd2 100644 --- a/src/components/Card/CardList.js +++ b/src/components/Card/CardList.js @@ -4,18 +4,18 @@ import './CardList.css'; import Card from './Card'; const generateClassNameFromHref = (href) => { - return href?.replace(/^\/+|\/+$/g, '').toLowerCase().replace(/\//g, '-').replace(/[^a-z0-9-]/g, ''); + return href?.replace(/^\/+|\/+$/g, '').toLowerCase().replace(/\//g, '-').replace(/[^a-z0-9-]/g, ''); }; export default function CardList({ inRow = 1, xs = 12, sm = 6, md = 4, items }) { return ( {items.map((item, index) => item.link && ( - ))} ); -} \ No newline at end of file +} diff --git a/src/components/Card/LoadingRing.js b/src/components/Card/LoadingRing.js new file mode 100644 index 0000000000..5c079cca9b --- /dev/null +++ b/src/components/Card/LoadingRing.js @@ -0,0 +1,64 @@ +// Used to show loading ring when bootstraping +// our live examples because the design system provider +// takes a second to load. This also means we can't use +// our own progress ring +const LoadingRing = () => { + const ringStyles = { + display: 'flex', + position: 'relative', + width: '80px', + height: '80px', + margin: '0 auto', + }; + + const ringChildStyles = { + boxSizing: 'border-box', + display: 'block', + position: 'absolute', + width: '64px', + height: '64px', + margin: '8px', + border: '8px solid #fff', + borderRadius: '50%', + animation: 'ring-animation 1.2s cubic-bezier(0.5, 0, 0.5, 1) infinite', + borderColor: '#3498db transparent transparent transparent', + }; + + const child2Styles = { + ...ringChildStyles, + animationDelay: '-0.45s', + }; + + const child3Styles = { + ...ringChildStyles, + animationDelay: '-0.3s', + }; + + const child4Styles = { + ...ringChildStyles, + animationDelay: '-0.15s', + }; + + return ( +
    + +
    +
    +
    +
    +
    + ); +}; + +export default LoadingRing; diff --git a/src/components/Hooks.jsx b/src/components/Hooks.jsx new file mode 100644 index 0000000000..5f29b43ba2 --- /dev/null +++ b/src/components/Hooks.jsx @@ -0,0 +1,34 @@ +import {useState, useEffect} from 'react'; + +export function useUpdateCSSVariable(variable, value) { + useEffect(() => { + document.documentElement.style.setProperty(variable, value); + + return () => { + document.documentElement.style.removeProperty(variable); + }; + }, [variable, value]); +} + +export function useWindowSize() { + const [windowSize, setWindowSize] = useState({ + width: typeof window !== 'undefined' ? window.innerWidth : undefined, + height: typeof window !== 'undefined' ? window.innerHeight : undefined, + }); + + useEffect(() => { + function handleResize() { + setWindowSize({ + width: window.innerWidth, + height: window.innerHeight, + }); + } + + window.addEventListener('resize', handleResize); + // Initial size is now set in useState, so we don't need to call handleResize here + + return () => window.removeEventListener('resize', handleResize); + }, []); + + return windowSize; +} diff --git a/src/components/LiveExampleBuilder.js b/src/components/LiveExampleBuilder.js new file mode 100644 index 0000000000..2cf251ad4e --- /dev/null +++ b/src/components/LiveExampleBuilder.js @@ -0,0 +1,45 @@ +import useIsBrowser from '@docusaurus/useIsBrowser'; +import CardList from '@site/src/components/Card/CardList'; +import LoadingRing from '@site/src/components/Card/LoadingRing'; +import {useState, useEffect} from 'react'; + +export default function LiveExampleBuilder({ itemData }) { + const isBrowser = useIsBrowser(); + const [isLoading, setIsLoading] = useState(true); + + const processedItems = itemData.map((item) => ({ + ...item, + ...(item.children ? {children: {...item.children, props: {inIndex: true}}} : {}), + })) + + useEffect(() => { + const timer = setTimeout(() => { + setIsLoading(false); + }, 1000); + + return () => clearTimeout(timer); + }, []); + + if (isBrowser) { + const RapidImports = require('../../examples/ui/rapidImports'); + RapidImports.registerComponents(); + } + + return ( + <> + {isLoading ? ( + + ) : ( +
    + +
    + )} + + ); +} + diff --git a/src/css/custom.css b/src/css/custom.css index 22e2a743ab..eb6b97db27 100644 --- a/src/css/custom.css +++ b/src/css/custom.css @@ -68,7 +68,7 @@ --doc-sidebar-width: 325px !important; - --toc-sidebar-width: 325px; + --toc-sidebar-width: 140px; } body { @@ -216,7 +216,7 @@ h5 { } .main-wrapper main article { - max-width: 100rem; + max-width: 120rem; } @media (min-aspect-ratio: 1/1) and (min-width: 1512px) { @@ -224,6 +224,15 @@ h5 { margin-left: auto; margin-right: auto; } + :root { + --toc-sidebar-width: 220px; + } +} + +@media (min-aspect-ratio: 1/1) and (min-width: 2250px) { + :root { + --toc-sidebar-width: 335px; + } } @media (min-aspect-ratio: 1/1) and (max-width: 996px) { diff --git a/src/theme/DocCardList.tsx b/src/theme/DocCardList.tsx index 6ef007c31d..1c59bb5cec 100644 --- a/src/theme/DocCardList.tsx +++ b/src/theme/DocCardList.tsx @@ -21,7 +21,7 @@ export default function DocCardList(props: Props): JSX.Element { const category = useCurrentSidebarCategory(); const extraCategoryData = sidebarItemsData[category.href]; let enrichedItems = filterDocCardListItems(items); - + if (extraCategoryData?.items) { enrichedItems = enrichedItems.map((item) => { const extraData = extraCategoryData.items.find(extraItemData => extraItemData.href === item.href) || {}; @@ -30,7 +30,7 @@ export default function DocCardList(props: Props): JSX.Element { ...extraData, }; }); - } + } const filteredItems = enrichedItems.map(( { label: heading, href: link, description: text, imageUrl }, @@ -46,4 +46,4 @@ export default function DocCardList(props: Props): JSX.Element { /> ); -} \ No newline at end of file +}