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 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/components/Card.js (limited to 'src/components/Card.js') 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; -- cgit v1.2.3