From 6df791be1f56820581a4fcc942447e748c4e1f16 Mon Sep 17 00:00:00 2001 From: Tanya Fomina Date: Sun, 29 May 2022 22:08:05 +0800 Subject: [PATCH 1/2] Fix paddings of icon only button --- src/backend/views/components/button.twig | 2 +- src/frontend/styles/components/button.pcss | 17 +++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/backend/views/components/button.twig b/src/backend/views/components/button.twig index 95273998..4bdf0b91 100644 --- a/src/backend/views/components/button.twig +++ b/src/backend/views/components/button.twig @@ -24,7 +24,7 @@ <{{tag}} {{ name is not empty ? 'name="' ~ name ~ '"': '' }} - class="{{ mainClass }} {{ mainClass }}--{{ style|default('primary') }} {{ mainClass }}--{{ size|default('default') }} {{ icon ? mainClass ~ '--with-icon' : '' }} {{ class ?? '' }}" + class="{{ mainClass }} {{ mainClass }}--{{ style|default('primary') }} {{ mainClass }}--{{ size|default('default') }} {{ icon ? mainClass ~ '--with-icon' : '' }} {{label ? mainClass ~ '--with-label' : ''}} {{ class ?? '' }}" {{ url is not empty ? 'href="' ~ url ~ '"' : '' }} > {% if icon %} diff --git a/src/frontend/styles/components/button.pcss b/src/frontend/styles/components/button.pcss index c28031f9..db18676e 100644 --- a/src/frontend/styles/components/button.pcss +++ b/src/frontend/styles/components/button.pcss @@ -23,7 +23,6 @@ display: inline-flex; align-items: center; justify-content: center; - margin-right: 4px; svg { width: 24px; @@ -32,12 +31,22 @@ } } + &--with-label &__icon { + margin-right: 4px; + } + + + &--default { --height: 40px; } &--small { --height: 32px; + } + + + &--small&--with-label { padding-right: 10px; } @@ -77,7 +86,11 @@ } } - &--with-icon { + &--with-icon&--with-label { padding-left: 8px; } + + &--small&--with-icon&--with-label { + padding-left: 6px; + } } From 2759714626df605ea6e03a42a2c6c4837e922b77 Mon Sep 17 00:00:00 2001 From: Tanya Fomina Date: Tue, 31 May 2022 09:34:38 +0800 Subject: [PATCH 2/2] Update paddings --- src/frontend/styles/components/button.pcss | 23 +++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/src/frontend/styles/components/button.pcss b/src/frontend/styles/components/button.pcss index db18676e..6e807a42 100644 --- a/src/frontend/styles/components/button.pcss +++ b/src/frontend/styles/components/button.pcss @@ -35,8 +35,6 @@ margin-right: 4px; } - - &--default { --height: 40px; } @@ -45,11 +43,6 @@ --height: 32px; } - - &--small&--with-label { - padding-right: 10px; - } - &--primary { background: var(--color-button-primary); @@ -90,7 +83,23 @@ padding-left: 8px; } + &--with-icon:not(&--with-label) { + padding-right: 8px; + padding-left: 8px; + } + &--small&--with-icon&--with-label { padding-left: 6px; + padding-right: 10px; + } + + &--small&--with-icon:not(&--with-label) { + padding-right: 6px; + padding-left: 6px; + } + + &--small&--with-label:not(&--with-icon) { + padding-right: 10px; + padding-left: 10px; } }