mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Add new layout for cart sidebar
This commit is contained in:
77
app/assets/stylesheets/darkswarm/cart-dropdown.css.scss
Normal file
77
app/assets/stylesheets/darkswarm/cart-dropdown.css.scss
Normal file
@@ -0,0 +1,77 @@
|
||||
@import "mixins";
|
||||
@import "variables";
|
||||
@import "branding";
|
||||
|
||||
.expanding-sidebar.cart-sidebar {
|
||||
.sidebar {
|
||||
padding: 0;
|
||||
background-color: $white;
|
||||
}
|
||||
|
||||
.cart-header {
|
||||
padding: 1em;
|
||||
border-bottom: 1px solid $grey-100;
|
||||
|
||||
.title {
|
||||
color: $grey-800;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.close {
|
||||
color: $grey-500;
|
||||
float: right;
|
||||
|
||||
i {
|
||||
vertical-align: middle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cart-content {
|
||||
margin-bottom: $sidebar-footer-height + 2em;
|
||||
}
|
||||
|
||||
table {
|
||||
width: 100%;
|
||||
border: none;
|
||||
border-spacing: 0;
|
||||
margin: 0;
|
||||
|
||||
tr.product-cart {
|
||||
background-color: white;
|
||||
|
||||
td {
|
||||
border-bottom: 1px solid $grey-100;
|
||||
padding: 0.75em 1em 0.5em 1em;
|
||||
vertical-align: top;
|
||||
|
||||
&.image {
|
||||
width: 42px;
|
||||
padding: 0.5em 0 0.5em 1em;
|
||||
}
|
||||
|
||||
span {
|
||||
color: $grey-800;
|
||||
font-size: 16px;
|
||||
line-height: 1.25;
|
||||
}
|
||||
|
||||
img {
|
||||
max-width: 56px;
|
||||
max-height: 56px;
|
||||
}
|
||||
|
||||
.options-text {
|
||||
color: $grey-500;
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.cart-total {
|
||||
color: $white;
|
||||
text-align: center;
|
||||
margin: -0.5em 0 0.75em 0;
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
%span.cart-span{"ng-controller" => "CartCtrl", "ng-class" => "{ dirty: Cart.dirty || Cart.empty(), 'pure-dirty': Cart.dirty }"}
|
||||
%a#cart.icon{"cart-toggle" => true}
|
||||
%a#cart.icon{"ng-click" => "toggleCartSidebar()"}
|
||||
%span
|
||||
= t '.cart'
|
||||
%span.count
|
||||
%img{ src: image_path("menu/icn-cart.svg") }
|
||||
%span
|
||||
{{ Cart.total_item_count() }}
|
||||
|
||||
= render 'shared/menu/joyride'
|
||||
|
||||
@@ -1,8 +1,34 @@
|
||||
.cart-sidebar{ng: {show: 'showCartSidebar', class: "{'shown': showCartSidebar, 'hidden': !showCartSidebar}"}}
|
||||
.expanding-sidebar.cart-sidebar{ng: {controller: 'CartCtrl', show: 'showCartSidebar', class: "{'shown': showCartSidebar, 'hidden': !showCartSidebar}"}}
|
||||
.background{ng: {click: 'toggleCartSidebar()'}}
|
||||
.sidebar
|
||||
.cart-header
|
||||
%span.title
|
||||
5 items in your cart
|
||||
%span.close
|
||||
Close
|
||||
%i.ofn-i_009-close
|
||||
.cart-content
|
||||
%table
|
||||
%tr.product-cart{"ng-repeat" => "line_item in Cart.line_items", "id" => "cart-variant-{{ line_item.variant.id }}"}
|
||||
%td.image
|
||||
%img{'ng-src' => '{{ line_item.variant.thumb_url }}'}
|
||||
%td
|
||||
%span {{ line_item.variant.extended_name }}
|
||||
%br
|
||||
%span.options-text {{ line_item.variant.options_text }}
|
||||
%td.text-right
|
||||
%span.quantity {{ line_item.quantity }}
|
||||
%td
|
||||
%span.total-price.right {{ line_item.total_price | localizeCurrency }}
|
||||
|
||||
.sidebar-footer
|
||||
%button.large.dark.left{type: 'button'}
|
||||
Edit Cart
|
||||
%button.large.bright.right{type: 'button', ng: {click: 'toggleCartSidebar()'}}
|
||||
Checkout
|
||||
%p.cart-total{"ng-show" => "Cart.line_items.length > 0"}
|
||||
%strong
|
||||
= t 'total'
|
||||
\:
|
||||
{{ Cart.total() | localizeCurrency }}
|
||||
|
||||
%button.large.dark.left{href: main_app.cart_path, "ng-disabled" => "Cart.dirty || Cart.empty()", "ng-class" => "{ dirty: Cart.dirty }"}
|
||||
= "{{ Cart.dirty ? '#{t(:cart_updating)}' : (Cart.empty() ? '#{t(:cart_empty)}' : '#{t(:cart_edit)}' ) }}"
|
||||
%button.large.bright.right{href: main_app.checkout_path, "ng-disabled" => "Cart.dirty || Cart.empty()"}
|
||||
= t '.checkout'
|
||||
|
||||
Reference in New Issue
Block a user