Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Simplify stylesheets, give cart its own

Patryk Zawadzki2601c7921e0c
diff --git a/saleor/static/js/cart.js b/saleor/static/js/cart.js
index 78353b4e26..1f85494ec5 100644
--- a/saleor/static/js/cart.js
+++ b/saleor/static/js/cart.js
@@ -8,6 +8,8 @@ import { Provider } from 'react-redux'
import { CartItemAmount, CartItemSubtotal, CartTotal } from './components/cart'
import store from './stores/cart-store'
+import '../scss/cart.scss'
+
const options = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
$('.cart-item-amount').each(function(index) {
diff --git a/saleor/static/js/components/cart.js b/saleor/static/js/components/cart.js
index 76a1e60912..6877637b10 100644
--- a/saleor/static/js/components/cart.js
+++ b/saleor/static/js/components/cart.js
@@ -171,6 +171,7 @@ class CartItemAmountSelect extends Component {
const input = (
<div className={classNamesInput.join(' ')}>
<input
+ className="form-control"
id="id_quantity"
max={this.props.max}
min={1}
diff --git a/saleor/static/scss/_app.scss b/saleor/static/scss/_app.scss
deleted file mode 100644
index af79d61f57..0000000000
--- a/saleor/static/scss/_app.scss
+++ /dev/null
@@ -1,233 +0,0 @@
-$icon-font-path: "~bootstrap-sass/assets/fonts/bootstrap/";
-@import "~bootstrap-sass/assets/stylesheets/bootstrap";
-$fa-font-path: "~font-awesome/fonts";
-@import "~font-awesome/scss/font-awesome";
-
-.table > tbody > tr > td.noborder {
- border-top: 1px solid transparent;
-}
-
-.navbar {
- margin-bottom: $grid-gutter-width;
-}
-
-.price {
- &.undiscounted {
- text-decoration: line-through;
- }
-}
-
-.address-details {
- border-bottom: 1px dashed;
- color: #3a87ad;
- cursor: pointer;
-}
-
-.popover {
- min-width: 200px;
-}
-
-.product-list-item-name {
- display: block;
- margin-top: $grid-gutter-width/4;
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
-}
-
-.product-gallery {
- margin-top: $grid-gutter-width;
-}
-
-.product-related {
- .active {
- border: 1px solid $btn-primary-border;
- box-shadow: 0 0 5px $btn-primary-border;
- }
-}
-
-.product-form {
- .btn-group {
- display: block;
- overflow: hidden;
- }
-}
-
-.breadcrumb {
- > li+li {
- &:before {
- content: '/';
- }
- }
-}
-
-.cart {
- > tbody {
- > .cart-item {
- > td {
- vertical-align: text-bottom;
- }
- }
- }
-
- &-item {
- &-image {
- display: inline-block;
- max-width: 100%;
- }
-
- &-quantity {
- input {
- @extend .form-control;
-
- border-bottom-right-radius: 0;
- border-top-right-radius: 0;
- }
-
- &-select {
- display: inline-block;
- width: calc(100% - 71px);
-
- option {
- &:last-child {
- color: lighten($text-color, 33%);
- }
- }
- }
-
- &.has-error {
- input {
- border-color: $state-danger-text;
- }
- }
- }
-
- &-amount {
- .input-group {
- &.no-submit {
- display: inline-block;
- width: calc(100% - 71px);
-
- input {
- border-bottom-right-radius: $input-border-radius;
- border-top-right-radius: $input-border-radius;
- }
-
- .btn {
- display: none;
- }
- }
- }
-
- .fa {
- margin-left: 6px;
- padding-left: 1px;
- }
- }
-
- &-remove {
- padding-left: 0;
- }
-
- .error {
- display: block;
- }
- }
-}
-
-.nav {
- > li {
- > a {
- @extend .text-info;
- }
-
- &.active {
- > a, a:hover {
- background-color: $brand-info;
- }
- }
- }
-}
-
-.page-header {
- &--order {
- margin-top: $grid-gutter-width/3;
- }
-}
-
-.js {
- .js-hidden {
- display: none;
- }
-}
-
-.nav-pills {
- &.nav-wizard {
- > li {
- position: relative;
- overflow: visible;
- border-right: 15px solid $body-bg;
- border-left: 15px solid $body-bg;
-
- &:first-child {
- border-left: 0;
-
- a {
- border-radius:5px 0 0 5px;
- }
- }
-
- &:last-child {
- border-right: 0;
-
- a {
- border-radius:0 5px 5px 0;
- }
- }
-
- a {
- border-radius: 0;
- background-color: $gray-lighter;
- }
-
- .nav-arrow {
- position: absolute;
- top: 0px;
- right: -20px;
- width: 0px;
- height: 0px;
- border-style: solid;
- border-width: 20px 0 20px 20px;
- border-color: transparent transparent transparent $gray-lighter;
- z-index: 150;
- }
-
- .nav-wedge {
- position: absolute;
- top: 0px;
- left: -20px;
- width: 0px;
- height: 0px;
- border-style: solid;
- border-width: 20px 0 20px 20px;
- border-color: $gray-lighter $gray-lighter $gray-lighter transparent;
- z-index: 150;
- }
-
- &.active {
- .nav-arrow {
- border-color: transparent transparent transparent $nav-pills-active-link-hover-bg;
- }
-
- .nav-wedge {
- border-color: $nav-pills-active-link-hover-bg $nav-pills-active-link-hover-bg $nav-pills-active-link-hover-bg transparent;
- }
-
- a {
- background-color: $nav-pills-active-link-hover-bg;
- color: $nav-pills-active-link-hover-color;
- }
- }
- }
- }
-}
diff --git a/saleor/static/scss/_app_dashboard.scss b/saleor/static/scss/_app_dashboard.scss
deleted file mode 100644
index 280f66455a..0000000000
--- a/saleor/static/scss/_app_dashboard.scss
+++ /dev/null
@@ -1,339 +0,0 @@
-$roboto-font-path: "../fonts/";
-$icons-font-path: $roboto-font-path;
-
-$font-size-action-icon: 18px;
-$header-height: 60px;
-$transition-duration: .2s;
-
-$icons-font-path: "~materialize-sass-origin/font/material-design-icons/";
-$roboto-font-path: "~materialize-sass-origin/font/roboto/";
-@import "~materialize-sass-origin/sass/materialize";
-@import "~select2/src/scss/core";
-@import "~dropzone/dist/dropzone";
-
-.header {
- @media (min-width: $large-screen-up) {
- margin-left: 240px;
- }
-
- .top-nav {
- box-shadow: none;
- height: $header-height;
- margin-bottom: $gutter-width;
-
- .container {
- height: 100%;
- }
-
- .header-button {
- float: left;
- margin-right: $gutter-width;
-
- @media (min-width: $medium-screen-up) {
- display: none;
- }
-
- i {
- font-size: 2.7rem;
- height: $header-height;
- line-height: $header-height;
- }
- }
-
- .dropdown-button {
- float: right;
- line-height: $header-height/2;
- position: relative;
- top: $header-height/4;
-
- i {
- height: $header-height/2;
- line-height: $header-height/2;
- }
- }
-
- .dropdown-content {
- left: auto !important;
- right: 0;
- white-space: nowrap;
- }
- }
-
- .side-nav {
- padding-top: $header-height;
-
- li {
- display: block;
- padding: 0;
-
- &:after {
- @extend .divider;
- content: "";
- display: block;
- }
-
- li:after {
- content: none;
- }
-
- .body-home &.nav-home {
- @extend .active;
- }
-
- @each $submodule in (products, attributes, categories, orders, payments, customers, discounts, vouchers, sales) {
- .body-#{$submodule} &.subnav-#{$submodule} {
- @extend .active;
-
- a {
- background-color: map_get($materialize-red, lighten-2);
- }
- }
- }
-
- &.brand-logo {
- top: 0;
- width: 100%;
-
- &:hover {
- background: none;
- }
-
- &:after {
- content: none;
- }
-
- a {
- display: block;
- height: $header-height;
- padding: 0;
- text-align: center;
-
- img {
- height: 100%;
- padding: 15px 0;
- }
- }
- }
-
- &.side-nav-user {
- a {
- font-size: 14px;
- line-height: 64px;
- margin: 0;
-
- i {
- vertical-align: inherit;
- width: auto;
- margin: 0 5px;
-
- &:last-child {
- margin-right: 0;
- }
- }
- }
-
- ul ul {
- li {
- a {
- line-height: 52px;
- }
- }
- }
- }
-
- ul ul {
- li {
- a {
- background: map-get($grey, lighten-5);
- height: 52px;
- line-height: 52px;
- padding-left: 30px;
- transition: background-color $transition-duration;
-
- &:hover, &:focus {
- background-color: #ddd;
- }
- }
- }
- }
-
- .collapsible-header {
- margin: 0;
- }
-
- .collapsible-body {
- a {
- margin: 0;
- }
- }
-
- i {
- display: inline-block;
- float: none;
- }
- }
-
- > li {
- &:hover {
- background: none;
- }
- }
- }
-}
-
-.main {
- @media (min-width: $large-screen-up) {
- margin-left: 240px;
- }
-}
-
-.container {
- @media (min-width: $large-screen-up) {
- width: 85%;
- }
-}
-
-.modal-content {
- .row {
- margin: {
- left: -.75rem;
- right: -.75rem;
- }
- }
-}
-
-.page-title {
- display: block;
- font-size: $h5-fontsize;
- line-height: $header-height;
-
- @media (max-width: $medium-screen) {
- float: right;
- width: calc(100% - 38px - 1.5rem);
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- }
-}
-
-table {
- .row {
- .col {
- float: none;
- padding: $gutter-width/2;
-
- .responsive-img {
- display: block;
- }
- }
- }
-}
-
-.input-with-suffix input {
- float: left;
- width: calc(100% - 40px);
-}
-
-.input-text-suffix {
- float: right;
- line-height: 45px;
- text-align: right;
- width: 40px;
-}
-
-#modal-product-class {
- max-width: 300px;
-}
-
-.pagination li.disabled span {
- color: #999;
-}
-
-.btn-data-table {
- background: none;
- border: none;
- font-weight: bold;
- padding: 0;
- text-transform: uppercase;
-
- &:hover, &:focus {
- background: none;
- }
-}
-
-.fixed-action-btn {
- padding: 0;
-}
-
-.btn-fab {
- transition: transform $transition-duration, box-shadow $transition-duration;
-
- i {
- &:before {
- transition: font-size $transition-duration;
- }
- }
-}
-
-.btn-fab.btn-fab-hidden {
- transform: scaleX(0) scaleY(0);
-
- i {
- &:before {
- font-size: 0;
- }
- }
-}
-
-.card {
- img {
- display: block;
-
- @media (max-width: $small-screen) {
- width: 100%;
- }
- }
- overflow: initial;
-}
-
-.no-margin {
- margin: 0;
-}
-
-.switch-two-columns {
- @media (min-width: $large-screen) {
- float: left !important;
-
- &:first-child {
- float: right !important;
- }
- }
-}
-
-.text-lg {
- font-size: 120%;
-}
-
-#order-details {
- .order-summary {
- td {
- padding: 5px 5px;
- }
- }
-
- #order-notes {
- box-shadow: none;
- }
-}
-
-@import "widget/breadcrumbs";
-@import "widget/card";
-@import "widget/data-table";
-@import "widget/dropzone";
-@import "widget/form";
-@import "widget/list";
-@import "widget/product-gallery";
-@import "widget/ppoi";
-@import "widget/select2";
-@import "widget/tabs";
-@import "widget/toast";
diff --git a/saleor/static/scss/cart.scss b/saleor/static/scss/cart.scss
new file mode 100644
index 0000000000..b4ec915f49
--- /dev/null
+++ b/saleor/static/scss/cart.scss
@@ -0,0 +1,73 @@
+@import "~bootstrap-sass/assets/stylesheets/bootstrap/variables";
+
+.cart {
+ > tbody {
+ > .cart-item {
+ > td {
+ vertical-align: text-bottom;
+ }
+ }
+ }
+
+ &-item {
+ &-image {
+ display: inline-block;
+ max-width: 100%;
+ }
+
+ &-quantity {
+ input {
+ border-bottom-right-radius: 0;
+ border-top-right-radius: 0;
+ }
+
+ &-select {
+ display: inline-block;
+ width: calc(100% - 71px);
+
+ option {
+ &:last-child {
+ color: lighten($text-color, 33%);
+ }
+ }
+ }
+
+ &.has-error {
+ input {
+ border-color: $state-danger-text;
+ }
+ }
+ }
+
+ &-amount {
+ .input-group {
+ &.no-submit {
+ display: inline-block;
+ width: calc(100% - 71px);
+
+ input {
+ border-bottom-right-radius: $input-border-radius;
+ border-top-right-radius: $input-border-radius;
+ }
+
+ .btn {
+ display: none;
+ }
+ }
+ }
+
+ .fa {
+ margin-left: 6px;
+ padding-left: 1px;
+ }
+ }
+
+ &-remove {
+ padding-left: 0;
+ }
+
+ .error {
+ display: block;
+ }
+ }
+}
diff --git a/saleor/static/scss/dashboard.scss b/saleor/static/scss/dashboard.scss
index 154d1b9745..280f66455a 100644
--- a/saleor/static/scss/dashboard.scss
+++ b/saleor/static/scss/dashboard.scss
@@ -1 +1,339 @@
-@import "app_dashboard";
+$roboto-font-path: "../fonts/";
+$icons-font-path: $roboto-font-path;
+
+$font-size-action-icon: 18px;
+$header-height: 60px;
+$transition-duration: .2s;
+
+$icons-font-path: "~materialize-sass-origin/font/material-design-icons/";
+$roboto-font-path: "~materialize-sass-origin/font/roboto/";
+@import "~materialize-sass-origin/sass/materialize";
+@import "~select2/src/scss/core";
+@import "~dropzone/dist/dropzone";
+
+.header {
+ @media (min-width: $large-screen-up) {
+ margin-left: 240px;
+ }
+
+ .top-nav {
+ box-shadow: none;
+ height: $header-height;
+ margin-bottom: $gutter-width;
+
+ .container {
+ height: 100%;
+ }
+
+ .header-button {
+ float: left;
+ margin-right: $gutter-width;
+
+ @media (min-width: $medium-screen-up) {
+ display: none;
+ }
+
+ i {
+ font-size: 2.7rem;
+ height: $header-height;
+ line-height: $header-height;
+ }
+ }
+
+ .dropdown-button {
+ float: right;
+ line-height: $header-height/2;
+ position: relative;
+ top: $header-height/4;
+
+ i {
+ height: $header-height/2;
+ line-height: $header-height/2;
+ }
+ }
+
+ .dropdown-content {
+ left: auto !important;
+ right: 0;
+ white-space: nowrap;
+ }
+ }
+
+ .side-nav {
+ padding-top: $header-height;
+
+ li {
+ display: block;
+ padding: 0;
+
+ &:after {
+ @extend .divider;
+ content: "";
+ display: block;
+ }
+
+ li:after {
+ content: none;
+ }
+
+ .body-home &.nav-home {
+ @extend .active;
+ }
+
+ @each $submodule in (products, attributes, categories, orders, payments, customers, discounts, vouchers, sales) {
+ .body-#{$submodule} &.subnav-#{$submodule} {
+ @extend .active;
+
+ a {
+ background-color: map_get($materialize-red, lighten-2);
+ }
+ }
+ }
+
+ &.brand-logo {
+ top: 0;
+ width: 100%;
+
+ &:hover {
+ background: none;
+ }
+
+ &:after {
+ content: none;
+ }
+
+ a {
+ display: block;
+ height: $header-height;
+ padding: 0;
+ text-align: center;
+
+ img {
+ height: 100%;
+ padding: 15px 0;
+ }
+ }
+ }
+
+ &.side-nav-user {
+ a {
+ font-size: 14px;
+ line-height: 64px;
+ margin: 0;
+
+ i {
+ vertical-align: inherit;
+ width: auto;
+ margin: 0 5px;
+
+ &:last-child {
+ margin-right: 0;
+ }
+ }
+ }
+
+ ul ul {
+ li {
+ a {
+ line-height: 52px;
+ }
+ }
+ }
+ }
+
+ ul ul {
+ li {
+ a {
+ background: map-get($grey, lighten-5);
+ height: 52px;
+ line-height: 52px;
+ padding-left: 30px;
+ transition: background-color $transition-duration;
+
+ &:hover, &:focus {
+ background-color: #ddd;
+ }
+ }
+ }
+ }
+
+ .collapsible-header {
+ margin: 0;
+ }
+
+ .collapsible-body {
+ a {
+ margin: 0;
+ }
+ }
+
+ i {
+ display: inline-block;
+ float: none;
+ }
+ }
+
+ > li {
+ &:hover {
+ background: none;
+ }
+ }
+ }
+}
+
+.main {
+ @media (min-width: $large-screen-up) {
+ margin-left: 240px;
+ }
+}
+
+.container {
+ @media (min-width: $large-screen-up) {
+ width: 85%;
+ }
+}
+
+.modal-content {
+ .row {
+ margin: {
+ left: -.75rem;
+ right: -.75rem;
+ }
+ }
+}
+
+.page-title {
+ display: block;
+ font-size: $h5-fontsize;
+ line-height: $header-height;
+
+ @media (max-width: $medium-screen) {
+ float: right;
+ width: calc(100% - 38px - 1.5rem);
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ }
+}
+
+table {
+ .row {
+ .col {
+ float: none;
+ padding: $gutter-width/2;
+
+ .responsive-img {
+ display: block;
+ }
+ }
+ }
+}
+
+.input-with-suffix input {
+ float: left;
+ width: calc(100% - 40px);
+}
+
+.input-text-suffix {
+ float: right;
+ line-height: 45px;
+ text-align: right;
+ width: 40px;
+}
+
+#modal-product-class {
+ max-width: 300px;
+}
+
+.pagination li.disabled span {
+ color: #999;
+}
+
+.btn-data-table {
+ background: none;
+ border: none;
+ font-weight: bold;
+ padding: 0;
+ text-transform: uppercase;
+
+ &:hover, &:focus {
+ background: none;
+ }
+}
+
+.fixed-action-btn {
+ padding: 0;
+}
+
+.btn-fab {
+ transition: transform $transition-duration, box-shadow $transition-duration;
+
+ i {
+ &:before {
+ transition: font-size $transition-duration;
+ }
+ }
+}
+
+.btn-fab.btn-fab-hidden {
+ transform: scaleX(0) scaleY(0);
+
+ i {
+ &:before {
+ font-size: 0;
+ }
+ }
+}
+
+.card {
+ img {
+ display: block;
+
+ @media (max-width: $small-screen) {
+ width: 100%;
+ }
+ }
+ overflow: initial;
+}
+
+.no-margin {
+ margin: 0;
+}
+
+.switch-two-columns {
+ @media (min-width: $large-screen) {
+ float: left !important;
+
+ &:first-child {
+ float: right !important;
+ }
+ }
+}
+
+.text-lg {
+ font-size: 120%;
+}
+
+#order-details {
+ .order-summary {
+ td {
+ padding: 5px 5px;
+ }
+ }
+
+ #order-notes {
+ box-shadow: none;
+ }
+}
+
+@import "widget/breadcrumbs";
+@import "widget/card";
+@import "widget/data-table";
+@import "widget/dropzone";
+@import "widget/form";
+@import "widget/list";
+@import "widget/product-gallery";
+@import "widget/ppoi";
+@import "widget/select2";
+@import "widget/tabs";
+@import "widget/toast";
diff --git a/saleor/static/scss/storefront.scss b/saleor/static/scss/storefront.scss
index aea8abd85d..4ceb203fc3 100644
--- a/saleor/static/scss/storefront.scss
+++ b/saleor/static/scss/storefront.scss
@@ -1 +1,159 @@
-@import "app";
\ No newline at end of file
+$icon-font-path: "~bootstrap-sass/assets/fonts/bootstrap/";
+@import "~bootstrap-sass/assets/stylesheets/bootstrap";
+$fa-font-path: "~font-awesome/fonts";
+@import "~font-awesome/scss/font-awesome";
+
+.table > tbody > tr > td.noborder {
+ border-top: 1px solid transparent;
+}
+
+.navbar {
+ margin-bottom: $grid-gutter-width;
+}
+
+.price {
+ &.undiscounted {
+ text-decoration: line-through;
+ }
+}
+
+.address-details {
+ border-bottom: 1px dashed;
+ color: #3a87ad;
+ cursor: pointer;
+}
+
+.popover {
+ min-width: 200px;
+}
+
+.product-list-item-name {
+ display: block;
+ margin-top: $grid-gutter-width/4;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
+
+.product-gallery {
+ margin-top: $grid-gutter-width;
+}
+
+.product-related {
+ .active {
+ border: 1px solid $btn-primary-border;
+ box-shadow: 0 0 5px $btn-primary-border;
+ }
+}
+
+.product-form {
+ .btn-group {
+ display: block;
+ overflow: hidden;
+ }
+}
+
+.breadcrumb {
+ > li+li {
+ &:before {
+ content: '/';
+ }
+ }
+}
+
+.nav {
+ > li {
+ > a {
+ @extend .text-info;
+ }
+
+ &.active {
+ > a, a:hover {
+ background-color: $brand-info;
+ }
+ }
+ }
+}
+
+.page-header {
+ &--order {
+ margin-top: $grid-gutter-width/3;
+ }
+}
+
+.js {
+ .js-hidden {
+ display: none;
+ }
+}
+
+.nav-pills {
+ &.nav-wizard {
+ > li {
+ position: relative;
+ overflow: visible;
+ border-right: 15px solid $body-bg;
+ border-left: 15px solid $body-bg;
+
+ &:first-child {
+ border-left: 0;
+
+ a {
+ border-radius:5px 0 0 5px;
+ }
+ }
+
+ &:last-child {
+ border-right: 0;
+
+ a {
+ border-radius:0 5px 5px 0;
+ }
+ }
+
+ a {
+ border-radius: 0;
+ background-color: $gray-lighter;
+ }
+
+ .nav-arrow {
+ position: absolute;
+ top: 0px;
+ right: -20px;
+ width: 0px;
+ height: 0px;
+ border-style: solid;
+ border-width: 20px 0 20px 20px;
+ border-color: transparent transparent transparent $gray-lighter;
+ z-index: 150;
+ }
+
+ .nav-wedge {
+ position: absolute;
+ top: 0px;
+ left: -20px;
+ width: 0px;
+ height: 0px;
+ border-style: solid;
+ border-width: 20px 0 20px 20px;
+ border-color: $gray-lighter $gray-lighter $gray-lighter transparent;
+ z-index: 150;
+ }
+
+ &.active {
+ .nav-arrow {
+ border-color: transparent transparent transparent $nav-pills-active-link-hover-bg;
+ }
+
+ .nav-wedge {
+ border-color: $nav-pills-active-link-hover-bg $nav-pills-active-link-hover-bg $nav-pills-active-link-hover-bg transparent;
+ }
+
+ a {
+ background-color: $nav-pills-active-link-hover-bg;
+ color: $nav-pills-active-link-hover-color;
+ }
+ }
+ }
+ }
+}