From f1d79a17f615a9cd34b15dd7b96764e4bb99486a Mon Sep 17 00:00:00 2001 From: guicamest Date: Tue, 15 Aug 2023 17:32:18 +0200 Subject: Allow setting additional cards to print (#275) * Add setting for additional cards to print * Render additional cards to print * Do not render additional cards if amount is less than 1 * Render additional cards when printing * Improve layout for portrait printing * Render eap and identity textfields conditionally so that they dont use space * Use all width in print-area * Change additionalCards setting to Input and react to changes * Allow hiding tip (legend) on card * Print only full cards * Move print-area - not-displayed - to the bottom of the page * Set default ssid back to empty, additional cards to 0 * Lower marginBottom of password field to 5 instead of 24 (default) * Use conditional rendering instead of class to hide password * Set marginBottom to QR code only on portrait mode * Set row-gap to 0 to allow up to 6 cards to fit in portrait mode in A4 * Move hideTip setting right after hiddenSSID --- src/components/WifiCard.js | 181 ++++++++++++++++++++++----------------------- 1 file changed, 89 insertions(+), 92 deletions(-) (limited to 'src/components/WifiCard.js') diff --git a/src/components/WifiCard.js b/src/components/WifiCard.js index 6e91be0..70e1189 100644 --- a/src/components/WifiCard.js +++ b/src/components/WifiCard.js @@ -72,84 +72,83 @@ export const WifiCard = (props) => { }; return ( - - + + icon + + {t('wifi.login')} + + + + - - icon - - {t('wifi.login')} - - + - - + props.onSSIDChange(e.target.value)} + isInvalid={!!props.ssidError} + validationMessage={!!props.ssidError && props.ssidError} /> + {props.settings.encryptionMode === 'WPA2-EAP' && ( + <> + - - props.onSSIDChange(e.target.value)} - isInvalid={!!props.ssidError} - validationMessage={!!props.ssidError && props.ssidError} - /> - - props.onEapIdentityChange(e.target.value)} - isInvalid={!!props.eapIdentityError} - validationMessage={ - !!props.eapIdentityError && props.eapIdentityError - } - /> + props.onEapIdentityChange(e.target.value)} + isInvalid={!!props.eapIdentityError} + validationMessage={ + !!props.eapIdentityError && props.eapIdentityError + } + /> + + )} + {!(props.settings.hidePassword || !props.settings.encryptionMode) && ( { autoCorrect="off" autoCapitalize="none" spellCheck={false} - className={` - ${ - (props.settings.hidePassword || - !props.settings.encryptionMode) && - 'hidden' - } - `} height={ props.settings.portrait && props.settings.password.length > 40 ? '5em' : 'auto' } + marginBottom={5} label={passwordFieldLabel()} placeholder={t('wifi.password.placeholder')} value={props.settings.password} @@ -177,17 +170,21 @@ export const WifiCard = (props) => { isInvalid={!!props.passwordError} validationMessage={!!props.passwordError && props.passwordError} /> - + )} -
- - - - - {t('wifi.tip')} - - -
-
+ + {!props.settings.hideTip && ( + <> +
+ + + + + {t('wifi.tip')} + + + + )} + ); }; -- cgit v1.2.3