-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathweb-components-with-react.htm
More file actions
113 lines (99 loc) · 5.95 KB
/
web-components-with-react.htm
File metadata and controls
113 lines (99 loc) · 5.95 KB
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
46
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Web Component with React</title>
<link rel="stylesheet" href="https://d2xbd92kui7v97.cloudfront.net/site/css/getting-started.css">
<link rel="stylesheet" href="css/web-components-mixed.css">
</head>
<body>
<div id="root"></div>
<template id="loading-screen">
<h3 class="loading" data-i18n="Loading..."></h3>
</template>
<template id="error-screen">
<h3 class="error">Error - <span data-bind="errorMessage"></span></h3>
</template>
<!--
Templates for <image-gallery> and <data-view>
These cannot be included within JSX because both Babel and the jsxLoader
attempt to compile elements within <template> as child elements of the
template. Same issue happens if attempting to use <script type="text/x-template">
-->
<template id="image-template">
<image-gallery image="${image}" image-avif="${image_avif}" image-webp="${image_webp}">
<img src="${thumbnail}" alt="${title}" />
</image-gallery>
</template>
<template id="city-info">
<h2>${place.name}</h2>
<div class="population"><strong>Population:</strong> ${format.number(place.population)}</div>
</template>
<!--
React
https://reactjs.org
-->
<!--
<script src="https://cdn.jsdelivr.net/npm/react@17.0.2/umd/react.development.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/react-dom@17.0.2/umd/react-dom.development.js" crossorigin="anonymous"></script>
-->
<script src="https://cdn.jsdelivr.net/npm/react@17.0.2/umd/react.production.min.js" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/react-dom@17.0.2/umd/react-dom.production.min.js" crossorigin="anonymous"></script>
<!--
React Router
https://reacttraining.com/react-router/
https://github.com/ReactTraining/react-router
-->
<script src="https://cdn.jsdelivr.net/npm/react-router@5.2.0/umd/react-router.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/react-router-dom@5.2.0/umd/react-router-dom.min.js"></script>
<!--
DataFormsJS JSX Loader
https://www.dataformsjs.com
-->
<script src="https://cdn.jsdelivr.net/npm/dataformsjs@5/js/react/jsxLoader.min.js"></script>
<script>
// Set to `true` to view compiler details
jsxLoader.logCompileTime = false;
jsxLoader.logCompileDetails = false;
</script>
<!--
DataFormsJS React Components
-->
<!-- <script type="module" src="https://cdn.jsdelivr.net/npm/dataformsjs@5/js/react/es6/DataFormsJS.min.js"></script>
<script nomodule src="https://cdn.jsdelivr.net/npm/dataformsjs@5/js/react/es5/DataFormsJS.min.js"></script> -->
<script type="module" src="https://cdn.jsdelivr.net/npm/dataformsjs@5/js/react/es6/ErrorBoundary.min.js"></script>
<script nomodule src="https://cdn.jsdelivr.net/npm/dataformsjs@5/js/react/es5/ErrorBoundary.min.js"></script>
<!--
DataFormsJS Web Components
<url-router>, <i18n-service>, and <nav is="spa-links"> are excluded from
this page because they are not expected to work well with React.
<url-router> may work however it would overwrite large portions of the DOM
and <i18n-service> and <nav is="spa-links"> are dependant on <url-router>.
-->
<script type="module" src="https://cdn.jsdelivr.net/npm/dataformsjs@5/js/web-components/json-data.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/dataformsjs@5/js/web-components/data-list.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/dataformsjs@5/js/web-components/data-table.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/dataformsjs@5/js/web-components/data-view.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/dataformsjs@5/js/web-components/input-filter.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/dataformsjs@5/js/web-components/sortable-table.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/dataformsjs@5/js/web-components/image-gallery.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/dataformsjs@5/js/web-components/html-import-service.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/dataformsjs@5/js/web-components/leaflet-map.min.js"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/dataformsjs@5/js/web-components/markdown-content.min.js"></script>
<script nomodule src="https://cdn.jsdelivr.net/npm/dataformsjs@5/js/web-components/polyfill.min.js"></script>
<!-- https://leafletjs.com/ -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/leaflet@1.5.1/dist/leaflet.css">
<script src="https://cdn.jsdelivr.net/npm/leaflet@1.5.1/dist/leaflet.js"></script>
<!--
https://marked.js.org/
https://highlightjs.org/
-->
<script src="https://cdn.jsdelivr.net/npm/marked@3.0.8/lib/marked.min.js"></script>
<!-- <script src="https://cdn.jsdelivr.net/npm/marked@4.0.1/marked.min.js"></script> -->
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.1.2/build/styles/atom-one-dark.min.css">
<script src="https://cdn.jsdelivr.net/gh/highlightjs/cdn-release@10.1.2/build/highlight.min.js"></script>
<!-- App Code -->
<script type="text/babel" src="web-components-with-react.jsx"></script>
</body>
</html>