forked from mdl29/scratchy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathactivity_bar.html
36 lines (36 loc) · 1.25 KB
/
activity_bar.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
<html>
<head>
<script src="https://unpkg.com/vue@next"></script>
<link rel="stylesheet" href="css/global.css">
<link rel="stylesheet" href="css/activity_bar.css">
</head>
<body>
<div id="app">
<activity-bar v-bind:current-room="currentRoom.title" v-bind:is-writing="isWriting"></activity-bar>
</div>
<script>
const activityBar = {
name: "activity-bar",
props: ["currentRoom", "isWriting"],
template: `
<div class='activity_bar'>
<div class='activity_bar_room'>{{currentRoom}}</div>
<div v-if="isWriting" class='activity_bar_writing'> writing... </div>
</div>`
};
const app = Vue.createApp({
name: "app",
data: () => ({
currentRoom: {
"title": "current room's title"
}
}),
computed: {
isWriting: () => Math.floor(new Date().getTime() / 1000) % 2 == 0
},
});
app.component("activity-bar", activityBar);
app.mount("#app");
</script>
</body>
</html>