From a056e2b129dfa491cb869e057d04515a67b570bf Mon Sep 17 00:00:00 2001 From: David Stover <56250584+davidmoltin@users.noreply.github.com> Date: Thu, 14 Nov 2024 15:35:58 -0500 Subject: [PATCH] Remove unused --- changelog/2018/changelog-2018-12-04.md | 2 +- changelog/2021/changelog-2021-01-05.md | 2 +- changelog/2022/changelog-2022-05-03.md | 2 +- changelog/2022/changelog-2022-05-26.md | 4 +- changelog/2023/2023-08-22-changelog.md | 2 +- changelog/2024/2024-04-10-changelog.md | 2 +- docusaurus.config.js | 1 - .../commerceextensions/OpenAPISpec.yaml | 2 +- package.json | 7 +- src/components/PropsTable/index.jsx | 138 +++++++++ src/components/PropsTable/styles.module.css | 51 ++++ src/components/SectionsMenu/index.jsx | 58 ++++ src/components/SidebarMenu/index.jsx | 110 +++++++ src/components/SidebarMenu/styles.module.css | 70 +++++ src/faq.js | 6 + src/faq.yaml | 20 ++ src/pages/faq.jsx | 231 +++++++++++++++ src/sections.ts | 164 +++++++++++ src/theme/Admonition/index.js | 177 ++++++++++++ src/theme/Admonition/styles.module.css | 31 ++ src/theme/DocSidebar/Desktop/index.d.ts | 10 + src/theme/DocSidebar/Desktop/index.jsx | 33 +++ .../DocSidebar/Desktop/styles.module.css | 43 +++ src/theme/DocSidebar/Mobile/index.d.ts | 5 + src/theme/DocSidebar/Mobile/index.jsx | 42 +++ src/theme/MDXComponents.js | 2 + src/theme/Playground/index.d.ts | 7 + src/theme/Playground/index.jsx | 143 +++++++++ src/theme/Playground/styles.module.css | 33 +++ src/theme/ReactLiveScope/index.d.ts | 271 ++++++++++++++++++ src/theme/ReactLiveScope/index.js | 13 + 31 files changed, 1670 insertions(+), 12 deletions(-) create mode 100644 src/components/PropsTable/index.jsx create mode 100644 src/components/PropsTable/styles.module.css create mode 100644 src/components/SectionsMenu/index.jsx create mode 100644 src/components/SidebarMenu/index.jsx create mode 100644 src/components/SidebarMenu/styles.module.css create mode 100644 src/faq.js create mode 100644 src/faq.yaml create mode 100644 src/pages/faq.jsx create mode 100644 src/sections.ts create mode 100644 src/theme/Admonition/index.js create mode 100644 src/theme/Admonition/styles.module.css create mode 100644 src/theme/DocSidebar/Desktop/index.d.ts create mode 100644 src/theme/DocSidebar/Desktop/index.jsx create mode 100644 src/theme/DocSidebar/Desktop/styles.module.css create mode 100644 src/theme/DocSidebar/Mobile/index.d.ts create mode 100644 src/theme/DocSidebar/Mobile/index.jsx create mode 100644 src/theme/Playground/index.d.ts create mode 100644 src/theme/Playground/index.jsx create mode 100644 src/theme/Playground/styles.module.css create mode 100644 src/theme/ReactLiveScope/index.d.ts create mode 100644 src/theme/ReactLiveScope/index.js diff --git a/changelog/2018/changelog-2018-12-04.md b/changelog/2018/changelog-2018-12-04.md index 1cf29a0b..1d3003dd 100644 --- a/changelog/2018/changelog-2018-12-04.md +++ b/changelog/2018/changelog-2018-12-04.md @@ -2,4 +2,4 @@ title: 'Changelog 2018-12-04' date: '2018-12-04' --- -- Updated search to return a 400 error explaining the search contains [unsupported characters](/guides/Getting-Started/filtering#supported-characters). +- Updated search to return a 400 error explaining the search contains [unsupported characters](/docs/commerce-cloud/api-overview/filtering#supported-characters). diff --git a/changelog/2021/changelog-2021-01-05.md b/changelog/2021/changelog-2021-01-05.md index b1180dac..33857d3c 100644 --- a/changelog/2021/changelog-2021-01-05.md +++ b/changelog/2021/changelog-2021-01-05.md @@ -4,4 +4,4 @@ date: '2021-01-05' tags: - Commerce Manager --- -**Minor** Moved the Swift SDK examples from the API Reference documentation to the community-supported `ios-sdk` repository [Readme file](https://github.com/moltin/ios-sdk/blob/master/README). +**Minor** Moved the Swift SDK examples from the API Reference documentation to the community-supported `ios-sdk` repository [Readme file](https://github.com/moltin/ios-sdk/blob/master/README.md). diff --git a/changelog/2022/changelog-2022-05-03.md b/changelog/2022/changelog-2022-05-03.md index 87adb03e..6bee6064 100644 --- a/changelog/2022/changelog-2022-05-03.md +++ b/changelog/2022/changelog-2022-05-03.md @@ -7,7 +7,7 @@ tags: - Commerce Manager - Product Experience Manager --- -**Major** Added PayPal Express Checkout payment method. For more information, see [PayPal Express Checkout](/docs/api/payments/update-paypal-express-checkout-gateway) and [PayPal Express Checkout Payments](/docs/api/payments/update-paypal-express-checkout-gateway). You can also use PayPal Express Checkout in Commerce Manager. +**Major** Added PayPal Express Checkout payment method. For more information, see [PayPal Express Checkout](/docs/commerce-cloud/payments/payment-gateway/configure-paypal-express-checkout) and [PayPal Express Checkout Payments](/docs/api/payments/update-paypal-express-checkout-gateway). You can also use PayPal Express Checkout in Commerce Manager. **Major** Commerce Manager: You can now localize your product names and descriptions. See [Configuring Locales](/docs/api/pxm/products/create-product). diff --git a/changelog/2022/changelog-2022-05-26.md b/changelog/2022/changelog-2022-05-26.md index b74e97fa..708bba95 100644 --- a/changelog/2022/changelog-2022-05-26.md +++ b/changelog/2022/changelog-2022-05-26.md @@ -21,6 +21,6 @@ tags: **Minor** Commerce Manager: When viewing an order, you can now click a product name to view the product details. See [Orders](/docs/commerce-manager/orders/orders-cm). -**Minor** Commerce Manager: New **Total Orders** and **Total Value of All Orders** fields and improved layout available in **Analytics**. See [Analytics](/docs/commerce-manager/analytics/). +**Minor** Commerce Manager: New **Total Orders** and **Total Value of All Orders** fields and improved layout available in **Analytics**. See [Analytics](/docs/commerce-cloud/analytics/analytics). -**Minor** Commerce Manager: The **Rename store** field is now moved to **Settings > Store Settings** page. For more information, see [Renaming a Store](/docs/commerce-manager/settings/general-settings). +**Minor** Commerce Manager: The **Rename store** field is now moved to **Settings > Store Settings** page. For more information, see [Renaming a Store](/docs/commerce-cloud/global-project-settings/general-settings). diff --git a/changelog/2023/2023-08-22-changelog.md b/changelog/2023/2023-08-22-changelog.md index a14d6146..e2b5fa37 100644 --- a/changelog/2023/2023-08-22-changelog.md +++ b/changelog/2023/2023-08-22-changelog.md @@ -11,4 +11,4 @@ hide_blog_post_date: false * Removed store type label previously displayed next to store names, and replaced with **STORE** label instead to help distinguish from when a user is managing an Organization. * Added rate limit details for stores under **SYSTEM > Store Settings > General Settings**, which have been reorganized to group together related settings. -For more information, see **[General Settings in Commerce Manager](/docs/commerce-manager/settings/general-settings)**. +For more information, see **[General Settings in Commerce Manager](https://elasticpath.dev/docs/commerce-cloud/global-project-settings/general-settings)**. diff --git a/changelog/2024/2024-04-10-changelog.md b/changelog/2024/2024-04-10-changelog.md index f141113f..b2d95f53 100644 --- a/changelog/2024/2024-04-10-changelog.md +++ b/changelog/2024/2024-04-10-changelog.md @@ -6,4 +6,4 @@ hide_blog_post_date: false --- **MAJOR** We have introduced a new feature, called **Promotions Builder,** powered by our Rule Promotion engine. This feature offers you the flexibility in providing diverse discounts to shoppers, supporting discounts of varying complexities, ranging from code-based customer discounts to Buy X Get Y discounts, fixed price promotions, cart fixed discount, and many more based on your business needs. Moreover, it is compatible with our existing legacy promotions capability, ensuring a smooth transition to the new Promotions Builder. For more information, see **[Promotions Builder in Commerce Manager](https://elasticpath.dev/docs/commerce-cloud/rule-promotions/promotions-in-commerce-manager/overview)**. To create promotions using API, see **[Rule Promotions](https://elasticpath.dev/docs/commerce-cloud/rule-promotions/overview)**. To apply Rule Promotions API in carts and orders, you must enable the **use\_rule\_promotion** field in **[Cart Settings](https://elasticpath.dev/docs/commerce-cloud/carts/cart-management/cart-settings/update-cart-settings)**. -**MINOR** The **[Get all Products](https://elasticpath.dev/docs/pxm/products/ep-pxm-products-api/get-all-products)** and **[Get all Promotions](https://elasticpath.dev/docs/commerce-cloud/promotions/promotion-management/get-all-promotions)** endpoints now support beta filtering. The new syntax is an evolution of the original syntax, and allows more characters and formats. For more information, see **[Beta Filtering](https://elasticpath.dev/guides/Getting-Started/filtering#beta-filtering)**. +**MINOR** The **[Get all Products](https://elasticpath.dev/docs/pxm/products/ep-pxm-products-api/get-all-products)** and **[Get all Promotions](https://elasticpath.dev/docs/commerce-cloud/promotions/promotion-management/get-all-promotions)** endpoints now support beta filtering. The new syntax is an evolution of the original syntax, and allows more characters and formats. For more information, see **[Beta Filtering](https://elasticpath.dev/docs/commerce-cloud/api-overview/filtering#beta-filtering)**. diff --git a/docusaurus.config.js b/docusaurus.config.js index b25526cf..2ce30f40 100644 --- a/docusaurus.config.js +++ b/docusaurus.config.js @@ -1632,7 +1632,6 @@ const config = { "@docusaurus/theme-mermaid", [ require.resolve("@easyops-cn/docusaurus-search-local"), - /** @type {import("@easyops-cn/docusaurus-search-local").PluginOptions} */ ({ // ... Your options. // `hashed` is recommended as long-term-cache of index file is possible. diff --git a/openapispecs/commerceextensions/OpenAPISpec.yaml b/openapispecs/commerceextensions/OpenAPISpec.yaml index 3ef47f67..9e7f8a3b 100644 --- a/openapispecs/commerceextensions/OpenAPISpec.yaml +++ b/openapispecs/commerceextensions/OpenAPISpec.yaml @@ -1656,7 +1656,7 @@ components: name: filter in: query required: false - description: Filter attributes. For more information, see the [Filtering](/guides/Getting-Started/filtering) section. + description: Filter attributes. For more information, see the [Filtering](/docs/commerce-cloud/api-overview/filtering) section. schema: type: string format: string diff --git a/package.json b/package.json index bd592e09..09349221 100644 --- a/package.json +++ b/package.json @@ -24,11 +24,12 @@ "@docusaurus/plugin-client-redirects": "^2.4.3", "@docusaurus/plugin-content-docs": "^2.4.3", "@docusaurus/plugin-google-gtag": "^2.4.3", - "@docusaurus/plugin-google-tag-manager": "^3.5.2", - "@docusaurus/plugin-ideal-image": "^3.3.2", - "@docusaurus/plugin-pwa": "^3.5.2", + "@docusaurus/plugin-google-tag-manager": "^2.4.3", + "@docusaurus/plugin-ideal-image": "^2.4.3", + "@docusaurus/plugin-pwa": "^2.4.3", "@docusaurus/preset-classic": "2.4.3", "@docusaurus/remark-plugin-npm2yarn": "^2.4.3", + "@docusaurus/theme-live-codeblock": "^2.4.3", "@docusaurus/theme-mermaid": "^2.4.3", "@easyops-cn/docusaurus-search-local": "^0.36.0", "@fluentui/react-icons": "^2.0.230", diff --git a/src/components/PropsTable/index.jsx b/src/components/PropsTable/index.jsx new file mode 100644 index 00000000..7137a456 --- /dev/null +++ b/src/components/PropsTable/index.jsx @@ -0,0 +1,138 @@ +import React from 'react'; +import CodeBlock from '@theme/CodeBlock'; +import styles from './styles.module.css'; +import Link from '@docusaurus/Link'; + +const REFERENCE_PROPS = { + config: { + path: '../reference/interfaces/UIConfig', + name: 'UIConfig', + }, + iconPack: { + path: '../reference/#iconpack', + name: 'IconPack', + }, + // participant: { + // path: '../reference/participant', + // name: 'Participant', + // }, + states: { + path: '../reference/interfaces/States', + name: 'States', + }, + notification: { + path: '../reference/interfaces/Notification', + name: 'Notification', + }, + // poll: { + // path: '../reference/poll', + // name: 'Poll', + // }, + plugins: { + path: '/web-core/reference/DytePlugin', + name: 'DytePlugin[]', + }, + plugin: { + path: '/web-core/reference/DytePlugin', + name: 'DytePlugin', + }, +}; + +const WEB_CORE_TYPE_REFERENCES = { + DyteClient: { + path: '/web-core/reference/DyteClient', + name: 'DyteClient', + }, +}; + +function PropType({ prop }) { + if (prop.name === 'participant') { + return ( +
+        
+          
+            DyteParticipant
+          {' '}
+          | DyteSelf
+        
+      
+ ); + } + + if (prop.type === 'Peer[]') { + return ( +
+        
+          (
+          
+            DyteParticipant
+          {' '}
+          | DyteSelf)[]
+        
+      
+ ); + } + + const ref = REFERENCE_PROPS[prop.name] || WEB_CORE_TYPE_REFERENCES[prop.type]; + + if (ref) { + return ( +
+        
+          {ref.name}
+        
+      
+ ); + } + + return {prop.type}; +} + +function PropCard({ prop }) { + return ( +
+

+ {prop.name} +

+
+ {prop.required && ( +

+ required +

+ )} +

{prop.docs}

+ {prop.default && prop.default.length > 0 && ( +
+
Default
+ {prop.default} +
+ )} +
+
Type
+ +
+
+
+ ); +} + +export default function PropsTable({ of }) { + const doc = UIKitDocs.components.find((component) => component.tag === of); + + if (!doc) return null; + + const { props } = doc; + + // brings required props to start + props.sort((a) => (a.required ? -1 : 1)); + + return ( +
+
+ {props.map((prop) => ( + + ))} +
+
+ ); +} diff --git a/src/components/PropsTable/styles.module.css b/src/components/PropsTable/styles.module.css new file mode 100644 index 00000000..afa3e56c --- /dev/null +++ b/src/components/PropsTable/styles.module.css @@ -0,0 +1,51 @@ +.card h5 { + font-weight: 500; +} + +.card h3 { + margin: 0; +} + +.card h4 { + font-weight: 600; + padding: 12px 0; + margin: 12px 0; + border-bottom: 1px solid var(--docs-color-border); +} + +.props { + display: flex; + flex-direction: column; + gap: 6px; + + display: grid; + grid-template-columns: repeat(2, minmax(0, 1fr)); + gap: 20px; +} + +.docs { + color: var(--docs-color-text-100); + font-size: 90%; +} + +.propType { + background-color: var(--docs-color-code-background); + padding: var(--ifm-pre-padding); + border: 1px solid var(--code-border-color); + border-radius: var(--ifm-code-border-radius); +} + +.default { + font-size: 90%; +} + +.default > span { + margin-right: 4px; +} + +@media screen and (max-width: 996px) { + .props { + grid-template-columns: repeat(1, minmax(0, 1fr)); + gap: 0px; + } +} diff --git a/src/components/SectionsMenu/index.jsx b/src/components/SectionsMenu/index.jsx new file mode 100644 index 00000000..ad423d22 --- /dev/null +++ b/src/components/SectionsMenu/index.jsx @@ -0,0 +1,58 @@ +import React, { forwardRef } from 'react'; +import * as Select from '@radix-ui/react-select'; +import clsx from 'clsx'; +import { Check, ChevronDown, ChevronUp } from 'react-feather'; + +const SectionsMenu = forwardRef( + ({ defaultValue = '', values = [], children, className, ...props }, ref) => { + return ( + + + + + + + + + + + + + + + + {values.map(({ docId, name, icon: Icon, disabled = false }) => ( + + +
+ {Icon && } + {name} +
+
+ + + +
+ ))} + {children} +
+
+ + + + +
+
+ ); + } +); + +export default SectionsMenu; diff --git a/src/components/SidebarMenu/index.jsx b/src/components/SidebarMenu/index.jsx new file mode 100644 index 00000000..f0b363d9 --- /dev/null +++ b/src/components/SidebarMenu/index.jsx @@ -0,0 +1,110 @@ +import React from 'react'; +import { useHistory } from '@docusaurus/router'; +import clsx from 'clsx'; +import VersionDropdown from '@theme/NavbarItem/DocsVersionDropdownNavbarItem'; +import useGlobalData from '@docusaurus/useGlobalData'; + +import SectionsMenu from '../SectionsMenu'; +import { useSectionMenu } from '../../lib/useSectionMenu'; +import styles from './styles.module.css'; + +function getPrettyPath(path) { + return path.slice(-1) === '/' ? path.slice(0, -1) : path; +} + +export default function SidebarMenu() { + const router = useHistory(); + const data = useSectionMenu(); + const { docId, currentSection, sections, groups } = data; + + const globalData = useGlobalData(); + const allDocs = globalData['docusaurus-plugin-content-docs']; + + if (!sections && !groups) return null; + + const handleSectionChange = (selectedSection) => { + if (selectedSection !== docId) { + const { pathname, hash } = router.location; + const page = + `/${selectedSection}/` + pathname.split('/').slice(2).join('/'); + + const selectedSectionDocs = allDocs[selectedSection].versions[0].docs; + + if (selectedSectionDocs.find((doc) => doc.path === page)) { + const path = page + (hash && hash.length > 0 ? '#' + hash : ''); + router.push(getPrettyPath(path)); + } else { + const path = selectedSectionDocs[0].path; + router.push(getPrettyPath(path)); + } + } + }; + + if (sections) { + return ( +
+ + +
+ ); + } + + return ( +
+ {groups.map((group) => { + const { name, docs, description, className } = group; + + const isCurrentSection = currentSection === group.section; + + const navigateToFirstSection = () => handleSectionChange(docs[0].docId); + + return ( +
{ + if (e.code === 'Space' || e.code == 'Enter') { + navigateToFirstSection(); + } + }} + tabIndex={0} + key={group.name} + > +
{name}
+
+ {isCurrentSection ? ( +
+ + +
+ ) : ( +

{description}

+ )} +
+
+ ); + })} +
+ ); +} diff --git a/src/components/SidebarMenu/styles.module.css b/src/components/SidebarMenu/styles.module.css new file mode 100644 index 00000000..ca4a3ddb --- /dev/null +++ b/src/components/SidebarMenu/styles.module.css @@ -0,0 +1,70 @@ +:root { + --docs-sections-menu-background-color: #efefef; + --docs-sections-menu-active-background-color: #2bca7d; + --docs-sections-menu-active-color: #000000; +} + +html[data-theme='dark'] { + --docs-sections-menu-background-color: #3f3f3f; +} + +.container { + width: 100%; + display: flex; + align-items: center; + padding: 1rem 0.5rem; +} + +.sectionsMenu { + flex: 1; + line-height: 1.2; +} + +.multiSectionContainer { + display: flex; + flex-direction: column; + padding: 0.5rem; +} + +.section { + padding: 0.75rem; + cursor: pointer; + background-color: var(--docs-sections-menu-background-color); + --ifm-navbar-link-color: var(--docs-sections-menu-active-color); + --ifm-navbar-link-hover-color: var(--docs-sections-menu-active-color); +} + +.sectionActive { + background-color: var(--docs-sections-menu-active-background-color); + color: var(--docs-sections-menu-active-color); +} + +.section:first-child { + border-radius: 8px 8px 0 0; +} + +.section:last-child { + border-radius: 0 0 8px 8px; +} + +.section:only-child { + border-radius: 8px; +} + +.label { + margin-bottom: 0.5rem; + font-size: 14px; + font-weight: 600; + font-family: theme('fontFamily.jakarta'); +} + +.description { + margin: 0; + font-size: 14px; + color: var(--docs-color-text-100); +} + +.row { + display: flex; + align-items: center; +} diff --git a/src/faq.js b/src/faq.js new file mode 100644 index 00000000..0bad2299 --- /dev/null +++ b/src/faq.js @@ -0,0 +1,6 @@ +import yaml from 'js-yaml'; +import faqString from '!!raw-loader!./faq.yaml'; + +const faq = yaml.load(faqString); + +export default faq; diff --git a/src/faq.yaml b/src/faq.yaml new file mode 100644 index 00000000..a9a7951c --- /dev/null +++ b/src/faq.yaml @@ -0,0 +1,20 @@ +# +# General FAQs +# + +- question: What does Elastic Path do? + tags: ['General'] + answer: |- + Elastic Path offers + + For more information, see [Elastic Path docs](/) + +- question: What businesses can use Elastic Path? + tags: ['General'] + answer: |- + Elastic Path can add value to a wide range of industries. + +- question: What is a Developer Portal? + tags: ['General'] + answer: |- + To get started with Elastic Path diff --git a/src/pages/faq.jsx b/src/pages/faq.jsx new file mode 100644 index 00000000..ae24df48 --- /dev/null +++ b/src/pages/faq.jsx @@ -0,0 +1,231 @@ +import React, { useState } from 'react'; +import Layout from '@theme/Layout'; +import HomeFooter from '../components/homepage/HomeFooter'; +import clsx from 'clsx'; +import { useMemo } from 'react'; +import { Minus, Plus, Search } from 'react-feather'; +import { paramCase } from 'param-case'; +import ReactMarkdown from 'react-markdown'; + +import FAQs from '../faq'; +import { useEffect } from 'react'; +import HelpSection from '../components/homepage/HelpSection'; + +const tags = FAQs.reduce((allTags, faq) => { + if (!faq.tags) return allTags; + + for (const tag of faq.tags) { + if (!allTags.includes(tag)) { + allTags.push(tag); + } + } + return allTags; +}, []); + +function Accordion({ title, children, open, onOpen, onClose }) { + const headingId = paramCase(title); + const panelId = headingId + '-panel'; + + const handleOpen = () => { + if (!open) { + onOpen(); + history.pushState({}, '', '#' + headingId); + } else { + onClose(); + history.pushState({}, '', ''); + } + }; + + return ( + + ); +} + +export default function FAQPage() { + const [activeFAQ, setActiveFAQ] = useState(''); + const [query, setQuery] = useState(''); + const [activeTab, setActiveTab] = useState('All'); + + useEffect(() => { + if (typeof window === 'undefined') return; + + const faqId = window.location.hash.substring(1); + + if (faqId !== '') { + setActiveFAQ(faqId); + document.querySelector('#parent-' + faqId)?.scrollIntoView({ + behavior: 'smooth', + block: 'center', + inline: 'center', + }); + } + }, []); + + const filteredFAQs = useMemo(() => { + if (query.trim() === '') { + if (activeTab === 'All') { + return FAQs; + } + return FAQs.filter((faq) => faq.tags.includes(activeTab)); + } + + return FAQs.filter((faq) => { + const str = faq.question + ' ' + faq.answer + ' ' + faq.tags.join(' '); + return str.toLowerCase().includes(query.toLowerCase()); + }); + }, [activeTab, query]); + + function Pill({ tag }) { + return ( + + ); + } + + return ( + + {/* Hero? */} +
+
+
+ Frequently Asked Questions +
+
+
Any questions?
+
We got you.
+
+
+ + setQuery(e.currentTarget.value)} + /> +
+
+
+ +
+
+ {query.trim() !== '' ? ( + filteredFAQs.length === 0 ? ( +
+ 😢 Sorry, no results matched your search terms +
+ ) : ( +
+ 🙌 Showing {filteredFAQs.length} results for "{query}" +
+ ) + ) : ( +
+ + {tags.map((tag) => ( + + ))} +
+ )} + + {/* FAQs */} +
+ {filteredFAQs.map((faq) => { + const id = paramCase(faq.question); + return ( + { + setActiveFAQ(id); + }} + onClose={() => { + setActiveFAQ(''); + }} + > + {faq.answer} + + ); + })} +
+
+
+ + + + +
+ ); +} diff --git a/src/sections.ts b/src/sections.ts new file mode 100644 index 00000000..a06c0b5c --- /dev/null +++ b/src/sections.ts @@ -0,0 +1,164 @@ +import type { ComponentProps, ReactNode } from 'react'; +import { + ReactIcon, + JSIcon, +} from './icons'; + +export type Section = { docId: string } & ( + | { + section: false; + } + | { + section: string; + icon: (props: ComponentProps<'svg'>) => ReactNode; + name: string; + } +); + +const SECTIONS: Section[] = [ + { + name: 'Getting Started', + docId: 'getting-started', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'API Overview', + docId: 'api-overview', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Authentication', + docId: 'authentication', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Team Management', + docId: 'team-management', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Account Management', + docId: 'accounts', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Addresses', + docId: 'addresses', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Customer Management', + docId: 'customer-management', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Product Experience Manager', + docId: 'pxm', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Carts', + docId: 'cm', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Checkout', + docId: 'checkout', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Orders', + docId: 'orders', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Payments', + docId: 'payment', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Promotions', + docId: 'promotions', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Shipping Groups', + docId: 'shipping-groups', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Personal Data', + docId: 'personal-data', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Custom Data', + docId: 'custom-data', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Integrations', + docId: 'integrations', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Composer', + docId: 'composer', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Store Settings', + docId: 'global-project-settings', + icon: null, + section: 'commerce-cloud', + }, + { + name: 'Analytics', + docId: 'analytics', + icon: null, + section: 'commerce-cloud', + }, +]; + +export type SectionsGroup = { + name: string; + section: string; + description?: string; + className?: string; +}; + +const SECTION_GROUPS: SectionsGroup[][] = [ + [ + { + name: 'Composable Commerce', + section: 'commerce-cloud', + description: 'Build your e-commerce experience', + }, + { + name: 'Self Managed Commerce', + section: 'selfmanaged', + description: + 'Self Hosted Commerce', + }, + ], +]; + +export { SECTIONS, SECTION_GROUPS }; diff --git a/src/theme/Admonition/index.js b/src/theme/Admonition/index.js new file mode 100644 index 00000000..9ad6a780 --- /dev/null +++ b/src/theme/Admonition/index.js @@ -0,0 +1,177 @@ +import React from 'react'; +import clsx from 'clsx'; +import {ThemeClassNames} from '@docusaurus/theme-common'; +import Translate from '@docusaurus/Translate'; +import styles from './styles.module.css'; +function NoteIcon() { + return ( + + + + ); +} +function TipIcon() { + return ( + + + + ); +} +function DangerIcon() { + return ( + + + + ); +} +function InfoIcon() { + return ( + + + + ); +} +function CautionIcon() { + return ( + + + + ); +} +// eslint-disable-next-line @typescript-eslint/consistent-indexed-object-style +const AdmonitionConfigs = { + note: { + infimaClassName: 'secondary', + iconComponent: NoteIcon, + label: ( + + note + + ), + }, + tip: { + infimaClassName: 'success', + iconComponent: TipIcon, + label: ( + + tip + + ), + }, + danger: { + infimaClassName: 'danger', + iconComponent: DangerIcon, + label: ( + + danger + + ), + }, + info: { + infimaClassName: 'info', + iconComponent: InfoIcon, + label: ( + + info + + ), + }, + caution: { + infimaClassName: 'warning', + iconComponent: CautionIcon, + label: ( + + caution + + ), + }, +}; +// Legacy aliases, undocumented but kept for retro-compatibility +const aliases = { + secondary: 'note', + important: 'info', + success: 'tip', + warning: 'danger', +}; +function getAdmonitionConfig(unsafeType) { + const type = aliases[unsafeType] ?? unsafeType; + const config = AdmonitionConfigs[type]; + if (config) { + return config; + } + console.warn( + `No admonition config found for admonition type "${type}". Using Info as fallback.`, + ); + return AdmonitionConfigs.info; +} +// Workaround because it's difficult in MDX v1 to provide a MDX title as props +// See https://github.com/facebook/docusaurus/pull/7152#issuecomment-1145779682 +function extractMDXAdmonitionTitle(children) { + const items = React.Children.toArray(children); + const mdxAdmonitionTitle = items.find( + (item) => + React.isValidElement(item) && + item.props?.mdxType === 'mdxAdmonitionTitle', + ); + const rest = <>{items.filter((item) => item !== mdxAdmonitionTitle)}; + return { + mdxAdmonitionTitle, + rest, + }; +} +function processAdmonitionProps(props) { + const {mdxAdmonitionTitle, rest} = extractMDXAdmonitionTitle(props.children); + return { + ...props, + title: props.title ?? mdxAdmonitionTitle, + children: rest, + }; +} +export default function Admonition(props) { + const {children, type, title, icon: iconProp} = processAdmonitionProps(props); + const typeConfig = getAdmonitionConfig(type); + const titleLabel = title ?? typeConfig.label; + const {iconComponent: IconComponent} = typeConfig; + const icon = iconProp ?? ; + return ( +
+
+ {icon} + {titleLabel} +
+
{children}
+
+ ); +} diff --git a/src/theme/Admonition/styles.module.css b/src/theme/Admonition/styles.module.css new file mode 100644 index 00000000..634c9dc4 --- /dev/null +++ b/src/theme/Admonition/styles.module.css @@ -0,0 +1,31 @@ +.admonition { + margin-bottom: 1em; +} + +.admonitionHeading { + font: var(--ifm-heading-font-weight) var(--ifm-h5-font-size) / + var(--ifm-heading-line-height) var(--ifm-heading-font-family); + text-transform: uppercase; + margin-bottom: 0.3rem; +} + +.admonitionHeading code { + text-transform: none; +} + +.admonitionIcon { + display: inline-block; + vertical-align: middle; + margin-right: 0.4em; +} + +.admonitionIcon svg { + display: inline-block; + height: 1.6em; + width: 1.6em; + fill: var(--ifm-alert-foreground-color); +} + +.admonitionContent > :last-child { + margin-bottom: 0; +} diff --git a/src/theme/DocSidebar/Desktop/index.d.ts b/src/theme/DocSidebar/Desktop/index.d.ts new file mode 100644 index 00000000..1043a024 --- /dev/null +++ b/src/theme/DocSidebar/Desktop/index.d.ts @@ -0,0 +1,10 @@ +import React from 'react'; +import type { Props } from '@theme/DocSidebar/Desktop'; +declare function DocSidebarDesktop({ + path, + sidebar, + onCollapse, + isHidden, +}: Props): JSX.Element; +declare const _default: React.MemoExoticComponent; +export default _default; diff --git a/src/theme/DocSidebar/Desktop/index.jsx b/src/theme/DocSidebar/Desktop/index.jsx new file mode 100644 index 00000000..721b6ed0 --- /dev/null +++ b/src/theme/DocSidebar/Desktop/index.jsx @@ -0,0 +1,33 @@ +import React from 'react'; +import clsx from 'clsx'; +import { useThemeConfig } from '@docusaurus/theme-common'; +import Logo from '@theme/Logo'; +import CollapseButton from '@theme/DocSidebar/Desktop/CollapseButton'; +import Content from '@theme/DocSidebar/Desktop/Content'; +import styles from './styles.module.css'; +import SidebarMenu from '../../../components/SidebarMenu'; + +function DocSidebarDesktop({ path, sidebar, onCollapse, isHidden }) { + const { + navbar: { hideOnScroll }, + docs: { + sidebar: { hideable }, + }, + } = useThemeConfig(); + + return ( +
+ {hideOnScroll && } + + + {hideable && } +
+ ); +} +export default React.memo(DocSidebarDesktop); diff --git a/src/theme/DocSidebar/Desktop/styles.module.css b/src/theme/DocSidebar/Desktop/styles.module.css new file mode 100644 index 00000000..dc682884 --- /dev/null +++ b/src/theme/DocSidebar/Desktop/styles.module.css @@ -0,0 +1,43 @@ +@media (min-width: 997px) { + .sidebar { + display: flex; + flex-direction: column; + max-height: 100vh; + height: 100%; + position: sticky; + top: 0; + padding-top: var(--ifm-navbar-height); + width: var(--doc-sidebar-width); + transition: opacity 50ms ease; + } + + .sidebarWithHideableNavbar { + padding-top: 0; + } + + .sidebarHidden { + opacity: 0; + height: 0; + overflow: hidden; + visibility: hidden; + } + + .sidebarLogo { + display: flex !important; + align-items: center; + margin: 0 var(--ifm-navbar-padding-horizontal); + min-height: var(--ifm-navbar-height); + max-height: var(--ifm-navbar-height); + color: inherit !important; + text-decoration: none !important; + } + + .sidebarLogo img { + margin-right: 0.5rem; + height: 2rem; + } +} + +.sidebarLogo { + display: none; +} diff --git a/src/theme/DocSidebar/Mobile/index.d.ts b/src/theme/DocSidebar/Mobile/index.d.ts new file mode 100644 index 00000000..0ba788e5 --- /dev/null +++ b/src/theme/DocSidebar/Mobile/index.d.ts @@ -0,0 +1,5 @@ +import React from 'react'; +import type { Props } from '@theme/DocSidebar/Mobile'; +declare function DocSidebarMobile(props: Props): JSX.Element; +declare const _default: React.MemoExoticComponent; +export default _default; diff --git a/src/theme/DocSidebar/Mobile/index.jsx b/src/theme/DocSidebar/Mobile/index.jsx new file mode 100644 index 00000000..c3a7a7a4 --- /dev/null +++ b/src/theme/DocSidebar/Mobile/index.jsx @@ -0,0 +1,42 @@ +import React from 'react'; +import clsx from 'clsx'; +import { + NavbarSecondaryMenuFiller, + ThemeClassNames, +} from '@docusaurus/theme-common'; +import { useNavbarMobileSidebar } from '@docusaurus/theme-common/internal'; +import DocSidebarItems from '@theme/DocSidebarItems'; + +import SidebarMenu from '../../../components/SidebarMenu'; + +const DocSidebarMobileSecondaryMenu = ({ sidebar, path }) => { + const mobileSidebar = useNavbarMobileSidebar(); + return ( +
    + + { + // Mobile sidebar should only be closed if the category has a link + if (item.type === 'category' && item.href) { + mobileSidebar.toggle(); + } + if (item.type === 'link') { + mobileSidebar.toggle(); + } + }} + level={1} + /> +
+ ); +}; +function DocSidebarMobile(props) { + return ( + + ); +} +export default React.memo(DocSidebarMobile); diff --git a/src/theme/MDXComponents.js b/src/theme/MDXComponents.js index d692c85d..cb866b07 100644 --- a/src/theme/MDXComponents.js +++ b/src/theme/MDXComponents.js @@ -8,6 +8,7 @@ import ColorCode from '../components/ColorCode'; import ColorPalette from '../components/ColorPalette'; import VideoPlayer from '../components/VideoPlayer'; import InfoTooltip from '../components/InfoTooltip'; +import PropsTable from '../components/PropsTable'; import ComponentsGrid from '../components/ComponentsGrid'; import { CardSection, Card } from '../components/CardComponents'; import * as icons from '../icons'; @@ -24,6 +25,7 @@ export default { ColorPalette, VideoPlayer, InfoTooltip, + PropsTable, ComponentsGrid, CardSection, Card, diff --git a/src/theme/Playground/index.d.ts b/src/theme/Playground/index.d.ts new file mode 100644 index 00000000..0b0eb681 --- /dev/null +++ b/src/theme/Playground/index.d.ts @@ -0,0 +1,7 @@ +/// +import type { Props } from '@theme/Playground'; +export default function Playground({ + children, + transformCode, + ...props +}: Props): JSX.Element; diff --git a/src/theme/Playground/index.jsx b/src/theme/Playground/index.jsx new file mode 100644 index 00000000..1c05a1d5 --- /dev/null +++ b/src/theme/Playground/index.jsx @@ -0,0 +1,143 @@ +import React, { useEffect } from 'react'; +import clsx from 'clsx'; +import useIsBrowser from '@docusaurus/useIsBrowser'; +import { LiveProvider, LiveEditor, LiveError, LivePreview } from 'react-live'; +import Translate from '@docusaurus/Translate'; +import useDocusaurusContext from '@docusaurus/useDocusaurusContext'; +import BrowserOnly from '@docusaurus/BrowserOnly'; +import { usePrismTheme } from '@docusaurus/theme-common'; +import styles from './styles.module.css'; + +function Header({ children }) { + return
{children}
; +} + +function LivePreviewLoader() { + // Is it worth improving/translating? + return
Loading...
; +} + +function ResultWithHeader() { + return ( + <> +
+ + Preview + +
+ {/* https://github.com/facebook/docusaurus/issues/5747 */} +
+ }> + {() => ( + <> + + + + )} + +
+ + ); +} + +function ThemedLiveEditor() { + const isBrowser = useIsBrowser(); + return ( + + ); +} +function EditorWithHeader() { + return ( + <> +
+ + Live Editor + +
+ + + ); +} + +export default function Playground({ children, transformCode, ...props }) { + const { + siteConfig: { themeConfig }, + } = useDocusaurusContext(); + + const { + liveCodeBlock: { playgroundPosition }, + } = themeConfig; + + const prismTheme = usePrismTheme(); + + const [client, initClient] = useDyteClient(); + + // TODO: Uncomment following block of code after adding mock web-core package + useEffect(() => { + initClient({ + roomName: 'qplrfc-uuujcj', + authToken: + 'eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjdkYzU0MGRjLWQ5MjUtNDVjMi1hZTFiLWM2NDc2YTUwNmM2NyIsImxvZ2dlZEluIjp0cnVlLCJpYXQiOjE2NjU2NDcxNjksImV4cCI6MTY3NDI4NzE2OX0.hJvo1PV1_jaxwiQbT8ft7Yi4lhIPgAsuEJHqohHYC_2XNef7kA4NhrYLvwrrxOo3AKh9_XTjnj_bsgzIDh35RRggawJniEjuE83ju2xhMXMVaa7TNDje2BsH5-VnFJ4y5hOwxGphrP5iHY_U4k_0qOQcEfVEJMymJvx0gq_Ueds', + defaults: { + audio: false, + video: false, + }, + }).then((meeting) => { + Object.defineProperty(meeting.self.permissions, 'produceAudio', { + value: 'ALLOWED', + }); + Object.defineProperty(meeting.self.permissions.produceVideo, 'allow', { + value: 'ALLOWED', + }); + Object.defineProperty(meeting, 'connectedMeetings', { + value: { + supportsConnectedMeetings: false, + }, + }); + meeting.meta.meetingStartedTimestamp = new Date(); + meeting.participants.mockAddParticipants(5, 5); + meeting.recording.recordingState = 'RECORDING'; + }); + }, []); + + if (typeof window !== 'undefined') { + window.meeting = client || {}; + } + + return ( +
+ + {/* @ts-expect-error: type incompatibility with refs */} + `${code};`)} + theme={prismTheme} + {...props} + > + {playgroundPosition === 'top' ? ( + <> + + + + ) : ( + <> + + + + )} + + +
+ ); +} diff --git a/src/theme/Playground/styles.module.css b/src/theme/Playground/styles.module.css new file mode 100644 index 00000000..d107439f --- /dev/null +++ b/src/theme/Playground/styles.module.css @@ -0,0 +1,33 @@ +.playgroundContainer { + margin-bottom: var(--ifm-leading); + border-radius: var(--ifm-global-radius); + box-shadow: var(--ifm-global-shadow-lw); + overflow: hidden; +} + +.playgroundHeader { + letter-spacing: 0.08rem; + padding: 0.75rem; + text-transform: uppercase; + font-weight: bold; + background: var(--ifm-color-emphasis-200); + color: var(--ifm-color-content); + font-size: var(--ifm-code-font-size); +} + +.playgroundHeader:first-of-type { + background: var(--ifm-color-emphasis-600); + color: var(--ifm-color-content-inverse); +} + +.playgroundEditor { + font: var(--ifm-code-font-size) / var(--ifm-pre-line-height) + var(--ifm-font-family-monospace) !important; + /* rtl:ignore */ + direction: ltr; +} + +.playgroundPreview { + padding: 1rem; + background-color: var(--ifm-pre-background); +} diff --git a/src/theme/ReactLiveScope/index.d.ts b/src/theme/ReactLiveScope/index.d.ts new file mode 100644 index 00000000..a572a96b --- /dev/null +++ b/src/theme/ReactLiveScope/index.d.ts @@ -0,0 +1,271 @@ +/* eslint-disable */ +import React from 'react'; +declare const ReactLiveScope: { + createFactory( + type: keyof React.ReactHTML + ): React.HTMLFactory; + createFactory(type: keyof React.ReactSVG): React.SVGFactory; + createFactory

, T_1 extends Element>( + type: string + ): React.DOMFactory; + createFactory( + type: React.FunctionComponent + ): React.FunctionComponentFactory; + createFactory( + type: React.ClassType< + P_2, + React.ClassicComponent, + React.ClassicComponentClass + > + ): React.CFactory>; + createFactory< + P_3, + T_2 extends React.Component, + C extends React.ComponentClass + >( + type: React.ClassType + ): React.CFactory; + createFactory(type: React.ComponentClass): React.Factory; + createElement( + type: 'input', + props?: + | (React.InputHTMLAttributes & + React.ClassAttributes) + | null + | undefined, + ...children: React.ReactNode[] + ): React.DetailedReactHTMLElement< + React.InputHTMLAttributes, + HTMLInputElement + >; + createElement, T_3 extends HTMLElement>( + type: keyof React.ReactHTML, + props?: (React.ClassAttributes & P_5) | null | undefined, + ...children: React.ReactNode[] + ): React.DetailedReactHTMLElement; + createElement, T_4 extends SVGElement>( + type: keyof React.ReactSVG, + props?: (React.ClassAttributes & P_6) | null | undefined, + ...children: React.ReactNode[] + ): React.ReactSVGElement; + createElement, T_5 extends Element>( + type: string, + props?: (React.ClassAttributes & P_7) | null | undefined, + ...children: React.ReactNode[] + ): React.DOMElement; + createElement( + type: React.FunctionComponent, + props?: (React.Attributes & P_8) | null | undefined, + ...children: React.ReactNode[] + ): React.FunctionComponentElement; + createElement( + type: React.ClassType< + P_9, + React.ClassicComponent, + React.ClassicComponentClass + >, + props?: + | (React.ClassAttributes> & P_9) + | null + | undefined, + ...children: React.ReactNode[] + ): React.CElement>; + createElement< + P_10 extends {}, + T_6 extends React.Component, + C_1 extends React.ComponentClass + >( + type: React.ClassType, + props?: (React.ClassAttributes & P_10) | null | undefined, + ...children: React.ReactNode[] + ): React.CElement; + createElement( + type: + | string + | React.FunctionComponent + | React.ComponentClass, + props?: (React.Attributes & P_11) | null | undefined, + ...children: React.ReactNode[] + ): React.ReactElement>; + cloneElement, T_7 extends HTMLElement>( + element: React.DetailedReactHTMLElement, + props?: P_12 | undefined, + ...children: React.ReactNode[] + ): React.DetailedReactHTMLElement; + cloneElement, T_8 extends HTMLElement>( + element: React.ReactHTMLElement, + props?: P_13 | undefined, + ...children: React.ReactNode[] + ): React.ReactHTMLElement; + cloneElement, T_9 extends SVGElement>( + element: React.ReactSVGElement, + props?: P_14 | undefined, + ...children: React.ReactNode[] + ): React.ReactSVGElement; + cloneElement, T_10 extends Element>( + element: React.DOMElement, + props?: (React.DOMAttributes & P_15) | undefined, + ...children: React.ReactNode[] + ): React.DOMElement; + cloneElement( + element: React.FunctionComponentElement, + props?: (Partial & React.Attributes) | undefined, + ...children: React.ReactNode[] + ): React.FunctionComponentElement; + cloneElement>( + element: React.CElement, + props?: (Partial & React.ClassAttributes) | undefined, + ...children: React.ReactNode[] + ): React.CElement; + cloneElement( + element: React.ReactElement< + P_18, + string | React.JSXElementConstructor + >, + props?: (Partial & React.Attributes) | undefined, + ...children: React.ReactNode[] + ): React.ReactElement>; + createContext(defaultValue: T_12): React.Context; + isValidElement( + object: {} | null | undefined + ): object is React.ReactElement< + P_19, + string | React.JSXElementConstructor + >; + createRef(): React.RefObject; + forwardRef( + render: React.ForwardRefRenderFunction + ): React.ForwardRefExoticComponent< + React.PropsWithoutRef & React.RefAttributes + >; + memo( + Component: React.FunctionComponent, + propsAreEqual?: + | ((prevProps: Readonly, nextProps: Readonly) => boolean) + | undefined + ): React.NamedExoticComponent; + memo>( + Component: T_15, + propsAreEqual?: + | (( + prevProps: Readonly>, + nextProps: Readonly> + ) => boolean) + | undefined + ): React.MemoExoticComponent; + lazy>( + factory: () => Promise<{ + default: T_16; + }> + ): React.LazyExoticComponent; + useContext(context: React.Context): T_17; + useState( + initialState: S | (() => S) + ): [S, React.Dispatch>]; + useState(): [ + S_1 | undefined, + React.Dispatch> + ]; + useReducer, I>( + reducer: R, + initializerArg: I, + initializer: (arg: I) => React.ReducerStateWithoutAction + ): [React.ReducerStateWithoutAction, React.DispatchWithoutAction]; + useReducer>( + reducer: R_1, + initializerArg: React.ReducerStateWithoutAction, + initializer?: undefined + ): [React.ReducerStateWithoutAction, React.DispatchWithoutAction]; + useReducer, I_1>( + reducer: R_2, + initializerArg: I_1 & React.ReducerState, + initializer: (arg: I_1 & React.ReducerState) => React.ReducerState + ): [React.ReducerState, React.Dispatch>]; + useReducer, I_2>( + reducer: R_3, + initializerArg: I_2, + initializer: (arg: I_2) => React.ReducerState + ): [React.ReducerState, React.Dispatch>]; + useReducer>( + reducer: R_4, + initialState: React.ReducerState, + initializer?: undefined + ): [React.ReducerState, React.Dispatch>]; + useRef(initialValue: T_18): React.MutableRefObject; + useRef(initialValue: T_19 | null): React.RefObject; + useRef(): React.MutableRefObject; + useLayoutEffect( + effect: React.EffectCallback, + deps?: React.DependencyList | undefined + ): void; + useEffect( + effect: React.EffectCallback, + deps?: React.DependencyList | undefined + ): void; + useImperativeHandle( + ref: React.Ref | undefined, + init: () => R_5, + deps?: React.DependencyList | undefined + ): void; + useCallback( + callback: T_22, + deps: React.DependencyList + ): T_22; + useMemo( + factory: () => T_23, + deps: React.DependencyList | undefined + ): T_23; + useDebugValue( + value: T_24, + format?: ((value: T_24) => any) | undefined + ): void; + useDeferredValue(value: T_25): T_25; + useTransition(): [boolean, React.TransitionStartFunction]; + startTransition(scope: React.TransitionFunction): void; + useId(): string; + useInsertionEffect( + effect: React.EffectCallback, + deps?: React.DependencyList | undefined + ): void; + useSyncExternalStore( + subscribe: (onStoreChange: () => void) => () => void, + getSnapshot: () => Snapshot, + getServerSnapshot?: (() => Snapshot) | undefined + ): Snapshot; + Children: { + map( + children: C_2 | readonly C_2[], + fn: (child: C_2, index: number) => T_26 + ): C_2 extends null | undefined + ? C_2 + : Exclude[]; + forEach( + children: C_3 | readonly C_3[], + fn: (child: C_3, index: number) => void + ): void; + count(children: any): number; + only(children: C_4): C_4 extends any[] ? never : C_4; + toArray( + children: React.ReactNode | React.ReactNode[] + ): ( + | string + | number + | React.ReactElement> + | React.ReactFragment + | React.ReactPortal + )[]; + }; + Fragment: React.ExoticComponent<{ + children?: React.ReactNode; + }>; + StrictMode: React.ExoticComponent<{ + children?: React.ReactNode; + }>; + Suspense: React.ExoticComponent; + version: string; + Profiler: React.ExoticComponent; + Component: typeof React.Component; + PureComponent: typeof React.PureComponent; + React: typeof React; +}; +export default ReactLiveScope; diff --git a/src/theme/ReactLiveScope/index.js b/src/theme/ReactLiveScope/index.js new file mode 100644 index 00000000..e23cbc03 --- /dev/null +++ b/src/theme/ReactLiveScope/index.js @@ -0,0 +1,13 @@ +import React from 'react'; + +import DemoElements from '../../components/DemoElements'; + +// Add react-live imports you need here +const ReactLiveScope = { + React, + + // DemoElements used in react-ui-kit live codeblocks + ...DemoElements, +}; + +export default ReactLiveScope;