Make hello easy

This commit is contained in:
frostime 2023-05-20 12:43:50 +08:00
parent 82928ab218
commit 9f219c725d
3 changed files with 20 additions and 23 deletions

View file

@ -8,6 +8,7 @@
import { showMessage } from "siyuan"; import { showMessage } from "siyuan";
export let name: string; export let name: string;
export let i18n: any; export let i18n: any;
export let opendCount: number;
let time; let time;
let ver; let ver;
@ -19,7 +20,7 @@
let intv2 = setInterval(async () => { let intv2 = setInterval(async () => {
ver = await version(); ver = await version();
showMessage( showMessage(
`Hello ${name} v${ver}`, `[${opendCount}] Hello ${name} v${ver}`,
5000 5000
); );
}, 10000); }, 10000);
@ -45,26 +46,15 @@
<div id="hello"> <div id="hello">
<div class="fn__flex"> <div class="fn__flex">
<div class="fn__flex-1"> <div class="fn__flex-1">
<h2>Hello {name} v{ver}</h2> <h2>[{opendCount}] Hello {name} v{ver}</h2>
</div> </div>
<div class="fn__flex-1 b3-label__text __text-alignright"> <div class="fn__flex-1 b3-label__text __text-right">
{time_str} {time_str}
</div> </div>
</div> </div>
<br /> <div>
<p>{@html i18n.makesure}</p>
<div class="fn__flex-column">
<div class="fn__flex-1">
<ul class="b3-list b3-list--background">
<li class="b3-list-item">
<span class="b3-list-item__text">
{@html i18n.makesure}
</span>
</li>
</ul>
</div>
<div class="fn__space-column"></div>
</div> </div>
</div> </div>
@ -72,13 +62,11 @@
<style lang="scss"> <style lang="scss">
#hello { #hello {
margin: 20px; margin: 20px;
div {
margin-bottom: 10px;
}
} }
.__text-alignright { .__text-right {
text-align: right; text-align: right;
} }
.fn__space-column {
height: 8px;
display: inline-block;
flex-shrink: 0;
}
</style> </style>

View file

@ -54,7 +54,8 @@ export default class SamplePlugin extends Plugin {
let hello = new Hello({ let hello = new Hello({
target: dialog.element.querySelector("#helloPanel"), target: dialog.element.querySelector("#helloPanel"),
props: { props: {
name: `[${this.counter.hello}]${this.i18n.name}`, name: this.i18n.name,
opendCount: this.counter.hello,
i18n: this.i18n.hello i18n: this.i18n.hello
} }
}); });

8
src/libs/b3-list.svelte Normal file
View file

@ -0,0 +1,8 @@
<ul class="b3-list b3-list--background">
<li class="b3-list-item">
<svg class="b3-list-item__graphic"><use xlink:href="#iconEdit"></use></svg>
<span class="b3-list-item__text">
<slot></slot>
</span>
</li>
</ul>