Skip to content

Commit 05c778d

Browse files
committed
tweak: counter view layout
1 parent 3eccdfd commit 05c778d

File tree

4 files changed

+9
-5
lines changed

4 files changed

+9
-5
lines changed

s/demo/demo.bundle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {CounterView} from "./views/counter.js"
66
$.render($(".demo"), DemoView())
77

88
$.register({
9-
DemoCounter: CounterView.component(100),
9+
DemoCounter: CounterView.component(1),
1010
})
1111

1212
console.log("🦝 sly")

s/demo/views/counter.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ export const CounterView = view(use => (initial: number) => {
2121
const increment = () => count(count() + 1)
2222

2323
return html`
24+
<slot></slot>
2425
<div>
2526
<span>${seconds()}</span>
2627
</div>
@@ -34,9 +35,12 @@ export const CounterView = view(use => (initial: number) => {
3435
const styles = css`
3536
:host {
3637
display: flex;
37-
flex-direction: column;
3838
justify-content: center;
39-
text-align: center;
39+
gap: 1em;
40+
}
41+
42+
button {
43+
padding: 0.2em 0.5em;
4044
}
4145
`
4246

s/demo/views/demo.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export const DemoView = view(use => () => {
1010
use.styles(cssReset, styles)
1111

1212
return html`
13-
${CounterView(10)}
13+
${CounterView.children("view")(2)}
1414
${LoadersView()}
1515
`
1616
})

s/index.html.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export default ssg.page(import.meta.url, async orb => ({
2929
<h1>sly testing page</h1>
3030
<p><a href="https://github.com/e280/sly">github.com/e280/sly</a></p>
3131
<p class=lil>v${orb.packageVersion()}</p>
32-
<demo-counter></demo-counter>
32+
<demo-counter>component</demo-counter>
3333
<div class=demo></div>
3434
`,
3535
}))

0 commit comments

Comments
 (0)