Skip to content

Commit 27c4c12

Browse files
authored
stylize output box options (#336)
1 parent 0b92149 commit 27c4c12

File tree

1 file changed

+48
-35
lines changed

1 file changed

+48
-35
lines changed

ui/src/components/nodes/Code.tsx

Lines changed: 48 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,15 @@ function Timer({ lastExecutedAt }) {
7272
}, 1000);
7373
return () => clearInterval(interval);
7474
}, [counter]);
75-
return <Box>Last executed: {timeDifference(new Date(), lastExecutedAt)}</Box>;
75+
return (
76+
<Box
77+
sx={{
78+
padding: "5px",
79+
}}
80+
>
81+
Last run: {timeDifference(new Date(), lastExecutedAt)}
82+
</Box>
83+
);
7684
}
7785

7886
export const ResultBlock = memo<any>(function ResultBlock({ id, layout }) {
@@ -173,14 +181,17 @@ export const ResultBlock = memo<any>(function ResultBlock({ id, layout }) {
173181
borderImage: "initial",
174182
borderTopLeftRadius: "20px",
175183
borderTopRightRadius: "20px",
184+
// FIXME: Why not a complete oval?
185+
// borderBottomLeftRadius: "20px",
186+
// borderBottomRightRadius: "20px",
176187
display: "flex",
177188
fontSize: "0.8em",
178189
}}
179190
>
180191
<CheckCircleIcon
181192
style={{ marginTop: "5px" }}
182193
fontSize="inherit"
183-
/>
194+
/>{" "}
184195
<Timer lastExecutedAt={lastExecutedAt} />
185196
</Box>
186197
</Box>
@@ -205,51 +216,55 @@ export const ResultBlock = memo<any>(function ResultBlock({ id, layout }) {
205216
{(stdout || (result?.text && result?.count > 0) || error) &&
206217
showMenu && (
207218
<ButtonGroup
208-
sx={[
209-
{
210-
fontSize: "0.8em",
211-
paddingTop: "3px",
212-
paddingBottom: "2px",
213-
lineHeight: "10px",
214-
zIndex: 201,
215-
position: "absolute",
216-
top: "-64.5px",
217-
right: "15px",
218-
"& .MuiButton-root": {
219-
fontSize: ".9em",
220-
paddingTop: 0,
221-
paddingBottom: 0,
222-
},
223-
},
224-
]}
225-
variant="outlined"
219+
sx={{
220+
// border: '1px solid #757ce8',
221+
fontSize: "0.8em",
222+
backgroundColor: "white",
223+
zIndex: 201,
224+
position: "absolute",
225+
top: "10px",
226+
right: "25px",
227+
// "& .MuiButton-root": {
228+
// fontSize: ".9em",
229+
// paddingTop: 0,
230+
// paddingBottom: 0,
231+
// },
232+
}}
233+
variant="contained"
234+
size="small"
226235
aria-label="outlined primary button group"
227-
orientation="vertical"
236+
// orientation="vertical"
228237
>
238+
<Box
239+
sx={{
240+
color: "primary.main",
241+
fontWeight: "bold",
242+
display: "flex",
243+
padding: "5px 5px",
244+
alignItems: "center",
245+
justifyContent: "center",
246+
}}
247+
>
248+
Output options:
249+
</Box>
229250
<Button
230251
onClick={() => {
231252
setResultScroll(!resultScroll);
232253
}}
233-
variant="text"
234-
size="small"
235254
>
236255
{resultScroll ? "Unfocus" : "Focus"}
237256
</Button>
238257
<Button
239258
onClick={() => {
240259
setShowOutput(!showOutput);
241260
}}
242-
variant="text"
243-
size="small"
244261
>
245262
Hide
246263
</Button>
247264
<Button
248265
onClick={() => {
249266
clearResults(id);
250267
}}
251-
variant="text"
252-
size="small"
253268
>
254269
Clear
255270
</Button>
@@ -292,10 +307,10 @@ export const ResultBlock = memo<any>(function ResultBlock({ id, layout }) {
292307
) : (
293308
<Box
294309
sx={{
295-
paddingBottom: "5px",
310+
padding: "10px",
296311
display: "flex",
297312
justifyContent: "center",
298-
alignItems: "center",
313+
alignItems: "bottom",
299314
}}
300315
>
301316
<Box
@@ -306,23 +321,21 @@ export const ResultBlock = memo<any>(function ResultBlock({ id, layout }) {
306321
paddingTop: "2px",
307322
}}
308323
>
309-
This output has been hidden.{" "}
324+
Output hidden.{" "}
310325
</Box>
311326
<Button
312327
onClick={() => {
313328
setShowOutput(!showOutput);
314329
}}
315330
sx={{
316331
fontSize: "0.8em",
317-
paddingTop: "3px",
318-
paddingBottom: "2px",
319-
lineHeight: "10px",
332+
// lineHeight: "8px",
320333
zIndex: 201,
321334
}}
322335
size="small"
323-
variant="text"
336+
variant="contained"
324337
>
325-
Show it
338+
Reveal
326339
</Button>
327340
</Box>
328341
)}

0 commit comments

Comments
 (0)