From 6371e7794d2fa9ba5b79f267219e50e885057342 Mon Sep 17 00:00:00 2001 From: bndw Date: Sat, 30 May 2020 12:33:16 -0700 Subject: Initial commit --- src/components/Card.js | 56 ++++++++++++++++++++++++++++++++++++++++++++++++ src/components/style.css | 47 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100644 src/components/Card.js create mode 100644 src/components/style.css (limited to 'src/components') 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 @@ +import React from 'react'; +import QRCode from 'qrcode.react'; +import './style.css'; + +class Card extends React.Component { + constructor(props) { + super(props); + this.state = {ssid: '', password: '', qrvalue: ''}; + this.handleSSIDChange = this.handleSSIDChange.bind(this); + this.handlePasswordChange= this.handlePasswordChange.bind(this); + } + + handleSSIDChange(event) { + this.setState({ssid: event.target.value}, () => this.generateqr()); + } + + handlePasswordChange(event) { + this.setState({password: event.target.value}, () => this.generateqr()); + } + + generateqr() { + const qrcode = `WIFI:T:WPA;S:${this.state.ssid};P:${this.state.password};;` + this.setState({qrvalue: qrcode}); + } + + render() { + return ( +
+ +
+ +
+
+ ) + } +} + +export 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 @@ +#print-area { + margin-top: 2em; + padding: 1em; +} +.details { + display: flex; + padding: 1em; +} +.details .text{ + margin: 0; +} +.details .text * { + margin: 0 1em; +} +.details .text input { + background-color: #fff; + border: solid 1px #ddd; + font-size: 1.4em; + font-weight: bold; + line-height: 2; +} +.print-btn { + padding-top: 2em; +} +.print-btn button { + color: #fff; + height: 50px; + width: 180px; + background-color: #0074d9; +} + +@media print { + body * { + visibility: hidden; + } + #print-area, #print-area * { + visibility: visible; + } + #print-area input { + border: none; + } + #print-area { + position: absolute; + left: 0; + top: 0; + } +} -- cgit v1.2.3