mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-09-08 22:53:12 -04:00
Add grey lines to visually show level of nesting
Uses some CSS to draw some grey lines to show which radios descend from which. I don’t feel like the intentation is enough, and it looks a bit messy because the circles of the radio buttons don’t have straight edges easily suggest visual alignment. Copies the design from conditionally revealing content in the design system: https://design-system.service.gov.uk/components/radios/#conditionally-revealing-content Implementation is done with pseudo elements, because borders can’t be positionned exactly enough.
This commit is contained in:
@@ -251,11 +251,6 @@ details .arrow {
|
|||||||
cursor: default;
|
cursor: default;
|
||||||
}
|
}
|
||||||
|
|
||||||
.multiple-choice > .panel {
|
|
||||||
border-left: none;
|
|
||||||
padding: 0 0 0 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.heading-inline {
|
.heading-inline {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -57,11 +57,11 @@
|
|||||||
border: 2px solid $black;
|
border: 2px solid $black;
|
||||||
outline: 1px solid rgba($white, 0.1);
|
outline: 1px solid rgba($white, 0.1);
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1000;
|
z-index: 10;
|
||||||
color: $text-colour;
|
color: $text-colour;
|
||||||
|
|
||||||
&:focus {
|
&:focus {
|
||||||
z-index: 10;
|
z-index: 1000;
|
||||||
outline: 3px solid $yellow;
|
outline: 3px solid $yellow;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,3 +57,60 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.radios-nested {
|
||||||
|
|
||||||
|
margin-bottom: 10px;
|
||||||
|
|
||||||
|
.multiple-choice {
|
||||||
|
|
||||||
|
$circle-diameter: 39px;
|
||||||
|
$border-thickness: 4px;
|
||||||
|
$border-indent: ($circle-diameter / 2) - ($border-thickness / 2);
|
||||||
|
|
||||||
|
float: none;
|
||||||
|
position: relative;
|
||||||
|
|
||||||
|
&:before {
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
bottom: 0;
|
||||||
|
left: $border-indent;
|
||||||
|
width: $border-thickness;
|
||||||
|
height: 100%;
|
||||||
|
background: $border-colour;
|
||||||
|
}
|
||||||
|
|
||||||
|
label {
|
||||||
|
float: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
[type=radio]+label::before {
|
||||||
|
// To overlap the grey inset line
|
||||||
|
background: $white;
|
||||||
|
}
|
||||||
|
|
||||||
|
ul {
|
||||||
|
// To equalise the spacing between the line and the top/bottom of
|
||||||
|
// the radio
|
||||||
|
margin-top: 5px;
|
||||||
|
margin-bottom: -5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.block-label-hint {
|
||||||
|
&:after {
|
||||||
|
// Adds an little extra segment of line alongside the ‘current folder’
|
||||||
|
// hint so that it extends all the way down to the next radio
|
||||||
|
content: "";
|
||||||
|
position: absolute;
|
||||||
|
bottom: -5px;
|
||||||
|
left: $border-indent;
|
||||||
|
width: $border-thickness;
|
||||||
|
height: 25px;
|
||||||
|
background: $border-colour;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -19,10 +19,9 @@
|
|||||||
options,
|
options,
|
||||||
child_map,
|
child_map,
|
||||||
disable=[],
|
disable=[],
|
||||||
option_hints={},
|
option_hints={}
|
||||||
top_level=False
|
|
||||||
) %}
|
) %}
|
||||||
<ul{% if not top_level %} class="panel panel-border-narrow"{% endif %}>
|
<ul>
|
||||||
{% for option in options %}
|
{% for option in options %}
|
||||||
{% if child_map[option.data] %}
|
{% if child_map[option.data] %}
|
||||||
{% call radio(option, disable, option_hints, as_list_item=True) %}
|
{% call radio(option, disable, option_hints, as_list_item=True) %}
|
||||||
@@ -47,7 +46,9 @@
|
|||||||
{% call radios_wrapper(
|
{% call radios_wrapper(
|
||||||
field, hint, disable, option_hints, hide_legend
|
field, hint, disable, option_hints, hide_legend
|
||||||
) %}
|
) %}
|
||||||
{{ radio_list(child_map[None], child_map, disable, option_hints, top_level=True) }}
|
<div class="radios-nested">
|
||||||
|
{{ radio_list(child_map[None], child_map, disable, option_hints) }}
|
||||||
|
</div>
|
||||||
{% endcall %}
|
{% endcall %}
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user