Skip to content

Commit 2c9d246

Browse files
committed
tweak UI
1 parent 493627d commit 2c9d246

File tree

3 files changed

+39
-9
lines changed

3 files changed

+39
-9
lines changed

packages/repl/src/lib/Output/Output.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@
112112
{#if embedded}
113113
<Editor workspace={js_workspace} />
114114
{:else}
115-
<PaneWithPanel pos="50%" max="-4.2rem" panel="Compiler options">
115+
<PaneWithPanel pos="-18rem" panel="Compiler options">
116116
<div slot="main">
117117
<Editor workspace={js_workspace} />
118118
</div>

packages/repl/src/lib/Output/PaneWithPanel.svelte

Lines changed: 37 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,13 @@
88
99
export let pos: Length = '90%';
1010
11-
$: previous_pos = Math.min(+pos.replace(UNIT_REGEX, '$1'), 70);
11+
$: previous_pos = Math.min(normalize(pos), 70);
1212
13-
export let max: Length = '90%';
13+
export let max: Length = '-4.2rem';
1414
1515
// we can't bind to the spring itself, but we
1616
// can still use the spring to drive `pos`
17-
const driver = spring(+pos.replace(UNIT_REGEX, '$1'), {
17+
const driver = spring(normalize(pos), {
1818
stiffness: 0.2,
1919
damping: 0.5
2020
});
@@ -23,7 +23,7 @@
2323
$: pos = $driver + '%';
2424
2525
const toggle = () => {
26-
const numeric_pos = +pos.replace(UNIT_REGEX, '$1');
26+
let numeric_pos = normalize(pos);
2727
2828
driver.set(numeric_pos, { hard: true });
2929
@@ -34,6 +34,16 @@
3434
driver.set(100);
3535
}
3636
};
37+
38+
function normalize(pos: string) {
39+
let normalized = +pos.replace(UNIT_REGEX, '$1');
40+
41+
if (normalized < 0) {
42+
normalized += 100;
43+
}
44+
45+
return normalized;
46+
}
3747
</script>
3848

3949
<SplitPane {max} min="10%" type="vertical" bind:pos>
@@ -46,8 +56,23 @@
4656
{#snippet b()}
4757
<section>
4858
<div class="panel-header">
49-
<button class="panel-heading" on:click={toggle}>{panel}</button>
50-
<slot name="panel-header" />
59+
<button class="panel-heading raised" on:click={toggle}>
60+
<svg
61+
width="1.8rem"
62+
height="1.8rem"
63+
viewBox="0 0 24 24"
64+
fill="none"
65+
stroke="currentColor"
66+
stroke-width="2"
67+
stroke-linecap="round"
68+
stroke-linejoin="round"
69+
>
70+
<path d="m7 15 5 5 5-5" />
71+
<path d="m7 9 5-5 5 5" />
72+
</svg>
73+
74+
{panel}
75+
</button>
5176
</div>
5277

5378
<div class="panel-body">
@@ -74,8 +99,13 @@
7499
.panel-heading {
75100
font: var(--sk-font-ui-small);
76101
text-transform: uppercase;
77-
flex: 1;
102+
height: 3.2rem;
103+
padding: 0 0.8rem;
104+
/* flex: 1; */
78105
text-align: left;
106+
display: flex;
107+
align-items: center;
108+
gap: 0.4rem;
79109
}
80110
81111
section {

packages/repl/src/lib/Output/Viewer.svelte

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@
300300

301301
<div class="iframe-container">
302302
{#if !onLog}
303-
<PaneWithPanel pos="100%" max="-4.2rem" panel="DevTools">
303+
<PaneWithPanel pos="100%" panel="DevTools">
304304
<div slot="main">
305305
{@render main()}
306306
</div>

0 commit comments

Comments
 (0)