Skip to content

Commit db2ed11

Browse files
committed
[scramjet/demo] add url bar
1 parent 833189d commit db2ed11

File tree

1 file changed

+44
-4
lines changed
  • packages/scramjet/packages/demo/src

1 file changed

+44
-4
lines changed
Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,56 @@
11
import { controller } from ".";
2+
import { css, type Component } from "dreamland/core";
23

3-
export function App(cx) {
4+
export const App: Component<{ frameel: HTMLIFrameElement }> = function (cx) {
5+
let frame;
46
cx.mount = () => {
5-
let frame = controller.createFrame(this.frameel);
7+
frame = controller.createFrame(this.frameel);
68

79
frame.go("https://google.com");
810
};
911

1012
return (
1113
<div>
12-
scramjet
14+
<input
15+
on:change={(e) => {
16+
let url = (e.target as HTMLInputElement).value;
17+
frame.go(url);
18+
}}
19+
placeholder="Enter URL"
20+
/>
1321
<iframe this={use(this.frameel)}></iframe>
1422
</div>
1523
);
16-
}
24+
};
25+
26+
App.style = css`
27+
:scope {
28+
width: 100vw;
29+
height: 100vh;
30+
display: flex;
31+
flex-direction: column;
32+
margin: 0;
33+
overflow: hidden;
34+
position: absolute;
35+
top: 0;
36+
left: 0;
37+
38+
padding: 1em;
39+
background: black;
40+
box-sizing: border-box;
41+
}
42+
iframe {
43+
background: white;
44+
flex: 1;
45+
border: none;
46+
}
47+
input {
48+
box-sizing: border-box;
49+
width: 100%;
50+
padding: 0.5em;
51+
margin-bottom: 0.5em;
52+
font-size: 1em;
53+
border: 1px solid #ccc;
54+
border-radius: 4px;
55+
}
56+
`;

0 commit comments

Comments
 (0)