From 2af64fb6d9ed17c404af0526babbd5616b46dac1 Mon Sep 17 00:00:00 2001 From: OggyKUN <46613040+OggyKUN@users.noreply.github.com> Date: Fri, 20 Sep 2024 16:14:57 +0300 Subject: [PATCH] fix(interface): vertically symmetrical widgets (#1288) --- .../IconsNumber/IconsNumber.module.scss | 8 ++++ src/components/IconsNumber/IconsNumber.tsx | 4 +- .../sideButtonLink/SideButtonLink.module.scss | 34 ++++++++-------- .../ui/SenseButton/SenseButton.module.scss | 40 +++++-------------- .../sense/ui/SenseButton/SenseButton.tsx | 19 ++++++++- src/layouts/Main.module.scss | 8 ++++ src/layouts/Main.tsx | 6 +-- 7 files changed, 65 insertions(+), 54 deletions(-) diff --git a/src/components/IconsNumber/IconsNumber.module.scss b/src/components/IconsNumber/IconsNumber.module.scss index 0328932e1..a5b9ce88a 100644 --- a/src/components/IconsNumber/IconsNumber.module.scss +++ b/src/components/IconsNumber/IconsNumber.module.scss @@ -17,3 +17,11 @@ .tooltipWrapper { white-space: nowrap; } + +.hydrogenPlaceholder { + display: flex; + width: 30px; + height: 20px; + justify-content: center; + align-items: center; +} diff --git a/src/components/IconsNumber/IconsNumber.tsx b/src/components/IconsNumber/IconsNumber.tsx index e24b98995..5de213025 100644 --- a/src/components/IconsNumber/IconsNumber.tsx +++ b/src/components/IconsNumber/IconsNumber.tsx @@ -62,9 +62,11 @@ export default function IconsNumber({ value, type, isVertical }: Props) { return el; }); + const numberStyle = type === 'hydrogen' ? styles.hydrogenPlaceholder : ''; + return ( - {number} + {number} diff --git a/src/components/sideButtonLink/SideButtonLink.module.scss b/src/components/sideButtonLink/SideButtonLink.module.scss index 1889c9f8c..7192574fe 100644 --- a/src/components/sideButtonLink/SideButtonLink.module.scss +++ b/src/components/sideButtonLink/SideButtonLink.module.scss @@ -1,59 +1,59 @@ .main { display: flex; - position: fixed; + justify-content: center; + align-items: center; z-index: 3; - top: 45%; - transform: translateY(-50%); - padding: 40px 10px; + padding: 10px 10px; backdrop-filter: blur(15px); - border-radius: 50px; > span { font-size: 14px; - margin-top: 5px; color: white; &:last-of-type { - margin-top: 4px; font-size: 16px; } } &:hover { transition: all 0.3s; - background-color: var(--green-light); + background-color: #74ff00; span { - color: var(--green-light); + color: #74ff00; } } } .sense { flex-direction: column; - padding-left: 3px; + border-radius: 0px 15px 15px 0px; background: linear-gradient( to right, - black 90%, + black 93%, rgba(255, 255, 255, 0.5) 100% ); &:hover { - padding-right: 30px; + padding-right: 20px; } } +.sense div { + display: flex; + flex-direction: column; + margin-right: 5px; +} + .hydrogen { - right: 0; - align-items: center; background: linear-gradient( to left, - black 90%, + black 93%, rgba(255, 255, 255, 0.5) 100% ); - + border-radius: 15px 0px 0px 15px; &:hover { - padding-left: 30px; + padding-left: 20px; } } diff --git a/src/features/sense/ui/SenseButton/SenseButton.module.scss b/src/features/sense/ui/SenseButton/SenseButton.module.scss index 5bbbc49a8..9f8adbf60 100644 --- a/src/features/sense/ui/SenseButton/SenseButton.module.scss +++ b/src/features/sense/ui/SenseButton/SenseButton.module.scss @@ -1,34 +1,12 @@ -.senseBtn { +.wrapper { display: flex; - flex-direction: column; - padding-left: 3px; - padding: 40px 10px; - background: linear-gradient( - to right, - black 90%, - rgb(255, 255, 255, 0.5) 100% - ); - backdrop-filter: blur(15px); - border-radius: 50px; - - > span { - font-size: 14px; - margin-top: 5px; - color: white; - - &:last-of-type { - margin-top: 4px; - font-size: 16px; - } - } - - &:hover { - transition: all 0.3s; - padding-right: 30px; + align-items: center; +} - background-color: var(--green-light); - span { - color: var(--green-light); - } - } +.sensePlaceholder { + display: flex; + width: 30px; + height: 20px; + justify-content: center; + align-items: center; } diff --git a/src/features/sense/ui/SenseButton/SenseButton.tsx b/src/features/sense/ui/SenseButton/SenseButton.tsx index f3057cef8..fd700b836 100644 --- a/src/features/sense/ui/SenseButton/SenseButton.tsx +++ b/src/features/sense/ui/SenseButton/SenseButton.tsx @@ -3,15 +3,30 @@ import { Tooltip } from 'src/components'; import { useAppSelector } from 'src/redux/hooks'; import { selectUnreadCounts } from '../../redux/sense.redux'; import SideButtonLink from 'src/components/sideButtonLink/SideButtonLink'; +import styles from './SenseButton.module.scss'; function SenseButton() { + // TODO: transfer logic to IconsNumber const { particles, neurons } = useAppSelector(selectUnreadCounts); - const total = particles + neurons; + const notificationCount = particles + neurons; + + const notificationCountStr = + typeof notificationCount === 'number' ? notificationCount.toString() : ''; + const firstThreedigits = notificationCountStr.slice(0, 3) || '0'; + const hiddenPartCount = + notificationCountStr.length > 3 ? notificationCountStr.length - 3 : 1; return ( - {total || ''} 🧬 + +
+ {Array.from({ length: hiddenPartCount }).map((_, index) => ( + 🧬 + ))} +
+ {firstThreedigits} +
); diff --git a/src/layouts/Main.module.scss b/src/layouts/Main.module.scss index 1281883ba..de403e390 100644 --- a/src/layouts/Main.module.scss +++ b/src/layouts/Main.module.scss @@ -29,3 +29,11 @@ } } } +.widgetWrapper { + z-index: 3; + display: inline-flex; + position: fixed; + justify-content: space-between; + width: 100%; + top: 45%; +} diff --git a/src/layouts/Main.tsx b/src/layouts/Main.tsx index 6da44efb4..d956c0db8 100644 --- a/src/layouts/Main.tsx +++ b/src/layouts/Main.tsx @@ -64,10 +64,10 @@ function MainLayout({ children }: { children: JSX.Element }) {
{currentAddress && !isMobile && ( - <> - {CHAIN_ID === Networks.BOSTROM && !isMobile && } +
+ {CHAIN_ID === Networks.BOSTROM && } - +
)} {children}