diff --git a/playground/src/main.ts b/playground/src/main.ts index 4356051..97c0f8d 100644 --- a/playground/src/main.ts +++ b/playground/src/main.ts @@ -16,6 +16,10 @@ import { deflate } from "./deflate.ts"; import { inflate } from "./inflate.ts"; import { IPC } from "./ipc.ts"; import helpText from "./help.md?raw"; +import share from "./share.svg" +import share_light from "./share_light.svg" +import play from "./play.svg" +import play_light from "./play_light.svg" let topData: undefined | TopData; @@ -357,13 +361,7 @@ preload.then(() => { } }); -function EditWrap({ - vertical, - toggle, -}: { - vertical: boolean; - toggle: () => void; -}) { +function EditWrap() { const options = state.files.value.map((value) => h("option", { value }, value) ); @@ -376,14 +374,6 @@ function EditWrap({ } }; - const char = vertical ? "↕" : "↔" - - // let d = vertical - // ? "M0 0 h20 v20 h-20 z M0 10 h20" - // : "M0 0 h20 v20 h-20 z M10 0 v20"; - // let play = "M0 0 L20 10 L0 20 z"; - // let svg = (d: string) => - // h("svg", { width: 20, height: 20, className: "icon" }, h("path", { d })); return h( "div", { className: "tabPanel left" }, @@ -397,10 +387,10 @@ function EditWrap({ options ), h("div", { style: { flex: "1 1" } }), - h("button", { onClick: copyToClipboard, title: "copy url" }, "📋"), - h("button", { onClick: runOutput, title: "run program" }, "▶"), - h("button", { onClick: toggle, title: "change layout" }, char), - // h("button", { onClick: toggle }, svg(d)) + h("div", {}, + h("button", { onClick: copyToClipboard, title: "copy url" }, h('img', {src: state.dark.value ? share : share_light})), + h("button", { onClick: runOutput, title: "run program" }, h('img', {src: state.dark.value ? play : play_light})), + ) ), h("div", { className: "tabBody" }, h(Editor, { initialValue: value })) ); @@ -416,12 +406,12 @@ function App() { if (state.toast.value) { toast = h("p", { className: "toast" }, h("div", {}, state.toast.value)); } - let className = `wrapper ${vertical ? "vertical" : "horizontal"}`; + let className = `wrapper`; return h( "div", { className }, toast, - h(EditWrap, { vertical, toggle }), + h(EditWrap, {}), h(Tabs, {}) ); } diff --git a/playground/src/play.svg b/playground/src/play.svg new file mode 100644 index 0000000..965be2c --- /dev/null +++ b/playground/src/play.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/playground/src/play_light.svg b/playground/src/play_light.svg new file mode 100644 index 0000000..47a9e72 --- /dev/null +++ b/playground/src/play_light.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/playground/src/share.svg b/playground/src/share.svg new file mode 100644 index 0000000..11c547d --- /dev/null +++ b/playground/src/share.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/playground/src/share_light.svg b/playground/src/share_light.svg new file mode 100644 index 0000000..a3e5cc9 --- /dev/null +++ b/playground/src/share_light.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/playground/style.css b/playground/style.css index 575f3e3..3475afd 100644 --- a/playground/style.css +++ b/playground/style.css @@ -53,29 +53,34 @@ svg.icon path { #editor { height: 100%; } -.wrapper.horizontal { + +.wrapper { display: flex; flex-direction: row; height: 100%; } -.wrapper.horizontal > div { - flex: 1 1; - /* allow smaller than natural */ - width: 100px; +@media (width >= 1024px) { + .wrapper > div { + flex: 1 1; + /* allow smaller than natural */ + width: 100px; + } } -.wrapper.vertical { - display: flex; - flex-direction: column; - height: 100%; -} -.wrapper.vertical .tabPanel.left { - /* designed to go down to the keyboard on my phone */ - flex: .65 .65; - height: 100px; -} -.wrapper.vertical .tabPanel.right { - flex: .35 .35; - height: 100px; + +@media (width <=1024px) { + .wrapper { + flex-direction: column; + } + .wrapper .tabPanel.left { + /* designed to go down to the keyboard on my phone */ + flex: .65 .65; + height: 100px; + } + + .wrapper .tabPanel.right { + flex: .35 .35; + height: 100px; + } } .tabBar button { border: none;