From fedfeb6dd33688a7fa995533f81c59cf267e5f77 Mon Sep 17 00:00:00 2001 From: Matt-Yorkley <9029026+Matt-Yorkley@users.noreply.github.com> Date: Sat, 29 Jan 2022 18:05:32 +0000 Subject: [PATCH] Add dropdown "primary" style with blue instead of white --- .../admin/adjustments/_new_form.html.haml | 3 ++- .../css/admin/components/tom_select.scss | 21 +++++++++++++++++++ spec/system/admin/adjustments_spec.rb | 2 +- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/app/views/spree/admin/adjustments/_new_form.html.haml b/app/views/spree/admin/adjustments/_new_form.html.haml index bed8b33288..295ccf3035 100644 --- a/app/views/spree/admin/adjustments/_new_form.html.haml +++ b/app/views/spree/admin/adjustments/_new_form.html.haml @@ -11,7 +11,8 @@ = select_tag "adjustment[tax_category_id]", options_from_collection_for_select(Spree::TaxCategory.all, :id, :name), prompt: t(:none), - "data-controller": "tom-select" + "data-controller": "tom-select", + class: "primary" = f.error_message_on :tax_category .row diff --git a/app/webpacker/css/admin/components/tom_select.scss b/app/webpacker/css/admin/components/tom_select.scss index 211d38d276..af2d3bf731 100644 --- a/app/webpacker/css/admin/components/tom_select.scss +++ b/app/webpacker/css/admin/components/tom_select.scss @@ -19,6 +19,27 @@ background-color: $white; } +.ts-wrapper.primary.focus .ts-control, +.ts-wrapper.primary .ts-control { + background-color: $spree-blue; + border-color: $spree-blue; + color: $white; + + &:after { + border-color: $white transparent transparent transparent; + } +} + +.ts-wrapper.dropdown-active.primary .ts-control { + background-color: $spree-green; + border-color: $spree-green; + color: $white; + + &:after { + border-color: transparent transparent $white transparent; + } +} + .dropdown-input-wrap { padding: 0.2em; diff --git a/spec/system/admin/adjustments_spec.rb b/spec/system/admin/adjustments_spec.rb index 51e6397003..c4ceff76d1 100644 --- a/spec/system/admin/adjustments_spec.rb +++ b/spec/system/admin/adjustments_spec.rb @@ -38,7 +38,7 @@ describe ' click_link 'New Adjustment' fill_in 'adjustment_amount', with: 110 fill_in 'adjustment_label', with: 'Late fee' - select2_select 'GST', from: 'adjustment_tax_category_id' + select 'GST', from: 'adjustment_tax_category_id' click_button 'Continue' # Then I should see the adjustment, with the correct tax