1
0
mirror of https://gitlab.nic.cz/turris/reforis/foris-js.git synced 2024-11-14 17:35:35 +01:00

Merge branch 'add-classname-prop-to-switch' into 'dev'

Add className prop to Switch

See merge request turris/reforis/foris-js!221
This commit is contained in:
Aleksandr Gumroian 2024-06-26 14:24:49 +02:00
commit 0b02bead71
3 changed files with 9 additions and 8 deletions

View File

@ -19,15 +19,16 @@ Switch.propTypes = {
]).isRequired, ]).isRequired,
helpText: PropTypes.string, helpText: PropTypes.string,
switchHeading: PropTypes.bool, switchHeading: PropTypes.bool,
className: PropTypes.string,
}; };
function Switch({ label, helpText, switchHeading, ...props }) { function Switch({ label, helpText, switchHeading, className, ...props }) {
const uid = useUID(); const uid = useUID();
return ( return (
<div <div
className={`form-check form-switch mb-3 ${ className={`form-check form-switch ${className || "mb-3"} ${
switchHeading ? "d-flex align-items-center" : null switchHeading ? "d-flex align-items-center" : ""
}`.trim()} }`.trim()}
> >
<input <input

View File

@ -2,7 +2,7 @@
exports[`<Switch/> Render switch 1`] = ` exports[`<Switch/> Render switch 1`] = `
<div <div
class="form-check form-switch mb-3 null" class="form-check form-switch mb-3"
> >
<input <input
checked="" checked=""
@ -29,7 +29,7 @@ exports[`<Switch/> Render switch 1`] = `
exports[`<Switch/> Render uncheked switch 1`] = ` exports[`<Switch/> Render uncheked switch 1`] = `
<div <div
class="form-check form-switch mb-3 null" class="form-check form-switch mb-3"
> >
<input <input
class="form-check-input" class="form-check-input"

View File

@ -536,7 +536,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ </div> + </div>
+ </div> + </div>
+ <div + <div
+ class="form-check form-switch mb-3 null" + class="form-check form-switch mb-3"
+ > + >
+ <input + <input
+ class="form-check-input" + class="form-check-input"
@ -920,7 +920,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ </div> + </div>
+ </div> + </div>
+ <div + <div
+ class="form-check form-switch mb-3 null" + class="form-check form-switch mb-3"
+ > + >
+ <input + <input
+ class="form-check-input" + class="form-check-input"
@ -943,7 +943,7 @@ exports[`<WiFiSettings/> Snapshot one module enabled. 1`] = `
+ </div> + </div>
+ </div> + </div>
+ <div + <div
+ class="form-check form-switch mb-3 null" + class="form-check form-switch mb-3"
+ > + >
+ <input + <input
+ class="form-check-input" + class="form-check-input"