Skip to content

Commit 1d31cc4

Browse files
committed
react: basic hardcoded example
1 parent 1d8a885 commit 1d31cc4

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed

JavaScript/impl-react/public/index.html

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
content="width=device-width, initial-scale=1, shrink-to-fit=no"
88
/>
99
<meta name="theme-color" content="#000000" />
10+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
1011
<!--
1112
Notice the use of %PUBLIC_URL% in the tags above.
1213
It will be replaced with the URL of the `public` folder during the build.
@@ -16,7 +17,7 @@
1617
work correctly both with client-side routing and a non-root public URL.
1718
Learn how to configure a non-root public URL by running `npm run build`.
1819
-->
19-
<title>React App</title>
20+
<title>React Design Patterns</title>
2021
</head>
2122
<body>
2223
<noscript>You need to enable JavaScript to run this app.</noscript>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
.navbar {
2+
margin-bottom: 25px;
3+
}
4+
5+
.container {
6+
width: 400px;
7+
}

JavaScript/impl-react/src/Components/App.js

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,28 @@ import { formConfig } from '../FormBuilder/formConfig.js';
55
export class App extends Component {
66
render() {
77
return (
8-
<div className="App">
9-
<pre>{JSON.stringify(formConfig)}</pre>
8+
<div>
9+
<nav className="navbar navbar-light bg-light">
10+
<div className="navbar-brand">itenium</div>
11+
</nav>
12+
13+
<div className="container">
14+
<form>
15+
<div className="form-group">
16+
<label>Email</label>
17+
<input type="email" className="form-control" />
18+
</div>
19+
<div className="form-group">
20+
<label>Password</label>
21+
<input type="password" className="form-control" />
22+
</div>
23+
<div className="form-group form-check">
24+
<input type="checkbox" className="form-check-input" />
25+
<label className="form-check-label">Remain logged in</label>
26+
</div>
27+
<button type="submit" className="btn btn-primary">Login</button>
28+
</form>
29+
</div>
1030
</div>
1131
);
1232
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
export const formConfig = [
2-
{type: 'text', label: 'Email', pattern: '^.*@.*$'},
2+
{type: 'email', label: 'Email', pattern: '^.*@.*$'},
33
{type: 'secret', label: 'Password', minLength: 8},
4-
{type: 'secret', label: 'Repeat', minLength: 8},
4+
{type: 'toggle', label: 'Remain logged in'},
55
{type: 'submit', label: 'Login'},
66
];

0 commit comments

Comments
 (0)