Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ module.exports = {
organizationName: 'datalayer',
projectName: 'datalayer',
markdown: {
format: 'detect',
mermaid: true,
},
plugins: [
Expand Down
6 changes: 4 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,16 @@
"@docusaurus/theme-live-codeblock": "^3.5.2",
"@docusaurus/theme-mermaid": "^3.5.2",
"@mdx-js/react": "^3.0.1",
"@primer/react-brand": "^0.58.0",
"@primer/primitives": "^10.7.0",
"@primer/react": "^37.31.0",
"clsx": "^2.1.1",
"docusaurus-lunr-search": "^3.5.0",
"mermaid": "^11.3.0",
"react": "18.3.1",
"react-calendly": "^4.1.0",
"react-dom": "18.3.1",
"react-modal-image": "^2.5.0"
"react-modal-image": "^2.5.0",
"styled-components": "^5.3.10"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "^3.4.0",
Expand Down
7 changes: 1 addition & 6 deletions docs/src/theme/CustomDocItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,12 @@
*/

import React from "react";
import { ThemeProvider } from '@primer/react-brand';
import DocItem from "@theme/DocItem";

import '@primer/react-brand/lib/css/main.css'

export const CustomDocItem = (props: any) => {
return (
<>
<ThemeProvider>
<DocItem {...props}/>
</ThemeProvider>
<DocItem {...props}/>
</>
)
}
Expand Down
4 changes: 1 addition & 3 deletions docs/src/theme/IconsTitle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@
*/

import React from "react";
import { Box } from '@primer/react';

import '@primer/react-brand/lib/css/main.css'
import { Box } from '@datalayer/primer-addons';

type Props = {
icon1: JSX.Element,
Expand Down
81 changes: 81 additions & 0 deletions docs/src/theme/PrimerRoot.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
/*
* Copyright (c) 2025-2026 Datalayer, Inc.
* Distributed under the terms of the Modified BSD License.
*/

/**
* Primer React for the pages of this site, its theme pinned: Datalayer's,
* in the colour mode Docusaurus shows, with no chooser of its own. A chooser
* here would repaint the Primer parts while the Docusaurus page around them
* stays put.
*
* The mode follows the `data-theme` Docusaurus sets on `<html>`, so a site
* pinned to light stays light on a dark system, and its switch, where it has
* one, moves Primer with it. `Root` sits above Docusaurus' colour mode
* provider, so the attribute is read, then watched; the first render, the
* server's included, starts from the site's `colorMode.defaultMode`.
*
* The same file in every Datalayer Docusaurus site; `src/theme/Root` wraps
* the site in it. `BaseStyles` gives the Primer components their colour-mode
* attributes and leaves the font, colour and line height to Docusaurus; the
* primitives give them their CSS variables.
*/

import React, { useEffect, useState, type ReactNode } from 'react';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import { BaseStyles, ThemeProvider } from '@primer/react';
import { datalayerTheme } from '@datalayer/primer-addons/lib/theme/themes/datalayerTheme';

import '@primer/primitives/dist/css/base/size/size.css';
import '@primer/primitives/dist/css/base/typography/typography.css';
import '@primer/primitives/dist/css/base/motion/motion.css';
import '@primer/primitives/dist/css/functional/size/border.css';
import '@primer/primitives/dist/css/functional/size/breakpoints.css';
import '@primer/primitives/dist/css/functional/size/size.css';
import '@primer/primitives/dist/css/functional/size/viewport.css';
import '@primer/primitives/dist/css/functional/themes/light.css';
import '@primer/primitives/dist/css/functional/themes/dark.css';
import '@primer/primitives/dist/css/functional/typography/typography.css';

type PrimerMode = 'day' | 'night';

/** Docusaurus' `light` or `dark` as Primer's `day` or `night`. */
const primerModeOf = (docusaurusMode: string | null | undefined): PrimerMode =>
docusaurusMode === 'dark' ? 'night' : 'day';

/*
* BaseStyles' div sits between #__docusaurus (a column flex box) and the
* navbar, .main-wrapper and footer: it grows in the root and is a column flex
* box itself, so .main-wrapper's flex: 1 still fills a short page and the
* footer stays at the bottom.
*/
const INHERIT = {
fontFamily: 'inherit',
fontSize: 'inherit',
lineHeight: 'inherit',
color: 'inherit',
display: 'flex',
flexDirection: 'column',
flex: '1 0 auto',
} as const;

export function PrimerRoot({ children }: { children: ReactNode }) {
const { siteConfig } = useDocusaurusContext();
const defaultMode = (siteConfig.themeConfig as { colorMode?: { defaultMode?: string } })?.colorMode?.defaultMode;
const [colorMode, setColorMode] = useState<PrimerMode>(primerModeOf(defaultMode));
useEffect(() => {
const html = document.documentElement;
const follow = () => setColorMode(primerModeOf(html.getAttribute('data-theme')));
follow();
const observer = new MutationObserver(follow);
observer.observe(html, { attributes: true, attributeFilter: ['data-theme'] });
return () => observer.disconnect();
}, []);
return (
<ThemeProvider theme={datalayerTheme} colorMode={colorMode}>
<BaseStyles style={INHERIT}>{children}</BaseStyles>
</ThemeProvider>
);
}

export default PrimerRoot;
16 changes: 16 additions & 0 deletions docs/src/theme/Root.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2025-2026 Datalayer, Inc.
* Distributed under the terms of the Modified BSD License.
*/

/**
* Docusaurus' root wrapper (swizzled): every page in Primer React's theme,
* pinned (see `PrimerRoot`).
*/

import React, { type ReactNode } from 'react';
import { PrimerRoot } from './PrimerRoot';

export default function Root({ children }: { children: ReactNode }) {
return <PrimerRoot>{children}</PrimerRoot>;
}
7 changes: 1 addition & 6 deletions ui/src/pages/Servers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,7 @@ export default function Servers() {

{/* Add Server Dialog */}
{showAddDialog && (
<Dialog
isOpen={showAddDialog}
onDismiss={() => setShowAddDialog(false)}
aria-labelledby="add-server-title"
>
<Dialog.Header id="add-server-title">Add Server</Dialog.Header>
<Dialog title="Add Server" onClose={() => setShowAddDialog(false)}>
<Box style={{ padding: '16px' }}>
<Text style={{ color: '#656d76', marginBottom: '16px', display: 'block' }}>
Server configuration via UI coming in next iteration.
Expand Down
7 changes: 1 addition & 6 deletions ui/src/pages/Translators.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -315,12 +315,7 @@ export default function Translators() {

{/* Add Translator Dialog */}
{showAddDialog && (
<Dialog
isOpen={showAddDialog}
onDismiss={resetForm}
aria-labelledby="add-translator-title"
>
<Dialog.Header id="add-translator-title">Add Protocol Translator</Dialog.Header>
<Dialog title="Add Protocol Translator" onClose={resetForm}>
<Box as="form" onSubmit={handleCreate} style={{ padding: '16px' }}>
{/* Translator Type Selection */}
<FormControl>
Expand Down
Loading