-
Notifications
You must be signed in to change notification settings - Fork 194
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This builds on the [Accordion component](https://components.publishing.service.gov.uk/component-guide/accordion) and applies some custom styling. I’ve also updated the tests to check the panels are expanded when a filter is present.
- Loading branch information
Showing
5 changed files
with
181 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
...gines/content_block_manager/app/assets/stylesheets/content_block_manager/application.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
@import "components/filter-options-component"; | ||
@import "components/timeline-component"; |
62 changes: 62 additions & 0 deletions
62
...er/app/assets/stylesheets/content_block_manager/components/_filter-options-component.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
.app-c-content-block-manager-filter-options { | ||
.govuk-accordion__section-toggle, | ||
.govuk-accordion__controls .govuk-accordion-nav__chevron { | ||
@include govuk-visually-hidden; | ||
} | ||
|
||
@mixin chevron($dir) { | ||
&:before { | ||
border-style: solid; | ||
border-width: 0.2em 0.2em 0 0; | ||
content: ""; | ||
display: inline-block; | ||
height: 0.45em; | ||
left: 0.15em; | ||
position: relative; | ||
vertical-align: top; | ||
width: 0.45em; | ||
|
||
@include govuk-responsive-margin(3, "right"); | ||
|
||
@if $dir == "down" { | ||
top: 0.2em; | ||
transform: rotate(135deg); | ||
} | ||
|
||
@if $dir == "up" { | ||
top: 0.35em; | ||
transform: rotate(-45deg); | ||
} | ||
} | ||
} | ||
|
||
.govuk-accordion__controls { | ||
.govuk-accordion__show-all { | ||
.govuk-accordion__show-all-text { | ||
@include govuk-font($size: 19, $weight: bold); | ||
color: govuk-colour("black"); | ||
@include chevron("down"); | ||
} | ||
|
||
&[aria-expanded="true"] { | ||
.govuk-accordion__show-all-text { | ||
@include chevron("up"); | ||
} | ||
} | ||
} | ||
} | ||
|
||
.govuk-accordion__section-button { | ||
.govuk-accordion__section-heading-text { | ||
@include govuk-font($size: 19, $weight: bold); | ||
|
||
@include chevron("down"); | ||
} | ||
|
||
&[aria-expanded="true"] { | ||
.govuk-accordion__section-heading-text { | ||
@include chevron("up"); | ||
} | ||
} | ||
} | ||
} |
88 changes: 60 additions & 28 deletions
88
...ents/content_block_manager/content_block/document/index/filter_options_component.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
89 changes: 57 additions & 32 deletions
89
...ock_manager/test/components/content_block/document/index/filter_options_component_test.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters