Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

style variables table and chrome (#152)

Akshay Agrawal8a90f591e76a
diff --git a/Makefile b/Makefile
index e192ced7c8..fa744106ce 100644
--- a/Makefile
+++ b/Makefile
@@ -87,6 +87,9 @@ install-all: fe py
wheel:
python -m build
+.PHONY: storybook
+storybook:
+ cd frontend; pnpm storybook
.PHONY: docs
# build docs
diff --git a/frontend/src/components/variables/variables-table.tsx b/frontend/src/components/variables/variables-table.tsx
index 4e7bae7e53..f5436373d1 100644
--- a/frontend/src/components/variables/variables-table.tsx
+++ b/frontend/src/components/variables/variables-table.tsx
@@ -42,7 +42,7 @@ export const VariableTable: React.FC<Props> = memo(
return (
<Table className={cn("w-full overflow-hidden text-sm flex-1", className)}>
<TableHeader>
- <TableRow className="whitespace-nowrap text-xs">
+ <TableRow className="whitespace-nowrap text-xs hover:bg-accent">
<TableHead>Name</TableHead>
<TableHead>
<div className="flex flex-col gap-1">
@@ -60,7 +60,7 @@ export const VariableTable: React.FC<Props> = memo(
</TableHeader>
<TableBody>
{sortedVariables.map((variable) => (
- <TableRow key={variable.name}>
+ <TableRow key={variable.name} className="hover:bg-accent">
<TableCell
className="font-medium max-w-[130px]"
title={variable.name}
diff --git a/frontend/src/editor/chrome/wrapper/app-chrome.css b/frontend/src/editor/chrome/wrapper/app-chrome.css
index f0311b3a71..d77240eed7 100644
--- a/frontend/src/editor/chrome/wrapper/app-chrome.css
+++ b/frontend/src/editor/chrome/wrapper/app-chrome.css
@@ -1,23 +1,22 @@
.resize-handle,
.resize-handle-collapsed {
transition: 250ms linear background-color;
- background-color: var(--sage-3);
outline: none;
}
.resize-handle.horizontal,
.resize-handle-collapsed.horizontal {
- height: 3px;
+ height: 4px;
}
.resize-handle.vertical,
.resize-handle-collapsed.vertical {
- width: 3px;
+ width: 4px;
}
.resize-handle:hover,
.resize-handle[data-resize-handle-active],
.resize-handle-collapsed:hover,
.resize-handle-collapsed[data-resize-handle-active] {
- background-color: var(--sage-11);
+ background-color: var(--slate-11);
}
diff --git a/frontend/src/editor/chrome/wrapper/app-chrome.tsx b/frontend/src/editor/chrome/wrapper/app-chrome.tsx
index bf6f2cffe7..c69b56476f 100644
--- a/frontend/src/editor/chrome/wrapper/app-chrome.tsx
+++ b/frontend/src/editor/chrome/wrapper/app-chrome.tsx
@@ -55,6 +55,32 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
/>
);
+ const variablePane = (
+ <div className="flex flex-col h-full flex-1 overflow-hidden">
+ <div className="p-3 border-b flex justify-between items-center">
+ <div className="text-sm text-[var(--slate-11)] uppercase tracking-wide font-semibold flex-1">
+ Variables
+ </div>
+ <Button
+ className="m-0"
+ size="xs"
+ variant="text"
+ onClick={() => setIsOpen(false)}
+ >
+ <XIcon className="w-4 h-4" />
+ </Button>
+ </div>
+ {/* {selectedPanel === "errors" && <ErrorsPanel />} */}
+ {selectedPanel === "variables" && (
+ <VariableTable
+ className="flex-1"
+ cellIds={cellIds}
+ variables={variables}
+ />
+ )}
+ </div>
+ );
+
const helperPane = (
<Panel
ref={sidebarRef}
@@ -62,7 +88,11 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
key={`helper-${panelLocation}`}
collapsedSize={0}
collapsible={true}
- className="bg-[var(--sage-1)] no-print"
+ className={cn(
+ "bg-white dark:bg-[var(--slate-1)] rounded-lg no-print shadow-mdNeutral",
+ isOpen && "m-4",
+ isOpen && panelLocation === "bottom" && "mt-2"
+ )}
minSize={10}
// We can't make the default size greater than 0, otherwise it will start open
defaultSize={0}
@@ -75,34 +105,20 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
}}
onCollapse={(collapsed) => setIsOpen(!collapsed)}
>
- <div className="flex flex-col h-full flex-1">
- <div className="p-3 border-b flex justify-between items-center">
- <div className="text-sm font-medium text-[var(--sage-11)] uppercase tracking-wide font-semibold flex-1">
- Variables
- </div>
- <Button
- className="m-0"
- size="xs"
- variant="text"
- onClick={() => setIsOpen(false)}
- >
- <XIcon className="w-4 h-4" />
- </Button>
- </div>
- {/* {selectedPanel === "errors" && <ErrorsPanel />} */}
- {selectedPanel === "variables" && (
- <VariableTable
- className="flex-1"
- cellIds={cellIds}
- variables={variables}
- />
- )}
- </div>
+ {panelLocation === "left" ? (
+ <span className="flex flex-row h-full">
+ {variablePane} {resizeHandle}
+ </span>
+ ) : (
+ <span>
+ {resizeHandle} {variablePane}
+ </span>
+ )}
</Panel>
);
return (
- <div className="flex flex-col flex-1 overflow-hidden">
+ <div className="flex flex-col flex-1 overflow-hidden bg-white dark:bg-[var(--slate-1)]">
<PanelGroup
key={panelLocation}
autoSaveId={`marimo:chrome`}
@@ -110,7 +126,6 @@ export const AppChrome: React.FC<PropsWithChildren> = ({ children }) => {
storage={createStorage(panelLocation)}
>
{panelLocation === "left" ? helperPane : appBody}
- {resizeHandle}
{panelLocation === "left" ? appBody : helperPane}
</PanelGroup>
<Footer />
diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js
index bbd45a3fd4..381f961aba 100644
--- a/frontend/tailwind.config.js
+++ b/frontend/tailwind.config.js
@@ -32,6 +32,11 @@ module.exports = {
"5px 6px 0px 0px var(--tw-shadow-color, var(--base-shadow-darker)), 0 0px 4px 0px hsl(0deg 0% 75% / 5%)",
xlSolid:
"8px 9px 0px 0px var(--tw-shadow-color, var(--base-shadow-darker)), 0 0px 6px 0px hsl(0deg 0% 85% / 5%)",
+ // neutral shadows (used for cells, ...)
+ // TODO(akshayka): clean these up to use tw-shadow-color
+ smNeutral: "var(--light-shadow)",
+ mdNeutral: "var(--medium-shadow)",
+ lgNeutral: "var(--heavy-shadow)",
// error shadows
smError: "var(--light-shadow-error)",
},