/
index.js
45 lines (39 loc) · 836 Bytes
/
index.js
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
37
38
39
40
41
42
43
44
45
'use strict'
require('./style.css')
const render = require('brisky/render')
const mentionable = require('../lib')
const createState = require('vigour-state/s')
// This is the data for the suggestions
const state = global.state = createState({
people: {
val: require('./data.json')
}
})
const description = "Just start typing a person's name or username and get suggestions!"
const app = global.app = {
// Types
types: {
mentionable
},
// Elements
component: {
type: 'mentionable',
class: 'component',
input: {
tag: 'textarea',
props: {
autofocus: true,
placeholder: 'Enter a name'
}
},
data: {
$: 'people'
}
},
description: {
class: 'description',
tag: 'p',
text: description
}
}
document.body.appendChild(render(app, state))