Skip to content

Commit

Permalink
Add custom autocomplete stylesheet
Browse files Browse the repository at this point in the history
This is copied from the prototype and includes some overrides to make it
align to the NHS styles better.
  • Loading branch information
tvararu committed Sep 27, 2024
1 parent 4658c92 commit e35c046
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 0 deletions.
44 changes: 44 additions & 0 deletions app/assets/stylesheets/_autocomplete.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
// Ensure the autocomplete uses the correct typeface
.autocomplete__wrapper {
font-family: $govuk-font-family;
}

.autocomplete__input {
font-family: inherit;
}

// Style the autocomplete if there’s an error
.nhsuk-form-group--error {
.autocomplete__input {
border-color: $govuk-error-colour;
}

.autocomplete__input--focused {
border-color: $govuk-input-border-colour;
}
}

.autocomplete__dropdown-arrow-down {
// Ensure dropdown arrow can be clicked
// https://github.com/alphagov/accessible-autocomplete/issues/202
pointer-events: none;
// Ensure dropdown arrow can be seen
z-index: 0;
}

.autocomplete__input {
background-color: $color_nhsuk-white;
}

.autocomplete__option {
margin-bottom: 0;
}

.autocomplete__option-hint {
color: $nhsuk-secondary-text-color;

.autocomplete__option:hover &,
.autocomplete__option:focus & {
color: $color_nhsuk-grey-5;
}
}
1 change: 1 addition & 0 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ $color_app-dark-orange: darken(

// Application components
@import "action_list";
@import "autocomplete";
@import "button";
@import "button-group";
@import "card";
Expand Down

0 comments on commit e35c046

Please sign in to comment.