From d1db6f97101662d1686f4be7bc14d6692a8aaba1 Mon Sep 17 00:00:00 2001 From: Dave Falke Date: Fri, 22 Nov 2024 12:19:24 -0500 Subject: [PATCH] Checkpoint - Expose some coreui theme values as custom css properties - Replace ExpandablePanel with
- Replace SCSS file with CSS file --- .../components/theming/UIThemeProvider.tsx | 14 ++- .../libs/eda/src/lib/notebook/EdaNotebook.css | 116 ++++++++++++++++++ .../eda/src/lib/notebook/EdaNotebook.scss | 35 ------ .../src/lib/notebook/EdaNotebookAnalysis.tsx | 30 ++--- 4 files changed, 141 insertions(+), 54 deletions(-) create mode 100644 packages/libs/eda/src/lib/notebook/EdaNotebook.css delete mode 100644 packages/libs/eda/src/lib/notebook/EdaNotebook.scss diff --git a/packages/libs/coreui/src/components/theming/UIThemeProvider.tsx b/packages/libs/coreui/src/components/theming/UIThemeProvider.tsx index e6481d115a..b6c35d226c 100644 --- a/packages/libs/coreui/src/components/theming/UIThemeProvider.tsx +++ b/packages/libs/coreui/src/components/theming/UIThemeProvider.tsx @@ -14,13 +14,23 @@ export default function UIThemeProvider({ children, }: UIThemeProviderProps) { useCoreUIFonts(); + // In addition to making the theme available via React Context, + // we will also expose the theme as custom CSS properties. return ( diff --git a/packages/libs/eda/src/lib/notebook/EdaNotebook.css b/packages/libs/eda/src/lib/notebook/EdaNotebook.css new file mode 100644 index 0000000000..be2665e7d6 --- /dev/null +++ b/packages/libs/eda/src/lib/notebook/EdaNotebook.css @@ -0,0 +1,116 @@ +.EdaNotebook { + .Heading { + display: flex; + gap: 2em; + align-items: baseline; + } + + .Paper { + /* A4 dimensions */ + --paper-width: 2480px; + --paper-height: 3508px; + --paper-scale: 0.5; + + width: calc(var(--paper-width) * var(--paper-scale)); + /* height: calc(var(--paper-height) * var(--paper-scale)); */ + + padding: 2em; + margin: 1em auto; + + /* background-color: #f3f3f3; */ + box-shadow: 0 0 2px #b5b5b5; + + > * + * { + margin-block-start: 1rem; + } + + .Heading { + display: flex; + flex-direction: row; + justify-content: space-between; + gap: 0.5em; + + h1 { + padding: 0; + font-size: 1.75em; + } + + h2 { + font-size: 1em; + font-weight: bold; + padding: 0.25em 0.5em; + color: var(--coreui-color-primary, black); + border: 2px solid; + border-radius: 0.25em; + background-color: color-mix( + in srgb, + var(--coreui-color-primary) 5%, + transparent + ); + } + } + + > details { + border: 1px solid; + border-color: color-mix( + in srgb, + var(--coreui-color-primary) 30%, + transparent + ); + border-top-left-radius: 0.5em; + border-top-right-radius: 0.5em; + border-bottom-left-radius: 0.5em; + border-bottom-right-radius: 0.5em; + + > summary { + padding: 0.75em; + cursor: pointer; + font-size: 1.2em; + font-weight: 500; + background-color: color-mix( + in srgb, + var(--coreui-color-primary) 10%, + transparent + ); + + &:hover { + background-color: color-mix( + in srgb, + var(--coreui-color-primary) 20%, + transparent + ); + } + + &:active { + background-color: color-mix( + in srgb, + var(--coreui-color-primary) 15%, + transparent + ); + } + + transition: background-color 100ms ease-in; + } + + &[open] > summary { + border-bottom: 1px solid; + border-color: color-mix( + in srgb, + var(--coreui-color-primary) 30%, + transparent + ); + } + + > div { + padding: 1em; + } + } + } + + .Title { + fieldset { + padding: 0; + margin: 0; + } + } +} diff --git a/packages/libs/eda/src/lib/notebook/EdaNotebook.scss b/packages/libs/eda/src/lib/notebook/EdaNotebook.scss deleted file mode 100644 index 0f0a50c61b..0000000000 --- a/packages/libs/eda/src/lib/notebook/EdaNotebook.scss +++ /dev/null @@ -1,35 +0,0 @@ -.EdaNotebook { - .Heading { - display: flex; - gap: 2em; - align-items: baseline; - } - - .Paper { - max-width: 1250px; - padding: 1em; - margin: 1em auto; - background-color: #f3f3f3; - box-shadow: 0 0 2px #b5b5b5; - - > * + * { - margin-block-start: 1rem; - } - h2, - h3 { - padding: 0; - } - h3 { - font-size: 1em; - font-weight: 400; - line-height: 1.5; - } - } - - .Title { - fieldset { - padding: 0; - margin: 0; - } - } -} diff --git a/packages/libs/eda/src/lib/notebook/EdaNotebookAnalysis.tsx b/packages/libs/eda/src/lib/notebook/EdaNotebookAnalysis.tsx index 327a3a7a20..6cb8f53d72 100644 --- a/packages/libs/eda/src/lib/notebook/EdaNotebookAnalysis.tsx +++ b/packages/libs/eda/src/lib/notebook/EdaNotebookAnalysis.tsx @@ -18,7 +18,7 @@ import { ExpandablePanel } from '@veupathdb/coreui'; import { NotebookCell as NotebookCellType } from './Types'; import { NotebookCell } from './NotebookCell'; -import './EdaNotebook.scss'; +import './EdaNotebook.css'; interface NotebookSettings { /** Ordered array of notebook cells */ @@ -70,30 +70,26 @@ export function EdaNotebookAnalysis(props: Props) { ); return (
-
-

EDA Notebook

-
-
-

+
+

-

-

Study: {safeHtml(studyRecord.displayName)}

+

+

{safeHtml(studyRecord.displayName)}

{notebookSettings.cells.map((cell, index) => ( - -
- updateCell(update, index)} - /> -
-
+
+ {cell.title} + updateCell(update, index)} + /> +
))}