From edc6c440854f0516db8324d72d23869fde5d2ede Mon Sep 17 00:00:00 2001 From: Roland Bewick Date: Wed, 18 Oct 2023 11:54:04 +0700 Subject: [PATCH] fix: icon hover animations --- src/components/bc-help.ts | 4 ++-- src/components/bc-start.ts | 9 ++++++--- src/components/css/classes.ts | 1 + src/components/icons/disconnectIcon.ts | 7 +++++++ src/components/icons/exitIcon.ts | 13 ------------- src/components/icons/linkIcon.ts | 8 ++++---- src/components/internal/InternalElement.ts | 8 ++++++++ src/components/internal/bci-button.ts | 14 -------------- 8 files changed, 28 insertions(+), 36 deletions(-) create mode 100644 src/components/icons/disconnectIcon.ts delete mode 100644 src/components/icons/exitIcon.ts diff --git a/src/components/bc-help.ts b/src/components/bc-help.ts index ec158ec..f7cb34c 100644 --- a/src/components/bc-help.ts +++ b/src/components/bc-help.ts @@ -38,7 +38,7 @@ export class Help extends withTwind()(BitcoinConnectElement) { Learn more @@ -48,7 +48,7 @@ export class Help extends withTwind()(BitcoinConnectElement) { Use it diff --git a/src/components/bc-start.ts b/src/components/bc-start.ts index 36c3d86..0baa570 100644 --- a/src/components/bc-start.ts +++ b/src/components/bc-start.ts @@ -3,7 +3,7 @@ import {BitcoinConnectElement} from './BitcoinConnectElement'; import {withTwind} from './twind/withTwind'; import store from '../state/store'; import {html} from 'lit'; -import {exitIcon} from './icons/exitIcon'; +import {disconnectIcon} from './icons/disconnectIcon'; import {hr} from './templates/hr'; import './internal/bci-button'; import {classes} from './css/classes'; @@ -67,8 +67,11 @@ export class Start extends withTwind()(BitcoinConnectElement) { ${this._connectorName} - - ${exitIcon} + + ${disconnectIcon} Disconnect ` : html` diff --git a/src/components/css/classes.ts b/src/components/css/classes.ts index 2d99172..3c9f7bd 100644 --- a/src/components/css/classes.ts +++ b/src/components/css/classes.ts @@ -1,6 +1,7 @@ export const classes = { interactive: 'transition-all hover:brightness-90 dark:hover:brightness-110 active:scale-95 cursor-pointer', + 'hover-animation': 'hover-animation', // text colors 'text-brand': 'text-brand-light dark:text-brand-dark', diff --git a/src/components/icons/disconnectIcon.ts b/src/components/icons/disconnectIcon.ts new file mode 100644 index 0000000..c71f178 --- /dev/null +++ b/src/components/icons/disconnectIcon.ts @@ -0,0 +1,7 @@ +import {svg} from 'lit'; + +export const disconnectIcon = svg` + + + +`; diff --git a/src/components/icons/exitIcon.ts b/src/components/icons/exitIcon.ts deleted file mode 100644 index db555ba..0000000 --- a/src/components/icons/exitIcon.ts +++ /dev/null @@ -1,13 +0,0 @@ -import {svg} from 'lit'; - -export const exitIcon = svg` - - - - - - - - - -`; diff --git a/src/components/icons/linkIcon.ts b/src/components/icons/linkIcon.ts index e052097..c124a4b 100644 --- a/src/components/icons/linkIcon.ts +++ b/src/components/icons/linkIcon.ts @@ -1,6 +1,6 @@ import {svg} from 'lit'; -export const linkIcon = svg` - - -`; +export const linkIcon = svg` + + +`; diff --git a/src/components/internal/InternalElement.ts b/src/components/internal/InternalElement.ts index 38fb5ec..acdcd3f 100644 --- a/src/components/internal/InternalElement.ts +++ b/src/components/internal/InternalElement.ts @@ -8,6 +8,14 @@ export class InternalElement extends LitElement { all: initial; font-variant-numeric: slashed-zero; } + .hover-animation:hover .hover-right-up { + transform: translateX(2px) translateY(-2px); + transition: all 0.3s; + } + .hover-animation:hover .hover-right { + transform: translateX(3px); + transition: all 0.3s; + } `, ]; diff --git a/src/components/internal/bci-button.ts b/src/components/internal/bci-button.ts index 1b08742..f1276ae 100644 --- a/src/components/internal/bci-button.ts +++ b/src/components/internal/bci-button.ts @@ -6,20 +6,6 @@ import {classes} from '../css/classes'; @customElement('bci-button') export class Button extends withTwind()(InternalElement) { - static override styles = [ - ...super.styles, - css` - :hover ::slotted(.hover-right) { - transform: translateX(4px); - transition: all 0.5s; - } - :hover ::slotted(.hover-right-up) { - transform: translateX(4px) translateY(-4px); - transition: all 0.5s; - } - `, - ]; - override render() { return html`