Skip to content
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
35 changes: 14 additions & 21 deletions app/assets/stylesheets/components/_language-picker.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,6 @@
}
}

&::after {
content: '';
display: block;
width: 0.8125rem;
height: 0.8125rem;
background-size: 0.8125rem;
}

&.usa-accordion__button[aria-expanded='false'],
&.usa-accordion__button[aria-expanded='true'] {
background-image: none;
Expand All @@ -60,28 +52,29 @@
&:hover {
background-color: transparent;
}

&::after {
background-image: url('/angle-arrow-up.svg');

@include at-media('tablet') {
background-image: url('/angle-arrow-up-white.svg');
}
}
}

&.usa-accordion__button[aria-expanded='true'] {
@include u-bg('primary');
color: color('white');

&::after {
background-image: url('/angle-arrow-down-white.svg');
}
}
}

.language-picker__label-text {
margin: 0 units(1);
margin-left: units(1);
margin-right: units(0.5);
}

.language-picker__expander {
transition: transform $project-easing;

@media (prefers-reduced-motion) {
transition: none;
}

.usa-accordion__button[aria-expanded='false'] & {
transform: rotate(-180deg);
}
}

.language-picker__list {
Expand Down
1 change: 1 addition & 0 deletions app/components/language_picker_component.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<span id="language-picker-description-<%= unique_id %>" class="language-picker__label-text">
<%= t('i18n.language') %>
</span>
<%= render IconComponent.new(icon: :expand_more, size: 3, class: 'language-picker__expander') %>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The specific use of the expand_more was intentional to enable reuse / caching with the same icon used in the banner for "Here's how you know".

Copy link
Contributor

Choose a reason for hiding this comment

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

if we wanted we could make add some sort of regression spec that makes sure those two link the same image? to encode the goal in our specs

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's an interesting thought, though I think it'd be tricky to implement in practice, since both load the image indirectly through CSS. I've been curious to use a bit more of the Chrome DevTools protocol like we did with browser emulation and that might be an option here (e.g. monitoring Network], but even with that could be hard to pinpoint what loads what.

<% end %>
<ul
id="language-picker-<%= unique_id %>"
Expand Down