Skip to content

Commit 6cc0d5f

Browse files
committed
3: demo application is added
1 parent 0d95f2e commit 6cc0d5f

File tree

6 files changed

+3746
-111
lines changed

6 files changed

+3746
-111
lines changed

.github/workflows/node.js.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,12 @@ jobs:
2525

2626
- run: npm ci
2727
- run: npm run build
28+
- run: npm run demo
29+
- name: Upload demo files as artifact
30+
id: deployment
31+
uses: actions/upload-pages-artifact@v3
32+
with:
33+
path: demo/
2834

2935
test:
3036
needs: build
@@ -72,3 +78,14 @@ jobs:
7278
run: |
7379
echo "Coverage is below 50%!"
7480
exit 1
81+
82+
deploy:
83+
environment:
84+
name: github-pages
85+
url: ${{ steps.deployment.outputs.page_url }}
86+
runs-on: ubuntu-latest
87+
needs: build
88+
steps:
89+
- name: Deploy Demo to GitHub Pages
90+
id: deployment
91+
uses: actions/deploy-pages@v4

demo/index.html

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<title>Smart Time Input</title>
6+
<style>
7+
body {
8+
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
9+
text-align: center;
10+
}
11+
12+
.input {
13+
background-color: rgba(255, 255, 255, 0.85);
14+
height: 32px;
15+
padding: 1px;
16+
padding-left: 10px;
17+
padding-right: 10px;
18+
text-align: center;
19+
color: #211f26;
20+
border: 0 solid #e5e7eb;
21+
border-radius: max(calc(4px * 1 * 0.75), 0px);
22+
box-shadow: inset 0 0 0 1px #10003332;
23+
font-size: 14px;
24+
letter-spacing: -0px;
25+
line-height: 21px;
26+
width: 50px;
27+
margin-bottom: 10px;
28+
}
29+
30+
.input:focus {
31+
outline: none;
32+
box-shadow: 0 0 0 2px #cf91d8;
33+
}
34+
</style>
35+
36+
</head>
37+
<body>
38+
<h1>Smart Time Input</h1>
39+
<div id="myApp"></div>
40+
<script src="demo.js" type="text/javascript"></script>
41+
</body>
42+
</html>

demo/index.jsx

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
import React from 'react'
2+
3+
import { StrictMode } from 'react';
4+
import { createRoot } from 'react-dom/client';
5+
6+
// import { SmartTimeInput } from './../src/smart-time-input.tsx'
7+
import { SmartTimeInput } from './../dist/smart-time-input.js'
8+
9+
const InputWrapper = (props) => {
10+
console.log("hello: " + props.helpText);
11+
// const onTimeChangeHandler = (val) => {
12+
// if (val.length === 5) {
13+
// }
14+
// }
15+
16+
return (
17+
<SmartTimeInput
18+
initTime={props.init}
19+
placeholder={props.helpText}
20+
className='input'
21+
// onTimeChange={onTimeChangeHandler}
22+
/>
23+
);
24+
25+
}
26+
27+
function App() {
28+
return (
29+
<div>
30+
<InputWrapper init="12:34"/>
31+
<InputWrapper helpText="HH:mm"/>
32+
<InputWrapper />
33+
</div>
34+
);
35+
}
36+
37+
const rootElement = document.getElementById('myApp');
38+
const root = createRoot(rootElement);
39+
40+
root.render(
41+
<StrictMode>
42+
<App />
43+
</StrictMode>,
44+
);

0 commit comments

Comments
 (0)