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: setup cell (#7778)

Akshay Agrawal52a3f3807317
diff --git a/frontend/src/components/editor/notebook-cell.tsx b/frontend/src/components/editor/notebook-cell.tsx
index 8fa5dc347f..fca5e0f1f8 100644
--- a/frontend/src/components/editor/notebook-cell.tsx
+++ b/frontend/src/components/editor/notebook-cell.tsx
@@ -585,7 +585,7 @@ const EditableCellComponent = ({
className={cn(
className,
navigationProps.className,
- "focus:ring-1 focus:ring-(--slate-7) focus:ring-offset-2",
+ "focus:ring-1 focus:ring-(--slate-8) focus:ring-offset-2",
)}
ref={cellContainerRef}
{...cellDomProps(cellId, cellData.name)}
@@ -1032,16 +1032,12 @@ const SetupCellComponent = ({
const hasConsoleOutput = cellRuntime.consoleOutputs.length > 0;
const isErrorOutput = isErrorMime(cellRuntime.output?.mimetype);
- const className = clsx(
- "marimo-cell",
- "hover-actions-parent z-10 border shadow-sm",
- "border-(--blue-5)! rounded-sm!",
- {
- "needs-run": needsRun,
- "has-error": cellRuntime.errored,
- stopped: cellRuntime.stopped,
- },
- );
+ const className = clsx("marimo-cell", "hover-actions-parent z-10", {
+ interactive: true,
+ "needs-run": needsRun,
+ "has-error": cellRuntime.errored,
+ stopped: cellRuntime.stopped,
+ });
const handleRefactorWithAI: OnRefactorWithAI = useEvent(
(opts: { prompt: string; triggerImmediately: boolean }) => {
@@ -1076,7 +1072,7 @@ const SetupCellComponent = ({
{...mergeProps(navigationProps, {
className: cn(
className,
- "focus:ring-1 focus:ring-(--blue-7) focus:ring-offset-0",
+ "focus:ring-1 focus:ring-(--slate-8) focus:ring-offset-2",
),
onBlur: closeCompletionHandler,
onKeyDown: resumeCompletionHandler,
@@ -1086,7 +1082,11 @@ const SetupCellComponent = ({
tabIndex={-1}
data-setup-cell={true}
>
- <div className={cn("tray")} data-hidden={!isCellCodeShown}>
+ <div
+ className={cn("tray")}
+ data-has-output-above={false}
+ data-hidden={!isCellCodeShown}
+ >
<StagedAICellBackground
cellId={cellId}
className="mo-ai-setup-cell"
diff --git a/frontend/src/core/cells/cells.ts b/frontend/src/core/cells/cells.ts
index 630864b1c9..39234a5ac3 100644
--- a/frontend/src/core/cells/cells.ts
+++ b/frontend/src/core/cells/cells.ts
@@ -1325,10 +1325,7 @@ const {
};
},
addSetupCellIfDoesntExist: (state, action: { code?: string }) => {
- let { code } = action;
- if (code == null) {
- code = "# Initialization code that runs before all other cells";
- }
+ const { code } = action;
if (state.cellIds.setupCellExists()) {
// Just focus on the existing setup cell
diff --git a/frontend/src/css/app/Cell.css b/frontend/src/css/app/Cell.css
index a6852c590f..5b0e49222f 100644
--- a/frontend/src/css/app/Cell.css
+++ b/frontend/src/css/app/Cell.css
@@ -319,6 +319,12 @@
}
}
+#cell-setup,
+#cell-setup .cm-editor,
+#cell-setup .cm-gutter {
+ background-color: var(--gray-2);
+}
+
#App.disconnected {
/* Background determined by disconnected gradient/noise. */