OtherNodes.vue 1.37 KB
Newer Older
Adam Procter's avatar
Adam Procter committed
1
<template>
Adam Procter's avatar
Adam Procter committed
2
3
4
5
  <div
    class="nodes"
    v-for="(nodes, index) in otherNodes.otherNodes"
    :key="index"
Adam Procter's avatar
Adam Procter committed
6
7
8
    :style="{
      backgroundColor: nodes.node_color,
    }"
Adam Procter's avatar
Adam Procter committed
9
  >
Adam Procter's avatar
Adam Procter committed
10
11
12
13
14
    <p
      class="readmode"
      :id="nodes.node_id"
      v-html="marked(nodes.node_text)"
    ></p>
Adam Procter's avatar
Adam Procter committed
15
16
17
18
19
20
  </div>
</template>

<script>
// @ is an alias to /src
import { mapState } from 'vuex'
Adam Procter's avatar
Adam Procter committed
21
import marked from 'marked'
Adam Procter's avatar
Adam Procter committed
22
23
24
25
26
27
28
29
30
31
32

export default {
  name: 'OtherNodes',

  computed: {
    ...mapState({
      otherNodes: (state) => state.otherNodes,
    }),
  },

  mounted() {
33
    this.$store.dispatch('getOthernodes')
Adam Procter's avatar
Adam Procter committed
34
    setTimeout(this.loadData, 500)
Adam Procter's avatar
Adam Procter committed
35
    setInterval(this.loadData, 5000)
Adam Procter's avatar
Adam Procter committed
36
37
38
39
  },

  methods: {
    loadData() {
40
      this.$store.dispatch('setOthernodes')
Adam Procter's avatar
Adam Procter committed
41
    },
Adam Procter's avatar
Adam Procter committed
42
    marked,
Adam Procter's avatar
Adam Procter committed
43
44
45
46
  },
}
</script>

Adam Procter's avatar
Adam Procter committed
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<style>
h1 {
  margin: 0em;
  padding: 0em;
  font-size: 4.2em;
  font-family: houschka-rounded, sans-serif;
  font-weight: 700;
  font-style: normal;
  color: black;
}

h2 {
  margin: 0em;
  padding: 0em;
  font-size: 3.2em;
  font-family: houschka-rounded, sans-serif;
  font-weight: 700;
  font-style: normal;
  color: black;
}

h3 {
  margin: 0em;
  padding: 0em;
  font-size: 2.2em;
  font-family: houschka-rounded, sans-serif;
  font-weight: 700;
  font-style: normal;
  color: black;
}

Adam Procter's avatar
Adam Procter committed
78
79
80
81
82
83
.nodes {
  width: 95%;
  background-color: rgb(155, 194, 216);
  margin-top: 1em;
  margin-left: 0.5em;
}
Adam Procter's avatar
Adam Procter committed
84
85
86
img {
  width: 45%;
}
Adam Procter's avatar
Adam Procter committed
87
</style>