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.

Update hover area to extend left and right (#15)

Myles Scolnick4c81e5f654ee
diff --git a/frontend/src/css/Cell.css b/frontend/src/css/Cell.css
index 2c9b258773..2db7b4ab26 100644
--- a/frontend/src/css/Cell.css
+++ b/frontend/src/css/Cell.css
@@ -84,15 +84,29 @@
border-bottom-right-radius: 10px;
}
-.tray::before {
- /* expand the hover area */
+:root {
+ /* In wide mode, this will overextend, but that's fine */
+ --gutter-width: calc(50vw - (var(--content-width) / 2));
+}
+
+/* expand the hover area left and right */
+.tray::before,
+.tray::after {
content: "";
position: absolute;
- width: 2000px;
- left: -1000px;
+ width: var(--gutter-width);
+ max-width: var(--gutter-width);
height: 100%;
}
+.tray::before {
+ left: calc(var(--gutter-width) * -1);
+}
+
+.tray::after {
+ right: calc(var(--gutter-width) * -1);
+}
+
/* -------------------------- Shoulders/Buttons ---------------------------- */
.Cell .shoulder-left {
position: absolute;
@@ -102,6 +116,7 @@
gap: 4px;
justify-content: center;
height: 100%;
+ z-index: 2;
}
.shoulder-elem-top {
@@ -124,13 +139,14 @@
position: absolute;
right: -98px;
width: 80px;
+ z-index: 2;
}
.Cell .shoulder-bottom {
position: absolute;
bottom: -2px;
right: 2px;
- z-index: 1; /* lie above editor */
+ z-index: 2; /* lie above editor */
}
/* --------------------------- Status Indicators ---------------------------- */
diff --git a/frontend/src/editor/renderers/CellArray.tsx b/frontend/src/editor/renderers/CellArray.tsx
index 3cfbe49c04..229282a1d3 100644
--- a/frontend/src/editor/renderers/CellArray.tsx
+++ b/frontend/src/editor/renderers/CellArray.tsx
@@ -96,47 +96,48 @@ export const CellArray: React.FC<CellArrayProps> = ({
}, [cells.present, cells.scrollKey, scrollToTarget]);
return (
- <div
- className={cn(
- "m-auto pb-12",
- appConfig.width === "full" && "px-24",
- appConfig.width !== "full" && "max-w-contentWidth",
- // Hide the cells for a fake loading effect, to avoid flickering
- invisible && "invisible"
- )}
- >
- {cells.present.map((cell) => (
- <Cell
- key={cell.key.toString()}
- theme={theme}
- showPlaceholder={cells.present.length === 1}
- allowFocus={!invisible}
- cellId={cell.key}
- initialContents={cell.initialContents}
- output={cell.output}
- consoleOutputs={cell.consoleOutputs}
- status={cell.status}
- updateCellCode={updateCellCode}
- prepareCellForRun={prepareForRun}
- edited={cell.edited}
- interrupted={cell.interrupted}
- errored={cell.errored}
- stopped={cell.stopped}
- runElapsedTimeMs={cell.runElapsedTimeMs}
- registerRunStart={registerRunStart}
- serializedEditorState={cell.serializedEditorState}
- showDeleteButton={cells.present.length > 1}
- createNewCell={createNewCell}
- deleteCell={onDeleteCell}
- focusCell={focusCell}
- moveToNextCell={moveToNextCell}
- moveCell={moveCell}
- editing={mode === "edit"}
- appClosed={connStatus.state !== WebSocketState.OPEN}
- ref={cell.ref}
- userConfig={userConfig}
- />
- ))}
+ <div className="px-18">
+ <div
+ className={cn(
+ "m-auto pb-12",
+ appConfig.width !== "full" && "max-w-contentWidth",
+ // Hide the cells for a fake loading effect, to avoid flickering
+ invisible && "invisible"
+ )}
+ >
+ {cells.present.map((cell) => (
+ <Cell
+ key={cell.key.toString()}
+ theme={theme}
+ showPlaceholder={cells.present.length === 1}
+ allowFocus={!invisible}
+ cellId={cell.key}
+ initialContents={cell.initialContents}
+ output={cell.output}
+ consoleOutputs={cell.consoleOutputs}
+ status={cell.status}
+ updateCellCode={updateCellCode}
+ prepareCellForRun={prepareForRun}
+ edited={cell.edited}
+ interrupted={cell.interrupted}
+ errored={cell.errored}
+ stopped={cell.stopped}
+ runElapsedTimeMs={cell.runElapsedTimeMs}
+ registerRunStart={registerRunStart}
+ serializedEditorState={cell.serializedEditorState}
+ showDeleteButton={cells.present.length > 1}
+ createNewCell={createNewCell}
+ deleteCell={onDeleteCell}
+ focusCell={focusCell}
+ moveToNextCell={moveToNextCell}
+ moveCell={moveCell}
+ editing={mode === "edit"}
+ appClosed={connStatus.state !== WebSocketState.OPEN}
+ ref={cell.ref}
+ userConfig={userConfig}
+ />
+ ))}
+ </div>
</div>
);
};
diff --git a/frontend/tailwind.config.js b/frontend/tailwind.config.js
index 7bc716bfe0..0c4111ee20 100644
--- a/frontend/tailwind.config.js
+++ b/frontend/tailwind.config.js
@@ -36,6 +36,9 @@ module.exports = {
maxWidth: {
contentWidth: "var(--content-width)",
},
+ padding: {
+ 18: "4.5rem",
+ },
colors: {
border: "hsl(var(--border) / <alpha-value>)",
input: "hsl(var(--input) / <alpha-value>)",
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index a17e25fc63..11bfb4c1fa 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -12,7 +12,7 @@ const htmlDevPlugin = (): Plugin => {
.replace(`{{ filename }}`, `dev-mode`)
.replace(`{{ mode }}`, `"edit"`)
.replace(
- `{{ config }}`,
+ `{{ user_config }}`,
JSON.stringify({
completion: {
activate_on_typing: false,
@@ -23,6 +23,7 @@ const htmlDevPlugin = (): Plugin => {
},
})
)
+ .replace(`{{ app_config }}`, JSON.stringify({}))
.replace(`{{ title }}`, `dev-mode`);
},
};