Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Qol 8391 forms styles global #439

Merged
merged 5 commits into from
Mar 24, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
219 changes: 217 additions & 2 deletions src/assets/_project/_blocks/components/forms/_qg-forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,225 @@
}

}


// hint text
.hint{
color: $qg-dark-gray-light;
@include rem(font-size, 14px);
}
//------------------------------------------------------------------------------------
// Updated form styles (migrated from forms.io repository to make all forms look the same)
//------------------------------------------------------------------------------------

.qg-forms-v2, #formio {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm currently working on a ticket to support multiple forms in a page, so it would be nice to have the style selected by classname instead (ie. .formio_container) or wildcard id (ie. [id^=formio])
as id will need to be unique if there is multiple forms in a page (eg. #formio-xxxxx)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

my ticket: https://servicesmadesimpler.govnet.qld.gov.au/jira/browse/QOL-8650
style in demo: matrix asset in prod: style #249330
please let me know if there is any concern

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

HI @devonpis, Currently, this ID #formio is in use, so I included it so that we wouldn't break anything. If you are building a new component I would suggest using class .qg-forms-v2 and which can work with any number of forms and if we need any particular function we can include ID according to the requirements of a form.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's sounds reasonable, i'll wait for your merge and fully tested first and will implement the multiple form support later if it's neccessary, also i'll consider using .qg-forms-v2 as well

input:not([type=button]):not([type=reset]):not([type=submit]):not([type=image]):not([type]),
select,
textarea,
.formio-choices .selection {
border-radius: $borderRadius;
border-width: $borderWidth;
}
label {
font-size: $labelSize;
color: $labelColour;
font-weight: $labelWeight;
}
.hint {
font-size: $hintSize;
color: $hintColour;
font-weight: $hintWeight;
}
h1,
h2,
h3,
h4,
legend {
font-size: $labelHeadingSize;
color: $labelHeadingColour;
font-weight: $labelHeadingWeight;
}
.checkbox,
.form-radio {
div.form-check {
padding-bottom: $defaultRem;
}
label {
display: inline-block;
span {
font-weight: $checkboxWeight;
margin-left: $defaultRem;
margin-right: 0.5rem !important;
float: right;
}
input.form-check-input {
width: 25px;
height: 25px;
top: $none;
margin-top: $none;
border-radius: $borderRadius;
border-width: $borderWidth;
float: left;
}
}
.field-required:after {
position: absolute;
float: right;
top: 0;
right: 0;
}
}
.form-group {
//margin-bottom: 1rem !important;
}
.formio-hidden {
margin-bottom: 0 !important;
}
.alert {
margin-bottom: $defaultRem;
}
.text-muted {
color: $hintColour;
}
.qg-link {
cursor: pointer;
}

//Action buttons ------------------------------------------------------
button.btn-secondary {
color: $SecondaryColor;
background-color: white;
border: $buttonSecondaryBorder;
}

button.btn-secondary:hover {
color: $SecondaryColor;
}

//Errors -------------------------------------------------------------

//error alert
.alert-danger {
li {
text-decoration: underline;
span {
color: $SecondaryColor;
}
}
background-color: $alertWarningBackground;
border-color: $alertWarningBorder;
}

//error on fields
.is-invalid {
//border-color:;
background-color: white;
background-image: none !important;
}

//error container
.formio-error-wrapper {
color: white !important;
background-color: white !important;
border-color: white !important;
padding: $none;
}

//error labels
.formio-errors {
div.error {
font-size: $hintSize;
}
}

div.has_error {
margin-top: $defaultRem;
}

//Layout modifications -------------------------------------------------
//Align individual field descriptions before input element

.formio-component-textfield,
.formio-component-textarea,
.formio-component-hidden,
.formio-component-checkbox,
.formio-component-email,
.formio-component-password,
.formio-component-radio,
.formio-component-currency,
.formio-component-number,
.formio-component-selectboxes,
.formio-component-url,
.formio-component-phoneNumber,
.formio-component-datetime,
.formio-component-day,
.formio-component-datetime,
.formio-component-currency {
display: inline-grid;
//Fallback
display: grid;
div.col-form-label {
order: 0;
}
div.text-muted {
order: 1;
margin-bottom: 0.25rem;
}
div.formio-errors {
order: 2;
margin-bottom: 0.5rem;
}
div[ref="element"],
div.row,
div.form-radio,
div.checkbox,
div.address-autocomplete-container {
order: 3;
}
}

//Can be affected by above grid
.formio-component-submitButton,
.formio-component-submit,
.formio-component-form,
.fieldset-body {
display: block !important;
}

//Add default margins to sections and fieldsets
fieldset {
margin: 1rem 0 1rem 0;
//nested fieldsets
.fieldset-body {
label {
font-weight: $labelWeight;
}
}
}

//Workarounds -----------------------------------------------------
//Workarounds for instances where panel/card is applied to form body
.border {
border: $none;
}
.card {
position: relative;
display: inherit !important;
flex-direction: inherit !important;
min-width: inherit !important;
word-wrap: inherit !important;
background-color: white;
background-clip: inherit !important;
border: none !important;
border-radius: 0 !important;
}
.card-body {
display: inherit !important;
min-height: inherit !important;
padding: inherit !important;
}

//Turn off wizard/panel nav
nav,
div[ref="header"] {
display: none !important;
}
}
36 changes: 36 additions & 0 deletions src/assets/_project/_blocks/scss-general/_qg-variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -187,3 +187,39 @@ $tables-processing-border-color: #dddddd;
$tables-processing-color: #999999;
$tables-paginate-disabled-previous-color: #939393;
$tables-paginate-enabled-previous-next-color: #111111;

// forms
$fontFace: inherit;
$defaultRem: 1rem !important;

$labelHeadingColour: #000;
$labelHeadingSize: 20px;
$labelHeadingWeight: 900;

$labelSize: 16px;
$labelColour: #000;
$labelWeight: 600;

$hintSize: 16px;
$hintColour: #767676 !important;
$hintWeight: 400;
$borderRadius: 4px;
$borderWidth: 3px;
$none: 0px !important;
$checkboxWeight: 400;

$inputHeight: 46px;
$inputWidth: 100%;
$inputBackground: #fff;

$SecondaryColor: #005e85 !important;
$buttonSecondaryBackground: transparent !important;
$buttonSecondaryBorder: 3px solid $SecondaryColor;

$defaultBorder: #ebebeb;
$disabledBorder: #ebebeb;
$focusBorder: #9263de;
$alertBorder: #ed1b2f;
$alertDangerBackground: #fdf0f0;
$alertWarningBorder: #f9af71;
$alertWarningBackground: #ffedde;