From add9d41876631cb0fe3f7023a24828c2cb648b04 Mon Sep 17 00:00:00 2001 From: Akmal Djumakhodjaev Date: Tue, 21 Nov 2023 10:55:13 +0800 Subject: [PATCH] Akmal / feat: remove relative indicator if it's blocking current price (#1387) * feat: remove relative indicator if it's blocking current price * chore: refactor code * feat: parse the decimal * feat: new UI for strike overlap * feat: interim solution * feature: updated UI and overlap behaviour for strike and barrier * fix stylint issues * fix: stylelint formatting * fix broken styles in vercel development bundle * feat: remove overlay from barrier * fix: overlay style * feat: trigger vercel * chore: remove unused styles * chore: apply review suggestion * fix: add missing comma * fix: inherit colors from deriv app for turbos * feat: move div to a separate component --- sass/components/_barrier.scss | 66 ++++++++++++++++++------- src/components/Barrier.tsx | 12 ++--- src/components/HamburgerDragIcon.tsx | 11 +++++ src/components/PriceLine.tsx | 74 ++++++++++++++++++++++------ src/store/BarrierStore.ts | 15 +++--- src/store/ChartStore.ts | 2 +- src/store/PriceLineStore.ts | 11 ++++- 7 files changed, 141 insertions(+), 50 deletions(-) create mode 100644 src/components/HamburgerDragIcon.tsx diff --git a/sass/components/_barrier.scss b/sass/components/_barrier.scss index 22c41e90bf..23e6c3d5cd 100644 --- a/sass/components/_barrier.scss +++ b/sass/components/_barrier.scss @@ -33,7 +33,8 @@ width: 100%; margin-left: -10px; position: relative; - border-top-width: 0; + border-top-width: 1px; + border-top-color: $color-blue; } .title-wrapper { $title-height: 24px; @@ -74,12 +75,13 @@ } .drag-price { - display: block; + display: flex; height: 24px; - top: -11px; + top: -12px; position: absolute; right: -1px; - border: 1px solid inherit; + background-color: $color-blue; + justify-content: space-between; .arrow-icon { height: 41px; @@ -123,26 +125,54 @@ /*hover*/ .price { + display: block; font-size: 12px; font-weight: bold; - display: block; - padding: 3px 1px; line-height: 18px; - overflow: hidden; + overflow: unset; + padding: 3px 1px; + position: relative; + right: 45px; text-align: center; -} + width: max-content; -.draggable .price { - padding-left: 16px; + &--zero { + color: $color-blue; + @include themify($themes) { + background-color: themed('DefaultBg'); + } + } + &-overlay { + background-color: $color-blue; + height: 24px; + opacity: 0.3; + position: relative; + right: -10px; + top: -12px; + } +} - &:after { - font-weight: normal; - content: '≡'; - font-size: 25px; - position: absolute; - left: 1px; - top: 1px; - transform: scaleX(0.8); +.draggable { + &-area-wrapper { + display: flex; + } + .price { + overflow: unset; + position: relative; + right: 55px; + } + .drag-icon { + display: flex; + flex-direction: column; + justify-content: center; + margin-left: 3px; + + div { + background-color: $color-white; + height: 1px; + margin: 1px; + width: 8px; + } } } diff --git a/src/components/Barrier.tsx b/src/components/Barrier.tsx index bc75872337..c1f2bf8243 100644 --- a/src/components/Barrier.tsx +++ b/src/components/Barrier.tsx @@ -18,18 +18,18 @@ const Barrier = ({ store, ...props }: TBarrierBaseProps) => { aboveShadeStore, belowShadeStore, betweenShadeStore, - shadeColor = '#39b19d', color = '#39b19d', foregroundColor = '#ffffff', + hideBarrierLine, hideOffscreenBarrier, hideOffscreenLine, - hideBarrierLine, hidePriceLines, - lineStyle, isInitialized, - priceLabelWidth, isSingleBarrier, + lineStyle, opacityOnOverlap, + overlappedBarrierWidth, + shadeColor = '#39b19d', } = store; if (!isInitialized) return null; @@ -41,7 +41,7 @@ const Barrier = ({ store, ...props }: TBarrierBaseProps) => { > { <> ( +
+
+
+
+
+); + +export default HamburgerDragIcon; \ No newline at end of file diff --git a/src/components/PriceLine.tsx b/src/components/PriceLine.tsx index e6a84cc0ef..72738080dd 100644 --- a/src/components/PriceLine.tsx +++ b/src/components/PriceLine.tsx @@ -4,10 +4,11 @@ import classNames from 'classnames'; import PriceLineStore from 'src/store/PriceLineStore'; import PriceLineArrow from './PriceLineArrow'; import PriceLineTitle from './PriceLineTitle'; +import HamburgerDragIcon from './HamburgerDragIcon'; type TPriceLineProps = { store: PriceLineStore; - lineStyle?: string; + lineStyle?: React.CSSProperties['borderStyle']; hideOffscreenBarrier?: boolean; hideOffscreenLine?: boolean; hideBarrierLine?: boolean; @@ -29,18 +30,19 @@ const PriceLine = ({ store, }: TPriceLineProps) => { const { - priceDisplay, - visible, - setDragLine, className, draggable, - isDragging, init, - title, - yAxiswidth, + isDragging, + isOverlapping, + isOverlappingWithPriceLine, offScreen, offScreenDirection, - isOverlapping, + priceDisplay, + setDragLine, + title, + visible, + yAxiswidth, } = store; const showBarrier = React.useMemo(() => !(hideOffscreenBarrier && offScreen), [hideOffscreenBarrier, offScreen]); @@ -57,7 +59,12 @@ const PriceLine = ({ if (!showBarrier) return null; return ( -