From 07e01bcc93d21105435cc295296e05f9a975f1d6 Mon Sep 17 00:00:00 2001 From: Egor Savkin Date: Wed, 13 Dec 2023 17:35:17 +0800 Subject: [PATCH] Crates UI fixes TODO ex .rfqFeedback fixes Signed-off-by: Egor Savkin --- sass/css/_shop.scss | 51 ++++++++++++++++++++++++----------- static/css/order-hardware.css | 28 ++++++++++++++++--- static/js/shop/Crate.jsx | 11 ++++---- static/js/shop/CrateList.jsx | 5 ++-- static/js/shop/shop_store.js | 2 +- 5 files changed, 67 insertions(+), 30 deletions(-) diff --git a/sass/css/_shop.scss b/sass/css/_shop.scss index 02dfa5d..5c71fbc 100644 --- a/sass/css/_shop.scss +++ b/sass/css/_shop.scss @@ -201,22 +201,6 @@ button { width: 50%; padding-right: 30px; } - .crate-mode { - text-align: right; - width: 50%; - - a { - cursor: pointer; - margin-right: 1rem; - color: inherit; - text-decoration: none; - padding-bottom: 5px; - } - a.active { - font-weight: 700; - border-bottom: 3px solid $btn-primary-2; - } - } } .summary { @@ -555,6 +539,41 @@ button { .crate-info { padding: 1rem 0 0; } + + .crate-bar { + width: 100%; + + .crate-mode { + text-align: left; + width: 75%; + display: inline; + + a { + cursor: pointer; + margin-right: 1rem; + color: inherit; + text-decoration: none; + padding-bottom: 5px; + } + a.active { + font-weight: 700; + border-bottom: 3px solid $btn-primary-2; + } + } + .delete-crate { + text-decoration: none; + cursor: pointer; + text-align: right; + display: inline-flex; + width: 25%; + color: inherit; + img { + margin-left: 1rem; + align-self: center; + } + } + } + } } diff --git a/static/css/order-hardware.css b/static/css/order-hardware.css index 433172d..d7c4ea3 100644 --- a/static/css/order-hardware.css +++ b/static/css/order-hardware.css @@ -61,6 +61,26 @@ text-decoration: none; } +#accordion_crates #accordion_crates_add .accordion-button:after { + background-image: url("/images/shop/icon-add.svg"); +} + +#accordion_crates .accordion-header button { + font-weight: bold; +} + +#accordion_crates, +#accordion_crates .accordion-header, +#accordion_crates .accordion-button, +#accordion_crates .accordion-item { + background-color: inherit; +} + +#accordion_crates .accordion-button:not(.collapsed) { + background-color: rgba(26, 109, 147, 0.1); +} + + /* ##Device = Tablets, Ipads (portrait) ##Screen = B/w 768px to 1024px @@ -108,11 +128,11 @@ } #root-shop .panel .control > .description, - #root-shop .panel .control > .crate-mode { + #root-shop .crate-mode { width: 100%; } - #root-shop .panel .control > .crate-mode { + #root-shop .crate-mode { text-align: left; } @@ -308,11 +328,11 @@ } #root-shop .panel .control > .description, - #root-shop .panel .control > .crate-mode { + #root-shop .crate-mode { width: 100%; } - #root-shop .panel .control > .crate-mode { + #root-shop .crate-mode { text-align: left; } diff --git a/static/js/shop/Crate.jsx b/static/js/shop/Crate.jsx index e5f8a37..b59ca3e 100644 --- a/static/js/shop/Crate.jsx +++ b/static/js/shop/Crate.jsx @@ -20,13 +20,12 @@ export function Crate({crate_index}) { return (
- +
+ -
- Delete crate - +
onDeleteCrate(crate.id)}> + Delete crate remove +
diff --git a/static/js/shop/CrateList.jsx b/static/js/shop/CrateList.jsx index e23e11c..f99ca71 100644 --- a/static/js/shop/CrateList.jsx +++ b/static/js/shop/CrateList.jsx @@ -16,7 +16,7 @@ export function CrateList() { setActiveCrate: state.setActiveCrate, })); return ( - { + { // if e === null, that means that an accordion item was collapsed rather than expanded. e will be non-null when an item is expanded if (e !== null) setActiveCrate(e); @@ -31,10 +31,9 @@ export function CrateList() { )} - + Add new crate - add ) diff --git a/static/js/shop/shop_store.js b/static/js/shop/shop_store.js index a205fef..e686395 100644 --- a/static/js/shop/shop_store.js +++ b/static/js/shop/shop_store.js @@ -356,7 +356,7 @@ const useCart = ((set, get) => ({ setCrateMode: (id, mode) => { get()._setCrateMode(id, mode) get().fillWarnings(id); - get().setActiveCrate(crate_to); + get().setActiveCrate(id); }, addCardFromBacklog: (crate_to, index_from, index_to, just_mounted) => {