Skip to content

Commit

Permalink
import readme,md code
Browse files Browse the repository at this point in the history
  • Loading branch information
arietrouw committed Oct 25, 2023
1 parent b765673 commit cf4b7f4
Show file tree
Hide file tree
Showing 14 changed files with 3,930 additions and 2,225 deletions.
2 changes: 1 addition & 1 deletion .yarn/releases/yarn-3.5.1.cjs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ A digital or physical device that collects data of some sort. Sentinels structur

- An NFC chip that counts phone scans every time you tap it to your phone
- A smart-watch that records your heart rate
- A thermomenter that collects real-world temperature data
- A thermometer that collects real-world temperature data

## Bridge
A Bridge transfers Bound Witness and payload data form Sentinels to an Archivist. In many cases, the same device that is running the Sentinel also acts as the Bridge. Some examples of Bridges might be:
Expand Down
7 changes: 0 additions & 7 deletions docs/sdks/javascript.md

This file was deleted.

12 changes: 12 additions & 0 deletions docs/sdks/javascript.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
sidebar_position: 1
---

import Readme from "@xyo-network/sdk-xyo-client-js/README.md"

# Javascript/Typescript SDK

<Readme/>



9 changes: 0 additions & 9 deletions docs/sdks/react.md

This file was deleted.

11 changes: 11 additions & 0 deletions docs/sdks/react.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
sidebar_position: 2
---

import Readme from "@xyo-network/sdk-xyo-react/README.md"

# React SDK

<Readme/>


2 changes: 1 addition & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ const config = {
alt: 'XYO Logo',
src: 'img/logo.svg',
},
title: 'XYO Platform',
title: 'XYO Platform (Pre-release Docs)',
},
prism: {
darkTheme: darkCodeTheme,
Expand Down
44 changes: 23 additions & 21 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,20 @@
"@docusaurus/preset-classic": "2.4.3",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "^5.14.13",
"@mui/joy": "^5.0.0-beta.10",
"@mui/material": "^5.14.13",
"@mui/styles": "^5.14.13",
"@mui/utils": "^5.14.13",
"@xyo-network/archivist": "^2.76.0",
"@xyo-network/react-card": "^2.65.0",
"@xyo-network/react-embed": "^2.65.0",
"@xyo-network/react-plugins": "^2.65.0",
"@mui/icons-material": "^5.14.15",
"@mui/joy": "^5.0.0-beta.12",
"@mui/material": "^5.14.15",
"@mui/styles": "^5.14.15",
"@mui/utils": "^5.14.15",
"@xyo-network/archivist": "^2.77.7",
"@xyo-network/react-card": "^2.65.4",
"@xyo-network/react-embed": "^2.65.4",
"@xyo-network/react-plugins": "^2.65.4",
"@xyo-network/sdk-xyo-client-js": "^2.77.7",
"@xyo-network/sdk-xyo-react": "^2.65.4",
"clipboard-copy": "^4.0.1",
"clsx": "^2.0.0",
"core-js": "^3.33.0",
"core-js": "^3.33.1",
"jss-rtl": "^0.3.0",
"lz-string": "^1.5.0",
"prism-react-renderer": "^1.3.5",
Expand All @@ -44,23 +46,23 @@
"react-runner": "^1.0.3",
"react-simple-code-editor": "^0.13.1",
"stream-browserify": "^3.0.0",
"styled-components": "^6.0.9",
"styled-components": "^6.1.0",
"stylis-plugin-rtl": "^2.1.1"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "2.4.3",
"@tsconfig/docusaurus": "^2.0.1",
"@types/prismjs": "^1.26.1",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"@typescript-eslint/parser": "^6.7.5",
"@xylabs/eslint-config": "^3.1.9",
"@xylabs/eslint-config-react": "^3.1.9",
"@xylabs/ts-scripts-react-yarn3": "^3.1.9",
"@xylabs/tsconfig-react": "^3.1.9",
"eslint": "^8.51.0",
"@tsconfig/docusaurus": "^2.0.2",
"@types/prismjs": "^1.26.2",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"@xylabs/eslint-config": "^3.1.13",
"@xylabs/eslint-config-react": "^3.1.13",
"@xylabs/ts-scripts-react-yarn3": "^3.1.13",
"@xylabs/tsconfig-react": "^3.1.13",
"eslint": "^8.52.0",
"eslint-import-resolver-typescript": "^3.6.1",
"eslint-plugin-deprecation": "^2.0.0",
"eslint-plugin-import": "^2.28.1",
"eslint-plugin-import": "^2.29.0",
"typescript": "^5.2.2"
},
"resolutions": {
Expand Down
2 changes: 1 addition & 1 deletion src/components/Demo/Demo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ const Root = styled('div')(({ theme }) => ({
},
}))

const DemoCodeViewer = styled(HighlightedCode)(({ theme }) => ({
export const DemoCodeViewer = styled(HighlightedCode)(({ theme }) => ({
'& pre': {
borderRadius: 0,
margin: 0,
Expand Down
11 changes: 6 additions & 5 deletions src/components/Demo/mui-docs/svgIcons/FileDownload.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import * as React from 'react';
import SvgIcon from '@mui/material/SvgIcon';
import SvgIcon from '@mui/material/SvgIcon'
import * as React from 'react'

function FileDownload(props) {
return (
<SvgIcon {...props}>
<path d="M19 9h-4V3H9v6H5l7 7 7-7zM5 18v2h14v-2H5z" />
</SvgIcon>
);
)
}

FileDownload.muiName = 'SvgIcon';
FileDownload.muiName = 'SvgIcon'

export default FileDownload;
// eslint-disable-next-line import/no-default-export
export default FileDownload
11 changes: 6 additions & 5 deletions src/components/Demo/mui-docs/svgIcons/JavaScript.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import * as React from 'react';
import SvgIcon from '@mui/material/SvgIcon';
import SvgIcon from '@mui/material/SvgIcon'
import * as React from 'react'

function JavaScript(props) {
return (
<SvgIcon {...props}>
<path d="M3,3H21V21H3V3M7.73,18.04C8.13,18.89 8.92,19.59 10.27,19.59C11.77,19.59 12.8,18.79 12.8,17.04V11.26H11.1V17C11.1,17.86 10.75,18.08 10.2,18.08C9.62,18.08 9.38,17.68 9.11,17.21L7.73,18.04M13.71,17.86C14.21,18.84 15.22,19.59 16.8,19.59C18.4,19.59 19.6,18.76 19.6,17.23C19.6,15.82 18.79,15.19 17.35,14.57L16.93,14.39C16.2,14.08 15.89,13.87 15.89,13.37C15.89,12.96 16.2,12.64 16.7,12.64C17.18,12.64 17.5,12.85 17.79,13.37L19.1,12.5C18.55,11.54 17.77,11.17 16.7,11.17C15.19,11.17 14.22,12.13 14.22,13.4C14.22,14.78 15.03,15.43 16.25,15.95L16.67,16.13C17.45,16.47 17.91,16.68 17.91,17.26C17.91,17.74 17.46,18.09 16.76,18.09C15.93,18.09 15.45,17.66 15.09,17.06L13.71,17.86Z" />
</SvgIcon>
);
)
}

JavaScript.muiName = 'SvgIcon';
JavaScript.muiName = 'SvgIcon'

export default JavaScript;
// eslint-disable-next-line import/no-default-export
export default JavaScript
16 changes: 8 additions & 8 deletions src/components/Demo/sandbox/CreateReactApp.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export const getHtml = ({ title, language }: { title: string; language: string }) => {
export const getHtml = ({ title, language }: { language: string; title: string }) => {
return `<!DOCTYPE html>
<html lang="${language}">
<head>
Expand All @@ -17,8 +17,8 @@ export const getHtml = ({ title, language }: { title: string; language: string }
<body>
<div id="root"></div>
</body>
</html>`;
};
</html>`
}

export const getRootIndex = (product?: 'joy-ui' | 'base') => {
if (product === 'joy-ui') {
Expand All @@ -35,7 +35,7 @@ ReactDOM.createRoot(document.querySelector("#root")).render(
</CssVarsProvider>
</StyledEngineProvider>
</React.StrictMode>
);`;
);`
}
if (product === 'base') {
return `import * as React from 'react';
Expand All @@ -46,7 +46,7 @@ ReactDOM.createRoot(document.querySelector("#root")).render(
<React.StrictMode>
<Demo />
</React.StrictMode>
);`;
);`
}
return `import * as React from 'react';
import * as ReactDOM from 'react-dom/client';
Expand All @@ -59,8 +59,8 @@ ReactDOM.createRoot(document.querySelector("#root")).render(
<Demo />
</StyledEngineProvider>
</React.StrictMode>
);`;
};
);`
}

export const getTsconfig = () => `{
"compilerOptions": {
Expand All @@ -87,4 +87,4 @@ export const getTsconfig = () => `{
"src"
]
}
`;
`
71 changes: 43 additions & 28 deletions src/theme/CodeBlock/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/no-var-requires, import/no-internal-modules */
import { Paper } from '@mui/material'
import * as mui from '@mui/material'
import { Demo } from '@site/src/components/Demo'
import { Demo, DemoCodeViewer } from '@site/src/components/Demo'
import { ReactRunner } from '@site/src/components/Demo/ReactRunner'
import { CodeVariantProvider } from '@site/src/components/Demo/utils'
import { FlexRow } from '@xylabs/react-flexbox'
Expand Down Expand Up @@ -29,7 +29,7 @@ const DemoCodeBlock: React.FC<DemoCodeBlockProps> = (props) => {
let tsxCode = ''
let jsxCode = ''
let previewCode = ''
let ext = 'jsx'
let ext = null
try {
tsxCode = require(`!!raw-loader!@site/docs/${code}/demo.tsx`).default ?? children ?? ''
ext = 'tsx'
Expand All @@ -49,37 +49,52 @@ const DemoCodeBlock: React.FC<DemoCodeBlockProps> = (props) => {
null
}

console.log(`ext: ${ext}`)

const previewCodeOrChildren = (children as string) ?? previewCode

return (
<CodeVariantProvider value={{ codeVariant: 'TS' }}>
<Paper>
<FlexRow padding={2}>
<ReactRunner
scope={{ import: { '@mui/material': mui, react: React }, process: {} }}
onError={(error) => console.error(JSON.stringify(error, null, 2))}
code={jsxCode}
{ext === null ? (
<DemoCodeViewer
code={previewCodeOrChildren}
language="sh"
copyButtonProps={{
'data-ga-event-action': 'copy-click',
'data-ga-event-category': true,
'data-ga-event-label': '',
}}
/>
) : (
<>
<Paper>
<FlexRow padding={2}>
<ReactRunner
scope={{ import: { '@mui/material': mui, react: React }, process: {} }}
onError={(error) => console.error(JSON.stringify(error, null, 2))}
code={jsxCode}
/>
</FlexRow>
</Paper>
<Demo
demo={{
githubLocation: 'https://github.com/XYOracleNetwork',
jsx: Paper,
jsxPreview: previewCodeOrChildren,
language: 'en',
raw: jsxCode,
rawJS: jsxCode,
rawTS: tsxCode,
sourceLanguage: sourceLanguage,
title,
tsx: Paper,
}}
demoOptions={{ defaultCodeOpen: true, demo: 'demo.js' }}
githubLocation={`https://github.com/XYOracleNetwork/web-xyo.network-docusaurus/tree/main/docs/${code}/demo.${ext}`}
deps={deps}
/>
</FlexRow>
</Paper>

<Demo
demo={{
githubLocation: 'https://github.com/XYOracleNetwork',
jsx: Paper,
jsxPreview: previewCodeOrChildren,
language: 'en',
raw: jsxCode,
rawJS: jsxCode,
rawTS: tsxCode,
sourceLanguage: sourceLanguage,
title,
tsx: Paper,
}}
demoOptions={{ defaultCodeOpen: true, demo: 'demo.js' }}
githubLocation={`https://github.com/XYOracleNetwork/web-xyo.network-docusaurus/tree/main/docs/${code}/demo.${ext}`}
deps={deps}
/>
</>
)}
</CodeVariantProvider>
)
}
Expand Down
Loading

0 comments on commit cf4b7f4

Please sign in to comment.