Skip to content

Commit 354c6c6

Browse files
committed
update examples
1 parent fad1f33 commit 354c6c6

File tree

8 files changed

+40
-44
lines changed

8 files changed

+40
-44
lines changed

examples/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
2+
# ![](viewer/react.svg) React examples
3+
4+
coming soon...

examples/get-started/README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
[![ActiveWidgets](http://www.activewidgets.com/include/logo/aw-logo-40.png?activewidgets/react)](http://www.activewidgets.com/)
2-
3-
## Get Started
41

52
A minimal example showing ActiveWidgets datagrid for React
63

examples/index.html

Lines changed: 4 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,11 @@
11
<!DOCTYPE html>
22
<html>
33
<head>
4-
<style>
5-
6-
* {
7-
box-sizing: border-box;
8-
}
9-
10-
html, body, #app {
11-
width: 100%;
12-
padding: 20px;
13-
margin: 0;
14-
box-sizing: border-box;
15-
font-family: "Segoe UI", "Helvetica Neue";
16-
font-size: 13px;
17-
}
18-
19-
.ax-headers-view {
20-
font-weight: bold;
21-
color: #666;
22-
border-bottom: 1px solid #aaa;
23-
}
24-
25-
.ax-gridlines {
26-
border-bottom: 1px solid #eee;
27-
}
28-
29-
.ax-row.selected {
30-
background: #f7eeff77;
31-
}
32-
33-
</style>
4+
<link href="https://fonts.googleapis.com/css?family=Montserrat:600|Nunito+Sans:400,700&display=swap" rel="stylesheet">
5+
<link href="https://www.activewidgets.com/favicon.ico" rel="shortcut icon">
346
</head>
357
<body>
36-
<div id="app"></div>
37-
<script src="./viewer/viewer.js"></script>
8+
<div id="app">Loading...</div>
9+
<script async src="./viewer/index.js"></script>
3810
</body>
3911
</html>

examples/index.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

examples/viewer/examples.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+

2+
import get_started from '../get-started/README.md';
3+
4+
5+
export const Local = {
6+
'Get started': {path: 'get-started', readme: get_started}
7+
};
8+
9+
10+
export * from '@activewidgets/datagrid/examples';
11+
Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,33 @@
11

22
import {Viewer} from '@activewidgets/examples';
33
import ReactDOM from 'react-dom';
4-
import * as pages from '../index.js';
54
import {h} from '../../';
5+
import * as pages from './examples.js';
6+
import readme from '../README.md';
7+
import logo from './react.svg';
8+
import pkg from '../../package.json';
9+
10+
11+
let framework = 'React',
12+
container = document.getElementById('app');
613

714

815
function mount(component, props){
9-
let container = document.getElementById('app');
1016
container.innerHTML = '';
1117
ReactDOM.render(h(component, props), container);
1218
}
1319

1420

1521
function clean(){
16-
let container = document.getElementById('app');
1722
ReactDOM.unmountComponentAtNode(container);
1823
container.innerHTML = '';
1924
}
2025

2126

27+
container.innerHTML = '';
28+
29+
2230
const viewer = new Viewer({
2331
target: document.body,
24-
props: {pages, mount, clean}
32+
props: {framework, pkg, logo, readme, pages, mount, clean}
2533
});

examples/viewer/react.svg

Lines changed: 7 additions & 0 deletions
Loading

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
],
1515
"scripts": {
1616
"build": "rimraf dist/* && rollup -c",
17-
"output": "npm run build && rimraf out/* && parcel build examples/index.html examples/*/*.html -d out",
17+
"output": "npm run build && rimraf out/* && build-examples",
1818
"start": "serve-examples",
1919
"test": "npm run output && jest"
2020
},
@@ -24,15 +24,14 @@
2424
"react": "^16"
2525
},
2626
"devDependencies": {
27-
"@activewidgets/examples": "0.0.1",
27+
"@activewidgets/examples": "0.0.2",
2828
"@activewidgets/options": "0.0.10",
2929
"@activewidgets/puppeteer": "0.0.4",
3030
"@activewidgets/testing": "0.0.3",
3131
"@babel/core": "^7",
3232
"@babel/preset-env": "^7",
3333
"@rollup/plugin-node-resolve": "^6",
3434
"@testing-library/react": "^9",
35-
"parcel": "^1",
3635
"postcss-import": "^12",
3736
"react-dom": "^16",
3837
"rimraf": "^3",

0 commit comments

Comments
 (0)