From d708604bf3a02e20f6d5091fc16f0f3e254b2084 Mon Sep 17 00:00:00 2001 From: Irina Aristova <38761239+Irinaristova@users.noreply.github.com> Date: Wed, 14 Jul 2021 12:28:27 +0300 Subject: [PATCH] fix tooltip styles, fix chip, button and button-icon styles (#175) --- src/woly/atoms/button-icon/index.tsx | 36 +++++++--------------------- src/woly/atoms/button/index.tsx | 2 +- src/woly/atoms/chip/index.tsx | 19 +++++++-------- src/woly/molecules/tooltip/index.tsx | 14 ++++++----- 4 files changed, 25 insertions(+), 46 deletions(-) diff --git a/src/woly/atoms/button-icon/index.tsx b/src/woly/atoms/button-icon/index.tsx index e47a021b..885f48f9 100644 --- a/src/woly/atoms/button-icon/index.tsx +++ b/src/woly/atoms/button-icon/index.tsx @@ -60,6 +60,10 @@ export const ButtonIcon = styled(ButtonIconBase)` } } + &:focus { + box-shadow: 0 0 0 var(--woly-border-width) var(--woly-focus-color); + } + &[data-weight='fill'] { --local-shape-color: var(--woly-shape-default); --local-icon-color: var(--woly-shape-text-default); @@ -84,12 +88,6 @@ export const ButtonIcon = styled(ButtonIconBase)` --local-icon-color: var(--woly-shape-text-active); } - &:focus { - --local-shape-color: var(--woly-shape-active); - --local-icon-color: var(--woly-shape-text-active); - box-shadow: 0 0 0 var(--woly-border-width) var(--woly-focus-color); - } - &:disabled { pointer-events: none; --local-shape-color: var(--woly-canvas-disabled); @@ -121,12 +119,6 @@ export const ButtonIcon = styled(ButtonIconBase)` --local-icon-color: var(--woly-canvas-active); } - &:focus { - --local-shape-color: transparent; - --local-icon-color: var(--woly-canvas-active); - box-shadow: 0 0 0 var(--woly-border-width) var(--woly-focus-color); - } - &:disabled { pointer-events: none; --local-shape-color: var(--woly-shape-text-disabled); @@ -165,13 +157,6 @@ export const ButtonIcon = styled(ButtonIconBase)` --local-border-color: var(--woly-shape-text-active); } - &:focus { - --local-shape-color: transparent; - --local-icon-color: var(--woly-shape-text-active); - --local-border-color: var(--woly-shape-text-active); - box-shadow: 0 0 0 var(--woly-border-width) var(--woly-focus-color); - } - &:disabled { pointer-events: none; --local-shape-color: var(--woly-shape-text-disabled); @@ -182,9 +167,10 @@ export const ButtonIcon = styled(ButtonIconBase)` &[data-weight='transparent'] { --local-shape-color: transparent; --local-icon-color: var(--woly-shape-default); + --local-border-color: transparent; background: var(--local-shape-color); - border-color: var(--local-shape-color); + border-color: var(--local-border-color); [data-icon] > svg > path { fill: var(--local-icon-color); @@ -194,19 +180,13 @@ export const ButtonIcon = styled(ButtonIconBase)` } &:hover { - --local-shape-color: transparent; + --local-shape-color: var(--woly-canvas-disabled); --local-icon-color: var(--woly-shape-hover); } &:active { - --local-shape-color: transparent; - --local-icon-color: var(--woly-canvas-active); - } - - &:focus { - --local-shape-color: transparent; + --local-shape-color: var(--woly-shape-text-disabled); --local-icon-color: var(--woly-canvas-active); - box-shadow: 0 0 0 var(--woly-border-width) var(--woly-focus-color); } &:disabled { diff --git a/src/woly/atoms/button/index.tsx b/src/woly/atoms/button/index.tsx index 0b5f630b..c99bdcc2 100644 --- a/src/woly/atoms/button/index.tsx +++ b/src/woly/atoms/button/index.tsx @@ -106,7 +106,7 @@ export const Button = styled(ButtonBase)` } &:focus { - box-shadow: 0 0 0 var(--woly-border-width) var(--woly-focus); + box-shadow: 0 0 0 var(--woly-border-width) var(--woly-focus-color); } &:disabled { diff --git a/src/woly/atoms/chip/index.tsx b/src/woly/atoms/chip/index.tsx index 4c41592d..42ab832b 100644 --- a/src/woly/atoms/chip/index.tsx +++ b/src/woly/atoms/chip/index.tsx @@ -94,25 +94,22 @@ export const Chip = styled(ChipBase)` flex-shrink: 0; align-items: center; justify-content: center; - - svg > path { - fill: var(--local-text-color); - } - } - - [data-icon='chip-action-block'] { - --woly-component-level: 0; - } - - [data-icon] { width: var(--local-icon-size); height: var(--local-icon-size); + svg { width: 100%; height: 100%; + path { + fill: var(--local-text-color); + } } } + [data-icon='chip-action-block'] { + --woly-component-level: 0; + } + &[data-outlined='true'] { --local-shape-color: transparent; --local-text-color: var(--woly-shape-default); diff --git a/src/woly/molecules/tooltip/index.tsx b/src/woly/molecules/tooltip/index.tsx index e3c872b1..40dbb71d 100644 --- a/src/woly/molecules/tooltip/index.tsx +++ b/src/woly/molecules/tooltip/index.tsx @@ -47,9 +47,11 @@ const TooltipBase: React.FC = ({ ref={ref} tabIndex={0} > -
{children}
-
-
+
+ {children} +
+ @@ -63,7 +65,7 @@ export const Tooltip = styled(TooltipBase)` (1px * var(--woly-main-level)) + (1px * var(--woly-main-level) * var(--woly-component-level)) ) ); - --local-triangel: min( + --local-triangle: min( var(--woly-const-m), calc(1px * var(--woly-component-level) * var(--woly-const-m)) ); @@ -96,7 +98,7 @@ export const Tooltip = styled(TooltipBase)` opacity: 0; transition: 0.3s ease-in-out; - [data-triangle-height] { + [data-triangle] { position: absolute; width: 0; @@ -104,7 +106,7 @@ export const Tooltip = styled(TooltipBase)` border-color: var(--woly-background) transparent transparent transparent; border-style: solid; - border-width: var(--local-triangel); + border-width: var(--local-triangle); } } &:hover [role='tooltip'],