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

Added a dropdown variation with radio buttons in dropdown items #362

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
39 changes: 39 additions & 0 deletions source/_patterns/00-atomer/01-forms/52-flervalg-med-knapper.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"dropdown-name": "Test",
"dropdown-number": "123",
"dropdown-number-prefix": "",
"icon-prefix": "ai",
"icon-class": "ai-expand",
"icon-extra-class": "ai-down",
"isTransparent": true,
"show-label": true,
"label-text": "",
"dropdown-items": [
{
"radio-legend": {
"radio-legendText": ""
},
"isStacked": "custom-controls-stacked",
"radiobuttons": [
{
"isInline" : false,
"radiobutton-title": "Les-,skriv- og signeringsrett",
"radiobutton-id": "radio10",
"radio-class":"a-dropdown-item-border"
},
{
"isInline" : false,
"radiobutton-title": "Lese- og skriverettigheter",
"radiobutton-id": "radio11",
"radio-class":"a-dropdown-item-border"
},
{
"isInline" : false,
"radiobutton-title": "Leserett",
"radiobutton-id": "radio11",
"radio-class":"a-dropdown-item-border"
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
state: inprogress altinnett
version: 0
---
Brukes når brukeren skal velge et av flere alternativ. Denne varianten er med radioknapp, og vil se ulik ut basert på hvilket operativsystem brukeren benytter.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<div class="form-group input-group transparent a-js-forceFlexColumn a-form-group"{{# aria-describedby }} aria-describedby="{{ aria-describedby }}"{{/ aria-describedby }}>
<div data-toggle="altinn-dropdown" class="dropdown{{# isTransparent }} a-transparent {{/ isTransparent }}a-fullWidthXs">
<input type="hidden" class="a-js-altinnDropdown-value"{{# defaultValue }} value="{{ defaultValue }}"{{/ defaultValue }} />
<button class="btn a-dropdown-toggle form-control-alt {{# extraDropdownClass }}{{ extraDropdownClass }}{{/ extraDropdownClass }} a-js-dropdownToValidate" type="button" id="dropdownMenu" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" {{# isRequired }}required{{/ isRequired }}>
{{> atomer-ikon }}
<span class="a-form-text {{ dropdown-name-class }}">
{{ dropdown-name }}
</span>
</button>
<div class="dropdown-menu a-dropdown-menu" aria-labelledby="dropdownMenu">
{{# dropdown-items }}
<div>
{{> atomer-radioknapp-stacked }}
</div>
{{/ dropdown-items }}
</div>
</div>
<div class="a-message a-message-error a-js-adjustedError" data-valmsg-for="{{ input-name }}" data-valmsg-replace="false">
<span class="has-error">{{# data-required }}{{ data-required-message }}{{/ data-required }}</span>
</div>
</div>
23 changes: 23 additions & 0 deletions source/css/scss-common/base/_forms.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1042,3 +1042,26 @@ textarea {
border: none;
opacity: 0.1;
}

.a-dropdown-item-border {
position: relative;
min-height: $spacer * 3;
white-space: normal;
border-bottom: 1px solid $grey-light;

&:hover,
&:focus {
// sass-lint:disable-block no-important
//background-color: $blue-light;
border-bottom: 1px solid $grey-light;
box-shadow: none !important;
}

&:last-child {
border-bottom: none;
}
}

.ai-down {
transform: scale( 0.75 ) rotate( 90deg );
}