/* * Copyright (C) 2019 CZ.NIC z.s.p.o. (http://www.nic.cz/) * * This is free software, licensed under the GNU General Public License v3. * See /LICENSE for more information. */ import React from "react"; import PropTypes from "prop-types"; import { TextInput } from "../../bootstrap/TextInput"; import { Switch } from "../../bootstrap/Switch"; import { PasswordInput } from "../../bootstrap/PasswordInput"; import WiFiQRCode from "./WiFiQRCode"; import { HELP_TEXTS } from "./constants"; WifiGuestForm.propTypes = { formData: PropTypes.shape({ id: PropTypes.number.isRequired, SSID: PropTypes.string.isRequired, password: PropTypes.string.isRequired, enabled: PropTypes.bool.isRequired, }), formErrors: PropTypes.shape({ SSID: PropTypes.string, password: PropTypes.string, }), setFormValue: PropTypes.func.isRequired, deviceIndex: PropTypes.string, }; export default function WifiGuestForm({ formData, formErrors, setFormValue, deviceIndex, ...props }) { return ( <> ({ devices: { [formData.id]: { guest_wifi: { enabled: { $set: value } }, }, }, }))} {...props} /> {formData.enabled ? ( <> ({ devices: { [formData.id]: { guest_wifi: { SSID: { $set: value } }, }, }, }))} {...props} >
({ devices: { [formData.id]: { guest_wifi: { password: { $set: value } }, }, }, }))} {...props} /> ) : null} ); }