UNPKG

1.72 kBHTMLView Raw
1<!DOCTYPE HTML>
2<html>
3 <head>
4 <meta charset="utf-8">
5 <link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/topcoat/0.8.0/css/topcoat-mobile-dark.css" />
6 <meta name="viewport" content="width=device-width, initial-scale=1">
7 <script src="../node_modules/react/dist/react-with-addons.js"></script>
8 <script src="../node_modules/react/dist/JSXTransformer.js"></script>
9 <script src="../dist/react-typeahead.js"></script>
10 </head>
11 <body>
12 <style>
13
14 #main {
15 width: 100%;
16 max-width: 600px;
17 margin: 0 auto;
18 }
19
20 h1 {
21 color: #F0F1F1;
22 }
23
24 a {
25 color: #288EDF;
26 }
27
28 .topcoat-text-input {
29 width: 100%;
30 }
31
32 li.hover {
33 background: #585858;
34 }
35
36 .topcoat-addme::before {
37 content: 'Add me: '
38 }
39
40 .topcoat-addme {
41 text-align: right;
42 }
43
44 </style>
45
46 <div id="main">
47 <h1>Topcoat + React.Tokenizer</h1>
48 <div id="typeahead"></div>
49 </div>
50
51 <script type="text/jsx">
52/** @jsx React.DOM */
53
54(function(){
55 var req = new XMLHttpRequest();
56 req.open('GET', 'files.txt');
57
58 req.onload = function() {
59 if (req.status !== 200) {
60 throw new Error('nope');
61 }
62
63 React.render(
64 <ReactTypeahead.Tokenizer
65 options={req.response.split('\n')}
66 allowCustomValues={4}
67 customClasses={{
68 typeahead: "topcoat-list",
69 input: "topcoat-text-input",
70 results: "topcoat-list__container",
71 listItem: "topcoat-list__item",
72 token: "topcoat-button",
73 customAdd: "topcoat-addme"
74 }} />,
75 document.getElementById("typeahead")
76 );
77 };
78
79 req.send();
80})()
81
82 </script>
83
84 </body>
85</html>
86
87