From efe9796c3945099845cf7dc2bf972d1dad26289f Mon Sep 17 00:00:00 2001 From: candifloss Date: Tue, 29 Oct 2024 16:44:12 +0530 Subject: [PATCH] restructured form sections --- test/css/entry-form.css | 128 +++++++---- test/html/adduser.html | 217 ++++++++++-------- test/scss/_colors.scss | 6 + .../_collapsible-section.scss | 34 +++ .../entry-form-fields/_submit-buttons.scss | 2 +- test/scss/entry-form.scss | 90 ++++---- 6 files changed, 293 insertions(+), 184 deletions(-) create mode 100644 test/scss/entry-form-fields/_collapsible-section.scss diff --git a/test/css/entry-form.css b/test/css/entry-form.css index 1073be0..e68d32f 100644 --- a/test/css/entry-form.css +++ b/test/css/entry-form.css @@ -36,30 +36,40 @@ body .form-container h2 { display: block; } body .form-container form { + margin-bottom: 20px; +} +body .form-container form .main-form, body .form-container form .collapsible-section { display: flex; flex-wrap: wrap; gap: 20px; - margin-bottom: 20px; + padding-bottom: 3px; } -body .form-container form .form-group { +body .form-container form .main-form .form-group, body .form-container form .collapsible-section .form-group { flex: 1 1 calc(50% - 20px); min-width: 250px; --value: 50; } -body .form-container form .form-group label { +body .form-container form .main-form .form-group label, body .form-container form .collapsible-section .form-group label { display: block; color: #4e4e4e; font-size: 16px; margin-bottom: 5px; } -body .form-container form .form-group input[type=text], -body .form-container form .form-group input[type=password], -body .form-container form .form-group input[type=email], -body .form-container form .form-group input[type=date], -body .form-container form .form-group input[type=number], -body .form-container form .form-group input[type=datetime-local], -body .form-container form .form-group input[type=tel], -body .form-container form .form-group select { +body .form-container form .main-form .form-group input[type=text], +body .form-container form .main-form .form-group input[type=password], +body .form-container form .main-form .form-group input[type=email], +body .form-container form .main-form .form-group input[type=date], +body .form-container form .main-form .form-group input[type=number], +body .form-container form .main-form .form-group input[type=datetime-local], +body .form-container form .main-form .form-group input[type=tel], +body .form-container form .main-form .form-group select, body .form-container form .collapsible-section .form-group input[type=text], +body .form-container form .collapsible-section .form-group input[type=password], +body .form-container form .collapsible-section .form-group input[type=email], +body .form-container form .collapsible-section .form-group input[type=date], +body .form-container form .collapsible-section .form-group input[type=number], +body .form-container form .collapsible-section .form-group input[type=datetime-local], +body .form-container form .collapsible-section .form-group input[type=tel], +body .form-container form .collapsible-section .form-group select { width: 100%; padding: 12px; border: 1px solid rgba(220, 220, 220, 0.8); @@ -68,31 +78,38 @@ body .form-container form .form-group select { font-size: 16px; transition: border-color 0.3s, background-color 0.3s; } -body .form-container form .form-group input[type=text]:focus, -body .form-container form .form-group input[type=password]:focus, -body .form-container form .form-group input[type=email]:focus, -body .form-container form .form-group input[type=date]:focus, -body .form-container form .form-group input[type=number]:focus, -body .form-container form .form-group input[type=datetime-local]:focus, -body .form-container form .form-group input[type=tel]:focus, -body .form-container form .form-group select:focus { +body .form-container form .main-form .form-group input[type=text]:focus, +body .form-container form .main-form .form-group input[type=password]:focus, +body .form-container form .main-form .form-group input[type=email]:focus, +body .form-container form .main-form .form-group input[type=date]:focus, +body .form-container form .main-form .form-group input[type=number]:focus, +body .form-container form .main-form .form-group input[type=datetime-local]:focus, +body .form-container form .main-form .form-group input[type=tel]:focus, +body .form-container form .main-form .form-group select:focus, body .form-container form .collapsible-section .form-group input[type=text]:focus, +body .form-container form .collapsible-section .form-group input[type=password]:focus, +body .form-container form .collapsible-section .form-group input[type=email]:focus, +body .form-container form .collapsible-section .form-group input[type=date]:focus, +body .form-container form .collapsible-section .form-group input[type=number]:focus, +body .form-container form .collapsible-section .form-group input[type=datetime-local]:focus, +body .form-container form .collapsible-section .form-group input[type=tel]:focus, +body .form-container form .collapsible-section .form-group select:focus { border-color: #007b8a; outline: none; } -body .form-container form .form-group.checkbox-set label { +body .form-container form .main-form .form-group.checkbox-set label, body .form-container form .collapsible-section .form-group.checkbox-set label { display: block; color: #4e4e4e; font-size: 16px; margin-bottom: 5px; } -body .form-container form .form-group.checkbox-set .checkboxes { +body .form-container form .main-form .form-group.checkbox-set .checkboxes, body .form-container form .collapsible-section .form-group.checkbox-set .checkboxes { display: flex; gap: 10px; } -body .form-container form .form-group.checkbox-set .checkboxes input[type=checkbox] { +body .form-container form .main-form .form-group.checkbox-set .checkboxes input[type=checkbox], body .form-container form .collapsible-section .form-group.checkbox-set .checkboxes input[type=checkbox] { display: none; } -body .form-container form .form-group.checkbox-set .checkboxes label.checkbox { +body .form-container form .main-form .form-group.checkbox-set .checkboxes label.checkbox, body .form-container form .collapsible-section .form-group.checkbox-set .checkboxes label.checkbox { cursor: pointer; padding: 12px; border: 1px solid rgba(220, 220, 220, 0.8); @@ -104,27 +121,27 @@ body .form-container form .form-group.checkbox-set .checkboxes label.checkbox { transition: background-color 0.3s, color 0.3s, border-color 0.3s; user-select: none; } -body .form-container form .form-group.checkbox-set .checkboxes label.checkbox:hover, body .form-container form .form-group.checkbox-set .checkboxes label.checkbox:focus { +body .form-container form .main-form .form-group.checkbox-set .checkboxes label.checkbox:hover, body .form-container form .main-form .form-group.checkbox-set .checkboxes label.checkbox:focus, body .form-container form .collapsible-section .form-group.checkbox-set .checkboxes label.checkbox:hover, body .form-container form .collapsible-section .form-group.checkbox-set .checkboxes label.checkbox:focus { background-color: rgba(232, 232, 232, 0.9); border-color: #007b8a; } -body .form-container form .form-group.checkbox-set .checkboxes input[type=checkbox]:checked + label.checkbox { +body .form-container form .main-form .form-group.checkbox-set .checkboxes input[type=checkbox]:checked + label.checkbox, body .form-container form .collapsible-section .form-group.checkbox-set .checkboxes input[type=checkbox]:checked + label.checkbox { background-color: #009299; color: #ffffff; border-color: rgba(0, 170, 179, 0.8); } -body .form-container form .form-group.dropdown-menu { +body .form-container form .main-form .form-group.dropdown-menu, body .form-container form .collapsible-section .form-group.dropdown-menu { flex: 1 1 calc(50% - 20px); min-width: 250px; } -body .form-container form .form-group.radio-input .radio-group { +body .form-container form .main-form .form-group.radio-input .radio-group, body .form-container form .collapsible-section .form-group.radio-input .radio-group { display: flex; gap: 10px; } -body .form-container form .form-group.radio-input .radio-group input[type=radio] { +body .form-container form .main-form .form-group.radio-input .radio-group input[type=radio], body .form-container form .collapsible-section .form-group.radio-input .radio-group input[type=radio] { display: none; } -body .form-container form .form-group.radio-input .radio-group label.radio { +body .form-container form .main-form .form-group.radio-input .radio-group label.radio, body .form-container form .collapsible-section .form-group.radio-input .radio-group label.radio { width: 100%; height: 100%; border-radius: 6px; @@ -139,16 +156,16 @@ body .form-container form .form-group.radio-input .radio-group label.radio { transition: background-color 0.3s, color 0.3s, border-color 0.3s; user-select: none; } -body .form-container form .form-group.radio-input .radio-group label.radio:hover, body .form-container form .form-group.radio-input .radio-group label.radio:focus { +body .form-container form .main-form .form-group.radio-input .radio-group label.radio:hover, body .form-container form .main-form .form-group.radio-input .radio-group label.radio:focus, body .form-container form .collapsible-section .form-group.radio-input .radio-group label.radio:hover, body .form-container form .collapsible-section .form-group.radio-input .radio-group label.radio:focus { background-color: rgba(232, 232, 232, 0.9); border-color: #007b8a; } -body .form-container form .form-group.radio-input .radio-group input[type=radio]:checked + label.radio { +body .form-container form .main-form .form-group.radio-input .radio-group input[type=radio]:checked + label.radio, body .form-container form .collapsible-section .form-group.radio-input .radio-group input[type=radio]:checked + label.radio { background-color: #009299; color: #ffffff; border-color: rgba(0, 170, 179, 0.8); } -body .form-container form .form-group input[type=range] { +body .form-container form .main-form .form-group input[type=range], body .form-container form .collapsible-section .form-group input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; @@ -160,17 +177,17 @@ body .form-container form .form-group input[type=range] { padding: 0; box-sizing: border-box; } -body .form-container form .form-group input[type=range]::-webkit-slider-runnable-track { +body .form-container form .main-form .form-group input[type=range]::-webkit-slider-runnable-track, body .form-container form .collapsible-section .form-group input[type=range]::-webkit-slider-runnable-track { width: 100%; height: 100%; border-radius: 6px; } -body .form-container form .form-group input[type=range]::-moz-range-track { +body .form-container form .main-form .form-group input[type=range]::-moz-range-track, body .form-container form .collapsible-section .form-group input[type=range]::-moz-range-track { width: 100%; height: 100%; border-radius: 6px; } -body .form-container form .form-group input[type=range]::-webkit-slider-thumb { +body .form-container form .main-form .form-group input[type=range]::-webkit-slider-thumb, body .form-container form .collapsible-section .form-group input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; display: none; appearance: none; @@ -183,7 +200,7 @@ body .form-container form .form-group input[type=range]::-webkit-slider-thumb { margin: 0; padding: 0; } -body .form-container form .form-group input[type=range]::-moz-range-thumb { +body .form-container form .main-form .form-group input[type=range]::-moz-range-thumb, body .form-container form .collapsible-section .form-group input[type=range]::-moz-range-thumb { display: none; appearance: none; width: 0; @@ -195,37 +212,60 @@ body .form-container form .form-group input[type=range]::-moz-range-thumb { margin: 0; padding: 0; } -body .form-container form .form-group input[type=range]:focus { +body .form-container form .main-form .form-group input[type=range]:focus, body .form-container form .collapsible-section .form-group input[type=range]:focus { outline: none; border-color: #007b8a; } -body .form-container form .form-group.submit-buttons { +body .form-container form .main-form[open], body .form-container form .collapsible-section[open] { + background-color: #dadada; + border-radius: 6px; +} +body .form-container form .main-form[open] summary, body .form-container form .collapsible-section[open] summary { + color: #979797; +} +body .form-container form .main-form summary, body .form-container form .collapsible-section summary { + display: block; + width: 100%; + color: #b1b1b1; + font-weight: bold; + font-size: 18px; + cursor: pointer; + margin-bottom: 10px; + border-bottom: 2px solid rgba(220, 220, 220, 0.8); + padding: 10px 2px; + border-radius: 6px 6px 0 0; +} +body .form-container form .main-form summary:hover, body .form-container form .collapsible-section summary:hover { + color: #636363; + background-color: #d4d4d4; +} +body .form-container form .submit-buttons { flex: 1 1 100%; display: flex; justify-content: space-between; margin-top: 20px; } -body .form-container form .form-group.submit-buttons button { +body .form-container form .submit-buttons button { width: 48%; text-align: center; padding: 12px; border-radius: 6px; } -body .form-container form .form-group.submit-buttons button.clear-button { +body .form-container form .submit-buttons button.clear-button { background-color: #c4c4c4; color: #ffffff; } -body .form-container form .form-group.submit-buttons button.clear-button:hover { +body .form-container form .submit-buttons button.clear-button:hover { background-color: #8f9091; } -body .form-container form .form-group.submit-buttons button.submit { +body .form-container form .submit-buttons button.submit { background-color: #007b8a; color: #ffffff; border: none; } -body .form-container form .form-group.submit-buttons button.submit:hover { +body .form-container form .submit-buttons button.submit:hover { background-color: #006b7a; } -body .form-container form .form-group.submit-buttons button:active { +body .form-container form .submit-buttons button:active { transform: translateY(2px); } diff --git a/test/html/adduser.html b/test/html/adduser.html index 997b2d7..f149c29 100644 --- a/test/html/adduser.html +++ b/test/html/adduser.html @@ -11,105 +11,130 @@

Add New User

-
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- -
- - -
- - - -
- -
- - - - - - - - +
+
+ +
-
-
- - -
- -
- -
- - - - - +
+ +
-
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + +
+ +
+ + + + + + + + +
+
+ +
+ + +
+ +
+ +
+ + + + + +
+
+ + +
+ Advanced +
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ + +
+
diff --git a/test/scss/_colors.scss b/test/scss/_colors.scss index 142620b..9357b21 100644 --- a/test/scss/_colors.scss +++ b/test/scss/_colors.scss @@ -80,3 +80,9 @@ $user-form-radio-button-active-border-color: $user-form-checkbox-button-active-b // Range slider $user-form-range-slider-background: $add-user-input-background; $user-form-range-slider-filled: $user-form-checkbox-button-active-color; + +// Collapsible section +$details-closed-summary-color: #b1b1b1; +$details-summary-hover-color: #636363; +$details-open-summary-color: #979797; +$details-summary-border-color: $add-user-input-border-color; diff --git a/test/scss/entry-form-fields/_collapsible-section.scss b/test/scss/entry-form-fields/_collapsible-section.scss new file mode 100644 index 0000000..918847f --- /dev/null +++ b/test/scss/entry-form-fields/_collapsible-section.scss @@ -0,0 +1,34 @@ +@use "../colors" as *; +@use "../vars" as *; + +// Collapsible sections in the form, like "Advanced" +@mixin collapsible { + padding-bottom: 3px; + // Style when the section is expanded + &[open] { + summary { + color: $details-open-summary-color; + } + background-color: #dadada; + border-radius: 6px; + } + // Regular + summary { + display: block; + width: 100%; + color: $details-closed-summary-color; + font-weight: bold; + font-size: 18px; + cursor: pointer; + margin-bottom: 10px; + border-bottom: 2px solid $details-summary-border-color; + padding: 10px 2px; + border-radius: 6px 6px 0 0; + + &:hover { + color: $details-summary-hover-color; + background-color: #d4d4d4; + } + } + +} diff --git a/test/scss/entry-form-fields/_submit-buttons.scss b/test/scss/entry-form-fields/_submit-buttons.scss index af148b2..77eb6f7 100644 --- a/test/scss/entry-form-fields/_submit-buttons.scss +++ b/test/scss/entry-form-fields/_submit-buttons.scss @@ -3,7 +3,7 @@ // Submit button styling @mixin submit-buttons { - &.submit-buttons { + .submit-buttons { flex: 1 1 100%; // Full width of the available space display: flex; // Use flex to align the buttons justify-content: space-between; // Space between buttons diff --git a/test/scss/entry-form.scss b/test/scss/entry-form.scss index 1248d2e..9a8caaf 100644 --- a/test/scss/entry-form.scss +++ b/test/scss/entry-form.scss @@ -1,10 +1,12 @@ @use "common"; // Reset styles @use "colors" as *; // Color scheme +@use "vars" as *; @use "entry-form-fields/submit-buttons" as *; @use "entry-form-fields/range-slider" as *; @use "entry-form-fields/radio-buttons" as *; @use "entry-form-fields/checkboxes" as *; @use "entry-form-fields/drop-down-menu" as *; +@use "entry-form-fields/collapsible-section" as *; // Basic styling for the body body { @@ -38,54 +40,56 @@ body { // Form element form { - display: flex; - flex-wrap: wrap; // Allow wrapping for form groups - gap: 20px; // Add consistent gap between elements margin-bottom: 20px; // Add space below the form for submit button + .main-form, .collapsible-section { + display: flex; + flex-wrap: wrap; // Allow wrapping for form groups + gap: 20px; // Add consistent gap between elements + .form-group { + flex: 1 1 calc(50% - 20px); // Take up half the row, accounting for gap + min-width: 250px; // Minimum width to prevent shrinking too much + //$input-field-border-radius: 6px; - // Form groups for each input - .form-group { - flex: 1 1 calc(50% - 20px); // Take up half the row, accounting for gap - min-width: 250px; // Minimum width to prevent shrinking too much - $input-field-border-radius: 6px; - - // Label styling - label { - display: block; - color: $add-user-form-title-color; - font-size: 16px; - margin-bottom: 5px; - } - - // Input and select styling - input[type="text"], - input[type="password"], - input[type="email"], - input[type="date"], - input[type="number"], - input[type="datetime-local"], - input[type="tel"], - select { - width: 100%; // Full width of the form group - padding: 12px; - border: 1px solid $add-user-input-border-color; - border-radius: $input-field-border-radius; - background-color: $add-user-input-background; - font-size: 16px; - transition: border-color 0.3s, background-color 0.3s; - - &:focus { - border-color: $add-user-input-focus-border-color; - outline: none; + // Label styling + label { + display: block; + color: $add-user-form-title-color; + font-size: 16px; + margin-bottom: 5px; } - } - @include checkboxes; - @include drop-down-menu; - @include radio-buttons; - @include range-slider; - @include submit-buttons; + // Input and select styling + input[type="text"], + input[type="password"], + input[type="email"], + input[type="date"], + input[type="number"], + input[type="datetime-local"], + input[type="tel"], + select { + width: 100%; // Full width of the form group + padding: 12px; + border: 1px solid $add-user-input-border-color; + border-radius: $input-field-border-radius; + background-color: $add-user-input-background; + font-size: 16px; + transition: border-color 0.3s, background-color 0.3s; + + &:focus { + border-color: $add-user-input-focus-border-color; + outline: none; + } + } + + // Form groups for each input + @include checkboxes; + @include drop-down-menu; + @include radio-buttons; + @include range-slider; + } + @include collapsible; } + @include submit-buttons; } } }