diff --git a/src/Foundation.hs b/src/Foundation.hs index 718c1c705..047e3f670 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -1035,9 +1035,11 @@ siteLayout' headingOverride widget = do addStylesheet $ StaticR css_utils_asyncForm_scss addStylesheet $ StaticR css_utils_asyncTable_scss addStylesheet $ StaticR css_utils_asyncTableFilter_scss + addStylesheet $ StaticR css_utils_checkbox_scss addStylesheet $ StaticR css_utils_form_scss addStylesheet $ StaticR css_utils_inputs_scss addStylesheet $ StaticR css_utils_modal_scss + addStylesheet $ StaticR css_utils_radio_scss addStylesheet $ StaticR css_utils_showHide_scss addStylesheet $ StaticR css_utils_tabber_scss addStylesheet $ StaticR css_utils_tooltip_scss diff --git a/static/css/utils/checkbox.scss b/static/css/utils/checkbox.scss new file mode 100644 index 000000000..4cab1568e --- /dev/null +++ b/static/css/utils/checkbox.scss @@ -0,0 +1,74 @@ + +/* CUSTOM CHECKBOXES */ +/* Completely replaces legacy checkbox */ +.checkbox { + position: relative; + display: inline-block; + + [type="checkbox"] { + position: fixed; + top: -1px; + left: -1px; + width: 1px; + height: 1px; + overflow: hidden; + } + + label { + display: block; + height: 24px; + width: 24px; + background-color: #f3f3f3; + box-shadow: inset 0 1px 2px 1px rgba(50, 50, 50, 0.05); + border: 2px solid var(--color-primary); + border-radius: 4px; + color: white; + cursor: pointer; + } + + label::before, + label::after { + position: absolute; + display: block; + top: 12px; + left: 8px; + height: 2px; + width: 8px; + background-color: var(--color-font); + } + + :checked + label { + background-color: var(--color-primary); + } + + [type="checkbox"]:focus + label { + border-color: #3273dc; + box-shadow: 0 0 0 0.125em rgba(50,115,220,.25); + outline: 0; + } + + :checked + label::before, + :checked + label::after { + content: ''; + } + + :checked + label::before { + background-color: white; + transform: rotate(45deg); + left: 4px; + } + + :checked + label::after { + background-color: white; + transform: rotate(-45deg); + top: 11px; + width: 13px; + } + + [disabled] + label { + pointer-events: none; + border: none; + opacity: 0.6; + filter: grayscale(1); + } +} diff --git a/static/css/utils/inputs.scss b/static/css/utils/inputs.scss index f30155892..05f60e294 100644 --- a/static/css/utils/inputs.scss +++ b/static/css/utils/inputs.scss @@ -183,130 +183,6 @@ option { } } -/* CUSTOM LEGACY CHECKBOX AND RADIO BOXES */ -input[type="checkbox"] { - position: relative; - height: 20px; - width: 20px; - -webkit-appearance: none; - appearance: none; - cursor: pointer; -} -input[type="checkbox"]::before { - content: ''; - position: absolute; - width: 20px; - height: 20px; - background-color: var(--color-lighter); - display: flex; - align-items: center; - justify-content: center; - border-radius: 2px; -} -input[type="checkbox"]:checked::before { - background-color: var(--color-light); -} -input[type="checkbox"]:checked::after { - content: '✓'; - position: absolute; - width: 20px; - height: 20px; - display: flex; - align-items: center; - justify-content: center; - color: white; - font-size: 20px; -} - -/* CUSTOM CHECKBOXES AND RADIO BOXES */ -/* Completely replaces legacy checkbox and radiobox */ -.checkbox, -.radio { - position: relative; - display: inline-block; - - [type="checkbox"], - [type="radio"] { - position: fixed; - top: -1px; - left: -1px; - width: 1px; - height: 1px; - overflow: hidden; - } - - label { - display: block; - height: 24px; - width: 24px; - background-color: #f3f3f3; - box-shadow: inset 0 1px 2px 1px rgba(50, 50, 50, 0.05); - border: 2px solid var(--color-primary); - border-radius: 4px; - color: white; - cursor: pointer; - } - - label::before, - label::after { - position: absolute; - display: block; - top: 12px; - left: 8px; - height: 2px; - width: 8px; - background-color: var(--color-font); - } - - :checked + label { - background-color: var(--color-primary); - } - - [type="checkbox"]:focus + label, - [type="radio"]:focus + label { - border-color: #3273dc; - box-shadow: 0 0 0 0.125em rgba(50,115,220,.25); - outline: 0; - } - - :checked + label::before, - :checked + label::after { - content: ''; - } - - :checked + label::before { - background-color: white; - transform: rotate(45deg); - left: 4px; - } - - :checked + label::after { - background-color: white; - transform: rotate(-45deg); - top: 11px; - width: 13px; - } - - [disabled] + label { - pointer-events: none; - border: none; - opacity: 0.6; - filter: grayscale(1); - } -} - -.radio::before { - content: ''; - position: absolute; - top: 2px; - left: 2px; - right: 2px; - bottom: 2px; - border-radius: 4px; - border: 2px solid white; - z-index: -1; -} - /* CUSTOM FILE INPUT */ .file-input__label { cursor: pointer; diff --git a/static/css/utils/radio.scss b/static/css/utils/radio.scss new file mode 100644 index 000000000..f32cf073a --- /dev/null +++ b/static/css/utils/radio.scss @@ -0,0 +1,86 @@ + +/* CUSTOM RADIO BOXES */ +/* Completely replaces legacy radiobox */ +.radio { + position: relative; + display: inline-block; + + [type="radio"] { + position: fixed; + top: -1px; + left: -1px; + width: 1px; + height: 1px; + overflow: hidden; + } + + label { + display: block; + height: 24px; + width: 24px; + background-color: #f3f3f3; + box-shadow: inset 0 1px 2px 1px rgba(50, 50, 50, 0.05); + border: 2px solid var(--color-primary); + border-radius: 4px; + color: white; + cursor: pointer; + } + + label::before, + label::after { + position: absolute; + display: block; + top: 12px; + left: 8px; + height: 2px; + width: 8px; + background-color: var(--color-font); + } + + :checked + label { + background-color: var(--color-primary); + } + + [type="radio"]:focus + label { + border-color: #3273dc; + box-shadow: 0 0 0 0.125em rgba(50,115,220,.25); + outline: 0; + } + + :checked + label::before, + :checked + label::after { + content: ''; + } + + :checked + label::before { + background-color: white; + transform: rotate(45deg); + left: 4px; + } + + :checked + label::after { + background-color: white; + transform: rotate(-45deg); + top: 11px; + width: 13px; + } + + [disabled] + label { + pointer-events: none; + border: none; + opacity: 0.6; + filter: grayscale(1); + } +} + +.radio::before { + content: ''; + position: absolute; + top: 2px; + left: 2px; + right: 2px; + bottom: 2px; + border-radius: 4px; + border: 2px solid white; + z-index: -1; +}