Skip to content

Commit 3935f03

Browse files
committed
init with simple form / custom form / country-api select;
1 parent dbedc39 commit 3935f03

31 files changed

+31627
-0
lines changed

.eslintrc

Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
{
2+
"parser": "@babel/eslint-parser",
3+
"root": true,
4+
"extends": [
5+
"eslint:recommended",
6+
"plugin:react-hooks/recommended"
7+
],
8+
"settings": {
9+
"react": {
10+
"version": "detect"
11+
},
12+
"linkComponents": [
13+
"Hyperlink",
14+
{
15+
"name": "Link",
16+
"linkAttribute": "href"
17+
}
18+
]
19+
},
20+
"ignorePatterns": [
21+
"node_modules/*",
22+
"node_modules/**/*",
23+
"src/icons/*",
24+
"src/icons/**/*"
25+
],
26+
"plugins": [
27+
"react",
28+
"deprecation"
29+
],
30+
"env": {
31+
"browser": true,
32+
"es6": true
33+
},
34+
"globals": {
35+
"process": true
36+
},
37+
"rules": {
38+
"deprecation/deprecation": 0,
39+
"no-console": 0,
40+
"react/display-name": 0,
41+
"react/forbid-prop-types": 0,
42+
"react/jsx-boolean-value": 1,
43+
"react/jsx-closing-bracket-location": 0,
44+
"react/jsx-curly-spacing": 1,
45+
"react/jsx-handler-names": 0,
46+
"react/jsx-indent-props": 1,
47+
"react/jsx-key": 1,
48+
"react/jsx-no-bind": 0,
49+
"react/jsx-no-duplicate-props": 1,
50+
"react/jsx-no-undef": 1,
51+
"react/jsx-no-target-blank": 1,
52+
"react/jsx-pascal-case": 1,
53+
"react/jsx-uses-react": 1,
54+
"react/jsx-uses-vars": 1,
55+
"react/no-danger": 0,
56+
"react/no-did-mount-set-state": 0,
57+
"react/no-did-update-set-state": 0,
58+
"react/no-direct-mutation-state": 1,
59+
"react/no-multi-comp": 0,
60+
"react/no-set-state": 0,
61+
"react/no-unknown-property": 1,
62+
"react/prefer-es6-class": 1,
63+
"react/prop-types": 0,
64+
"react/react-in-jsx-scope": 1,
65+
"react/self-closing-comp": 1,
66+
"react/sort-comp": 0
67+
},
68+
"overrides": [
69+
{
70+
"files": [
71+
"**/*.ts",
72+
"**/*.d.ts",
73+
"**/*.tsx"
74+
],
75+
"excludedFiles": [
76+
"node_modules/*",
77+
"node_modules/**/*",
78+
"src/icons/*",
79+
"src/icons/**/*"
80+
],
81+
"env": {
82+
"browser": true,
83+
"es6": true,
84+
"node": false
85+
},
86+
"extends": [
87+
"eslint:recommended",
88+
"plugin:react/recommended",
89+
"plugin:@typescript-eslint/eslint-recommended",
90+
"plugin:@typescript-eslint/recommended",
91+
"plugin:react-hooks/recommended"
92+
],
93+
"globals": {
94+
"process": true
95+
},
96+
"parser": "@typescript-eslint/parser",
97+
"parserOptions": {
98+
"ecmaFeatures": {
99+
"jsx": true
100+
},
101+
//"ecmaVersion": 2018,
102+
//"sourceType": "module",
103+
"project": "./tsconfig.json"
104+
},
105+
"plugins": [
106+
"react",
107+
"@typescript-eslint",
108+
"deprecation"
109+
],
110+
"settings": {
111+
"react": {
112+
"version": "detect"
113+
}
114+
},
115+
"rules": {
116+
"deprecation/deprecation": "error",
117+
"@typescript-eslint/no-unnecessary-boolean-literal-compare": "error",
118+
"@typescript-eslint/no-empty-interface": "error",
119+
"@typescript-eslint/no-inferrable-types": "off",
120+
"@typescript-eslint/no-inferrible-types": "off",
121+
"@typescript-eslint/explicit-module-boundary-types": "off",
122+
"@typescript-eslint/member-delimiter-style": [
123+
"error",
124+
{
125+
"multiline": {
126+
"delimiter": "none",
127+
"requireLast": false
128+
},
129+
"singleline": {
130+
"delimiter": "comma",
131+
"requireLast": false
132+
}
133+
}
134+
],
135+
"indent": [
136+
"error",
137+
4,
138+
{
139+
"SwitchCase": 1
140+
}
141+
],
142+
"no-trailing-spaces": "warn",
143+
"comma-dangle": [
144+
"error",
145+
{
146+
"arrays": "always-multiline",
147+
"objects": "always-multiline",
148+
"imports": "always-multiline",
149+
"exports": "always-multiline",
150+
"functions": "always-multiline"
151+
}
152+
],
153+
"react/prop-types": "off",
154+
"no-redundant-jsdoc": "off",
155+
"@typescript-eslint/ban-types": "off",
156+
"@typescript-eslint/ban-ts-comment": "off",
157+
"@typescript-eslint/no-explicit-any": "off",
158+
"@typescript-eslint/semi": [
159+
"warn",
160+
"never"
161+
],
162+
"semi-style": "off"
163+
}
164+
}
165+
]
166+
}

.github/workflows/blank.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: UI-Schema CRA CI
2+
3+
env:
4+
DOCKER_BUILDKIT: 1
5+
6+
on:
7+
push:
8+
branches: [master, develop]
9+
pull_request:
10+
branches: [master, develop]
11+
workflow_dispatch:
12+
13+
jobs:
14+
build_node:
15+
runs-on: ubuntu-latest
16+
strategy:
17+
matrix:
18+
node-version: [14.x]
19+
steps:
20+
- uses: actions/checkout@v2
21+
- name: Set Branch
22+
id: vars
23+
run: echo ::set-output name=short_ref::${GITHUB_REF#refs/*/}
24+
- name: Use Node.js ${{ matrix.node-version }}
25+
uses: actions/setup-node@v1
26+
with:
27+
node-version: ${{ matrix.node-version }}
28+
registry-url: 'https://registry.npmjs.org'
29+
30+
- name: Cache CI node_modules
31+
uses: actions/cache@v2
32+
env:
33+
cache-name: cache-node-modules
34+
with:
35+
# npm cache files are stored in `~/.npm` on Linux/macOS
36+
path: ~/.npm
37+
key: ${{ runner.os }}-build-${{ env.cache-name }}
38+
39+
- name: Setup packages
40+
run: |
41+
npm ci
42+
43+
- name: Run tests
44+
run: |
45+
npm test
46+
47+
- name: Build
48+
run: |
49+
npm run build

.gitignore

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.js
7+
8+
# testing
9+
/coverage
10+
11+
# production
12+
/build
13+
14+
.idea
15+
16+
# misc
17+
.DS_Store
18+
.env.local
19+
.env.development.local
20+
.env.test.local
21+
.env.production.local
22+
23+
npm-debug.log*
24+
yarn-debug.log*
25+
yarn-error.log*

.replit

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
language = "nodejs"
2+
run = "npm i && npm start"

README.md

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# UI-Schema Create-React Example w/ Material-UI
2+
3+
[![Github actions Build](https://github.com/ui-schema/demo-cra-ts/actions/workflows/blank.yml/badge.svg)](https://github.com/ui-schema/demo-cra-ts/actions)
4+
5+
Examples for [@ui-schema/ui-schema](https://github.com/ui-schema/ui-schema) in Typescript, with material ui, see [demo-cra](https://github.com/ui-schema/demo-cra) for simpler non-TS examples.
6+
7+
Files:
8+
9+
- [src/App.tsx](./src/App.tsx) provider setup, e.g. `UIMetaProvider`
10+
- [src/components/Layout.tsx](./src/components/Layout.tsx) app layout, routing and nav
11+
- [src/components/UISchema.tsx](./src/components/UISchema.tsx) UI-Schema widget setup
12+
- example pages:
13+
- [src/pages/PageSimpleForm.tsx](./src/pages/PageSimpleForm.tsx) with simple form, usage of `WidgetCountrySelect`
14+
- [src/pages/PageCustomForm.tsx](./src/pages/PageCustomForm.tsx) with custom rendered form, usage of `WidgetCountrySelect`
15+
- ~multiple~ widgets in: [src/Widgets/](./src/components/Widgets)
16+
- [WidgetCountrySelect.tsx](./src/components/Widgets/WidgetCountrySelect.tsx), uses an API to populate the `Select` options
17+
18+
[![Schema Examples + Live Editor](https://img.shields.io/badge/Schema%20Examples%20+%20Live%20Editor-green?labelColor=fff&color=1e970c&style=for-the-badge&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAE3ElEQVR4nO2bX0xbVRzHz9TExKc9mBjjn+gLgcEA2wL33ra3pV0pf/uX3t6yMAQKEkahlQkBNavbMG6BYMzG4nxYYZBoycIMfxJ9cL4oI5CYGR7FLAtkeyA+oEHDgJ8PBnLPhULLbXt0nm/yfeltcn7fzzn3nHvOzUW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gb7zBnT5ZVYm9lqFq77W0xpB3BREH/B9uwFHKzLej9hiyI2Z8j3BuD1wpYggIXBT5rerXI/Smv4bwYGXuMK8ePuIUup8uXukL3BjqNlFVjbeRoObrS25qcNwBVf7X1pASoNB2sej3IA3sP3BuD1woYgAC9739CbrsPTu4ODx42yIdhvtiYlfCJzRsRajtWgKeDgejD4RsoBXKtr/E7acK6ahVV3dXIBxOF1QYCiAvyly3mP737KAdSZrE+kjV4wxX/YmWxfkx2e2nXm1H9XID+s/MnugL8EgYgfuNxYLVkqBhBCx1IKgE3ilyDJdo6GTT2Angr7H6SDxvLblrLU7xBv9/TYrLLH0X+DDYwexjo6PCkHgBBCM+/1GK54fY+tLA/ZahZy1AwRZ6tZMDB6uOisXh3v7CxLS3gqKqqnSn8D0EwMpE6f7XEAAAAASUVORK5CYII=)](https://ui-schema.bemit.codes/examples)
19+
20+
[![Run on CodeSandbox](https://img.shields.io/badge/run%20on%20CodeSandbox-blue?labelColor=fff&logoColor=505050&style=for-the-badge&logo=codesandbox)](https://codesandbox.io/s/github/ui-schema/demo-cra-ts/tree/master/?autoresize=1&fontsize=12&hidenavigation=1&module=%2Fsrc%2FSchema%2FDemoEditor.js)
21+
22+
[![Fullscreen Demo](https://img.shields.io/badge/Fullscreen%20Demo-39c4d5?labelColor=fff&color=29a9b7&style=for-the-badge&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAACRUlEQVR4nO3aTYiNUQDG8Z/xWRSFBRZYYSGSZCdFiZ0sFSuTjbJUdqMslGIhlmI3shGRJnZYkQVWZjNZmPIRNfIxr8Xt1JivO/ed95zzXvf917N/nn/3drvnHBoaGhoaGjphIU7iJq7jYNY2iVmCIRST8hDbMvZKxllTx4f8whWsytYuAY/NLCBkFKe1vir/Hc+1FxDyGvvz1IxHJwJC7mJzjrIxKCOgwA9cxIr0laulrICQDziBBamLV8V8BYS8wN7E3SuhKgEFxnEL65MumCdVCgj5jvNYlnBHaWIICBnGsXRTyhFTQMgT7Eg1qFNSCCjwBzewJs2suZNKQMhnrf8fi1OMmwupBYS8xaEE+9qSS0DIfWyJvnIWcgso8BOXsTLy1mmpg4CQjziFvqiLJ1EnASEvsS/m6InUUUDIIDbGm96izgIKjGEAy3tVQMgIDvSygPBp2NrLAgpc7XUB93pdwKVeFvBVhJ/FbhHwBrurHt8NAj7hDBbFGF9nAb9xDatjDQ/UUcAQtsccPZE6CXiPo3HnTqUOAr7hHJZG3jotOQWMa71KWRd95SzkEvAMexLsa0tqASM4rkaXqakEjOGCiP/ry5JCwCA2JdrTMTEFvJLwbK8sMQSMol/i092yVCkgnO931bO6qgQ8kPmGpyzzFfAOh5O3rpCyAr6o2S1vWToVEO751+YoG4NOBDzFziwtI/JI++HDuuCtT1n6zTy8q157laUPd/w7fBy3sSFjr+Qc0TpzH8CuzF0aGhoaGhoayvEXCYka61umCF0AAAAASUVORK5CYII=)](https://ui-schema-cra-ts.netlify.app)
23+
24+
[![Clone on Repl.it](https://img.shields.io/badge/repl.it%20clone-grey?labelColor=fff&style=for-the-badge&logo=repl.it)](https://repl.it/github/ui-schema/demo-cra-ts)
25+
26+
## CI
27+
28+
- build & deploy with [netlify](https://www.netlify.com/), see [netlify.toml](./netlify.toml)
29+
- build with GitHub Actions, see [.github/workflows/blank.yml](./.github/workflows/blank.yml)
30+
31+
---
32+
---
33+
---
34+
35+
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
36+
37+
## Available Scripts
38+
39+
In the project directory, you can run:
40+
41+
### `npm start`
42+
43+
Runs the app in the development mode.\
44+
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
45+
46+
The page will reload if you make edits.\
47+
You will also see any lint errors in the console.
48+
49+
### `npm test`
50+
51+
Launches the test runner in the interactive watch mode.\
52+
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
53+
54+
### `npm run build`
55+
56+
Builds the app for production to the `build` folder.\
57+
It correctly bundles React in production mode and optimizes the build for the best performance.
58+
59+
The build is minified and the filenames include the hashes.\
60+
Your app is ready to be deployed!
61+
62+
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
63+
64+
### `npm run eject`
65+
66+
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
67+
68+
If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
69+
70+
Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.
71+
72+
You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.
73+
74+
## Learn More
75+
76+
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
77+
78+
To learn React, check out the [React documentation](https://reactjs.org/).

netlify.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Settings in the [build] context are global and are applied to all contexts
2+
# unless otherwise overridden by more specific contexts.
3+
[build]
4+
5+
# Directory that contains the deploy-ready HTML files and assets generated by
6+
# the build. This is relative to the base directory if one has been set, or the
7+
# root directory if a base has not been set. This sample publishes the
8+
# directory located at the absolute path "root/project/build-output"
9+
publish = "build"
10+
11+
command = "npm ci && npm run build"
12+
13+
[build.processing]
14+
skip_processing = false
15+
16+
#[build.processing.html]
17+
#pretty_urls = true
18+
19+
# A redirect rule with all the supported properties
20+
[[redirects]]
21+
from = "/index.html"
22+
to = "/"
23+
24+
# By default, redirects won't be applied if there's a file with the same
25+
# path as the one defined in the `from` property. Setting `force` to `true`
26+
# will make the redirect rule take precedence over any existing files.
27+
force = true
28+
29+
# The following redirect is intended for use with most SPAs that handle
30+
# routing internally.
31+
[[redirects]]
32+
from = "/*"
33+
to = "/"
34+
status = 200
35+

0 commit comments

Comments
 (0)