aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/App.css38
-rw-r--r--src/App.js32
-rw-r--r--src/components/Card.js56
-rw-r--r--src/components/style.css47
-rw-r--r--src/index.css13
-rw-r--r--src/index.js2
-rw-r--r--src/light.min.css2
-rw-r--r--src/style.css11
8 files changed, 133 insertions, 68 deletions
diff --git a/src/App.css b/src/App.css
deleted file mode 100644
index 74b5e05..0000000
--- a/src/App.css
+++ /dev/null
@@ -1,38 +0,0 @@
1.App {
2 text-align: center;
3}
4
5.App-logo {
6 height: 40vmin;
7 pointer-events: none;
8}
9
10@media (prefers-reduced-motion: no-preference) {
11 .App-logo {
12 animation: App-logo-spin infinite 20s linear;
13 }
14}
15
16.App-header {
17 background-color: #282c34;
18 min-height: 100vh;
19 display: flex;
20 flex-direction: column;
21 align-items: center;
22 justify-content: center;
23 font-size: calc(10px + 2vmin);
24 color: white;
25}
26
27.App-link {
28 color: #61dafb;
29}
30
31@keyframes App-logo-spin {
32 from {
33 transform: rotate(0deg);
34 }
35 to {
36 transform: rotate(360deg);
37 }
38}
diff --git a/src/App.js b/src/App.js
index ce9cbd2..6ba42f0 100644
--- a/src/App.js
+++ b/src/App.js
@@ -1,24 +1,24 @@
1import React from 'react'; 1import React from 'react';
2import logo from './logo.svg'; 2import Card from './components/Card';
3import './App.css'; 3import './style.css';
4 4
5function App() { 5function App() {
6 return ( 6 return (
7 <div className="App"> 7 <div className="App">
8 <header className="App-header"> 8
9 <img src={logo} className="App-logo" alt="logo" /> 9 <h1>WiFi Card</h1>
10 <p> 10
11 Edit <code>src/App.js</code> and save to reload. 11 <p className="tag">
12 </p> 12 Print a simple card with your WiFi login details. Tape it to the fridge, keep it in your wallet, etc.
13 <a 13 </p>
14 className="App-link" 14
15 href="https://reactjs.org" 15 <p className="tag">
16 target="_blank" 16 Your information is never sent to the server.
17 rel="noopener noreferrer" 17 View the <a href="https://github.com/bndw/wifi-details">source code</a>.
18 > 18 </p>
19 Learn React 19
20 </a> 20 <Card />
21 </header> 21
22 </div> 22 </div>
23 ); 23 );
24} 24}
diff --git a/src/components/Card.js b/src/components/Card.js
new file mode 100644
index 0000000..c555a25
--- /dev/null
+++ b/src/components/Card.js
@@ -0,0 +1,56 @@
1import React from 'react';
2import QRCode from 'qrcode.react';
3import './style.css';
4
5class Card extends React.Component {
6 constructor(props) {
7 super(props);
8 this.state = {ssid: '', password: '', qrvalue: ''};
9 this.handleSSIDChange = this.handleSSIDChange.bind(this);
10 this.handlePasswordChange= this.handlePasswordChange.bind(this);
11 }
12
13 handleSSIDChange(event) {
14 this.setState({ssid: event.target.value}, () => this.generateqr());
15 }
16
17 handlePasswordChange(event) {
18 this.setState({password: event.target.value}, () => this.generateqr());
19 }
20
21 generateqr() {
22 const qrcode = `WIFI:T:WPA;S:${this.state.ssid};P:${this.state.password};;`
23 this.setState({qrvalue: qrcode});
24 }
25
26 render() {
27 return (
28 <div>
29 <fieldset id="print-area">
30 <legend></legend>
31
32 <h1>WiFi Login</h1>
33 <hr/>
34
35 <div className="details">
36 <QRCode className="qrcode" value={this.state.qrvalue} size={175} />
37
38 <div className="text">
39 <label>Network name</label>
40 <input id="ssid" type="text" placeholder="Enter your WiFi Network" value={this.state.ssid} onChange={this.handleSSIDChange}/>
41 <label>Password</label>
42 <input id="password" type="text" placeholder="password" value={this.state.password} onChange={this.handlePasswordChange}/>
43 </div>
44 </div>
45
46 <p><span role="img" aria-label="mobile-phone">πŸ“ΈπŸ“±</span>Point your phone's camera at the QR Code to connect automatically</p>
47 </fieldset>
48 <div className="print-btn">
49 <button onClick={window.print}>Print</button>
50 </div>
51 </div>
52 )
53 }
54}
55
56export default Card;
diff --git a/src/components/style.css b/src/components/style.css
new file mode 100644
index 0000000..e5b01e3
--- /dev/null
+++ b/src/components/style.css
@@ -0,0 +1,47 @@
1#print-area {
2 margin-top: 2em;
3 padding: 1em;
4}
5.details {
6 display: flex;
7 padding: 1em;
8}
9.details .text{
10 margin: 0;
11}
12.details .text * {
13 margin: 0 1em;
14}
15.details .text input {
16 background-color: #fff;
17 border: solid 1px #ddd;
18 font-size: 1.4em;
19 font-weight: bold;
20 line-height: 2;
21}
22.print-btn {
23 padding-top: 2em;
24}
25.print-btn button {
26 color: #fff;
27 height: 50px;
28 width: 180px;
29 background-color: #0074d9;
30}
31
32@media print {
33 body * {
34 visibility: hidden;
35 }
36 #print-area, #print-area * {
37 visibility: visible;
38 }
39 #print-area input {
40 border: none;
41 }
42 #print-area {
43 position: absolute;
44 left: 0;
45 top: 0;
46 }
47}
diff --git a/src/index.css b/src/index.css
deleted file mode 100644
index ec2585e..0000000
--- a/src/index.css
+++ /dev/null
@@ -1,13 +0,0 @@
1body {
2 margin: 0;
3 font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 sans-serif;
6 -webkit-font-smoothing: antialiased;
7 -moz-osx-font-smoothing: grayscale;
8}
9
10code {
11 font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 monospace;
13}
diff --git a/src/index.js b/src/index.js
index f5185c1..be3b97a 100644
--- a/src/index.js
+++ b/src/index.js
@@ -1,6 +1,6 @@
1import React from 'react'; 1import React from 'react';
2import ReactDOM from 'react-dom'; 2import ReactDOM from 'react-dom';
3import './index.css'; 3import './light.min.css';
4import App from './App'; 4import App from './App';
5import * as serviceWorker from './serviceWorker'; 5import * as serviceWorker from './serviceWorker';
6 6
diff --git a/src/light.min.css b/src/light.min.css
new file mode 100644
index 0000000..8ce73eb
--- /dev/null
+++ b/src/light.min.css
@@ -0,0 +1,2 @@
1@charset "UTF-8";body{font-family:system-ui,-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Oxygen,Ubuntu,Cantarell,Fira Sans,Droid Sans,Helvetica Neue,sans-serif;line-height:1.4;max-width:800px;margin:20px auto;padding:0 10px;color:#363636;background:#fff;text-rendering:optimizeLegibility}button,input,textarea{transition:background-color .1s linear,border-color .1s linear,color .1s linear,box-shadow .1s linear,transform .1s ease}h1{font-size:2.2em;margin-top:0}h1,h2,h3,h4,h5,h6{margin-bottom:12px}h1,h2,h3,h4,h5,h6,strong{color:#000}b,h1,h2,h3,h4,h5,h6,strong,th{font-weight:600}blockquote{border-left:4px solid rgba(0,150,191,.67);margin:1.5em 0;padding:.5em 1em;font-style:italic}blockquote>footer{margin-top:10px;font-style:normal}address,blockquote cite{font-style:normal}a[href^=mailto]:before{content:"πŸ“§ "}a[href^=tel]:before{content:"πŸ“ž "}a[href^=sms]:before{content:"πŸ’¬ "}button,input[type=button],input[type=checkbox],input[type=submit]{cursor:pointer}input:not([type=checkbox]):not([type=radio]),select{display:block}button,input,select,textarea{color:#000;background-color:#efefef;font-family:inherit;font-size:inherit;margin-right:6px;margin-bottom:6px;padding:10px;border:none;border-radius:6px;outline:none}button,input:not([type=checkbox]):not([type=radio]),select,textarea{-webkit-appearance:none}textarea{margin-right:0;width:100%;box-sizing:border-box;resize:vertical}button,input[type=button],input[type=submit]{padding-right:30px;padding-left:30px}button:hover,input[type=button]:hover,input[type=submit]:hover{background:#ddd}button:focus,input:focus,select:focus,textarea:focus{box-shadow:0 0 0 2px rgba(0,150,191,.67)}button:active,input[type=button]:active,input[type=checkbox]:active,input[type=radio]:active,input[type=submit]:active{transform:translateY(2px)}button:disabled,input:disabled,select:disabled,textarea:disabled{cursor:not-allowed;opacity:.5}::-webkit-input-placeholder{color:#949494}:-ms-input-placeholder{color:#949494}::-ms-input-placeholder{color:#949494}::placeholder{color:#949494}a{text-decoration:none;color:#0076d1}a:hover{text-decoration:underline}code,kbd{background:#efefef;color:#000;padding:5px;border-radius:6px}pre>code{padding:10px;display:block;overflow-x:auto}img{max-width:100%}hr{border:none;border-top:1px solid #dbdbdb}table{border-collapse:collapse;margin-bottom:10px;width:100%}td,th{padding:6px;text-align:left}th{border-bottom:1px solid #dbdbdb}tbody tr:nth-child(2n){background-color:#efefef}::-webkit-scrollbar{height:10px;width:10px}::-webkit-scrollbar-track{background:#efefef;border-radius:6px}::-webkit-scrollbar-thumb{background:#d5d5d5;border-radius:6px}::-webkit-scrollbar-thumb:hover{background:#c4c4c4}
2/*# sourceMappingURL=light.min.css.map */
diff --git a/src/style.css b/src/style.css
new file mode 100644
index 0000000..3e55788
--- /dev/null
+++ b/src/style.css
@@ -0,0 +1,11 @@
1body {
2 max-width: 650px;
3}
4.tag {
5 line-height: 1.6;
6}
7
8iframe {
9 float: right;
10 margin: -2em;
11}