Skip to content

Commit

Permalink
[DTRA-V2] Henry/dtra 1809/fix darkmode dtrader v2 (#16782)
Browse files Browse the repository at this point in the history
* fix: trade types list dark mode

* fix: handle dark mode for market selector

* fix: bottom nav icon and colors

* fix: trader params background color and bottom nav border

* fix: trader params background color and bottom nav border

* fix: scrolling inside miniminsed parameters

* fix: darkmode for onboarding guide

* fix: test and css

* fix: handle trade params darkmode

* fix: border radius issues

* fix: remove unused import

* fix: test failure

* fix: dark mode animation fix

* fix: positions page dark mode

* fix: contract details dark mode

* fix: test failure

* fix: test cases

* fix: test case

* fix: change to semantic tokens for the remaining

* fix: logo swap on switching

* fix: change icon

* fix: final fixes

* fix: padding issue for input

* fix: positioning and spelling

* fix: test case

* fix: resolve comments

* chore: bump quill-ui

* fix: upgrade quill version
  • Loading branch information
henry-deriv committed Sep 23, 2024
1 parent 975321f commit 5490a4d
Show file tree
Hide file tree
Showing 73 changed files with 458 additions and 238 deletions.
165 changes: 158 additions & 7 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/account/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"@deriv-com/utils": "^0.0.25",
"@deriv-com/ui": "1.35.0",
"@deriv/api": "^1.0.0",
"@deriv-com/quill-ui": "1.16.9",
"@deriv-com/quill-ui": "1.16.17",
"@deriv/components": "^1.0.0",
"@deriv/hooks": "^1.0.0",
"@deriv/integration": "1.0.0",
Expand Down
6 changes: 3 additions & 3 deletions packages/components/src/components/loading/loading.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
height: 100%;
}
&__trade {
background-color: var(--core-color-opacity-black-75);
background-color: var(--semantic-color-slate-solid-surface-frame-mid);
padding: 0 var(--core-spacing-400);
gap: var(--semantic-spacing-general-sm);
position: relative;
Expand Down Expand Up @@ -123,7 +123,7 @@
}
&__positions {
width: 100%;
background-color: var(--core-color-solid-slate-75);
background-color: var(--semantic-color-slate-solid-surface-frame-mid);

.skeleton-box {
&__filters,
Expand Down Expand Up @@ -153,7 +153,7 @@
}
}
&__contract-details {
background-color: var(--core-color-solid-slate-75);
background-color: var(--semantic-color-slate-solid-surface-frame-mid);
padding: var(--core-spacing-400);
gap: var(--semantic-spacing-general-sm);

Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/components/skeleton/skeleton.scss
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
.skeleton {
width: 100%;
height: 100%;
background-color: var(--core-color-opacity-black-75);
background-color: var(--semantic-color-monochrome-surface-normal-lowest);
border-radius: var(--semantic-borderRadius-md);

&.animated {
animation: var(--motion-duration-moderate) ease-out alternate infinite pulsate;

@keyframes pulsate {
to {
background-color: var(--core-color-opacity-black-100);
background-color: var(--semantic-color-monochrome-surface-normal-low);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"@datadog/browser-rum": "^5.11.0",
"@deriv-com/analytics": "1.14.0",
"@deriv-com/quill-tokens": "^2.0.4",
"@deriv-com/quill-ui": "1.16.9",
"@deriv-com/quill-ui": "1.16.17",
"@deriv-com/translations": "1.3.9",
"@deriv-com/ui": "1.35.0",
"@deriv-com/utils": "^0.0.25",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { StoreProvider, mockStore } from '@deriv/stores';

jest.mock('@deriv-com/quill-ui', () => ({
Text: () => <div>Contract Details</div>,
IconButton: ({ icon, onClick }: { icon: React.ReactNode; onClick: () => void }) => (
<button onClick={onClick}>{icon}</button>
),
}));
jest.mock('react-router-dom', () => ({
...jest.requireActual('react-router-dom'),
Expand Down Expand Up @@ -37,7 +40,6 @@ describe('DTraderV2Header', () => {
);

expect(screen.getByText('Contract Details')).toBeInTheDocument();

const icon = screen.getByTestId('arrow');
expect(icon).toBeInTheDocument();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { observer, useStore } from '@deriv/stores';
import { Text } from '@deriv-com/quill-ui';
import { Text, IconButton } from '@deriv-com/quill-ui';
import { LabelPairedArrowLeftSmBoldIcon } from '@deriv/quill-icons';
import { Localize } from '@deriv/translations';
import { useHistory, useLocation } from 'react-router-dom';
Expand All @@ -22,14 +22,14 @@ const DTraderContractDetailsHeader = observer(() => {
return (
<header className='header contract-details-header-v2'>
<React.Suspense fallback={<div />}>
<LabelPairedArrowLeftSmBoldIcon
height='22px'
width='13px'
<IconButton
variant='tertiary'
icon={<LabelPairedArrowLeftSmBoldIcon height='22px' width='13px' data-testid='arrow' />}
className='arrow'
data-testid='arrow'
color='black-white'
onClick={handleBack}
/>
<Text size='md' bold>
<Text size='md' bold color='quill-typography__color--prominent'>
<Localize i18n_default_text='Contract Details' />
</Text>
</React.Suspense>
Expand Down
2 changes: 1 addition & 1 deletion packages/trader/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"dependencies": {
"@deriv-com/analytics": "1.14.0",
"@deriv-com/quill-tokens": "^2.0.4",
"@deriv-com/quill-ui": "1.16.9",
"@deriv-com/quill-ui": "1.16.17",
"@deriv-com/utils": "^0.0.25",
"@deriv-com/ui": "1.35.0",
"@deriv/api-types": "1.0.172",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const AccumulatorStatsDescription = ({ onActionSheetClose }: { onActionSheetClos
<StreamIframe src={UNIFIED_MODE_VIDEO_ID.accumulator_stats} title='accumulator_stats' />
<div className='stats-description__content'>
<div className='stats-description__content__title'>
<Text size='lg' bold>
<Text size='lg' bold color='quill-typography__color--prominent'>
<Localize i18n_default_text='Stats' />
</Text>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const AccumulatorStatsModal = ({
<ActionSheet.Portal shouldCloseOnDrag>
<div className='stats-sheet'>
<div className='stats-sheet__title'>
<Text size='lg' bold>
<Text size='lg' bold color='quill-typography__color--prominent'>
<Localize i18n_default_text='Stats' />
</Text>
</div>
Expand All @@ -25,7 +25,6 @@ const AccumulatorStatsModal = ({
<Localize i18n_default_text='History of tick counts' />
</Text>
</div>

<div className='stats-sheet__stats'>
<StatsRow
rows={rows[0]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,9 @@ const StatsRow = ({
size='sm'
bold
className={animation_class}
key={animationKey}
data-testid='accumulator-first-stat'
color='quill-typography__color--prominent'
key={animationKey}
>
{rows[0]}
</Text>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,23 +35,23 @@
}

.accumulators-stats {
background: var(--general-main-1);
background: var(--semantic-color-slate-solid-surface-frame-low);
padding: var(--core-spacing-400);
margin-top: calc(var(--core-spacing-600) * -1);
border-bottom-left-radius: var(--core-borderWidth-300);
border-bottom-right-radius: var(--core-borderWidth-300);
border-bottom-left-radius: var(--core-borderRadius-400);
border-bottom-right-radius: var(--core-borderRadius-400);
&__container {
display: flex;
justify-content: space-between;
&__heading {
margin: var(--core-spacing-300) var(--core-spacing-400);
background: transparent;
border: none;
border-bottom: var(--core-spacing-75) dashed;
border-bottom: var(--core-spacing-75) dashed var(--component-textIcon-normal-default);
padding: var(--core-spacing-50);
}
&__divider {
border-right: var(--core-spacing-75) solid var(--core-color-opacity-black-100);
border-right: var(--core-spacing-75) solid var(--semantic-color-monochrome-surface-normal-low);
margin: var(--core-spacing-50) var(--core-spacing-400);
}
.slide-right {
Expand Down Expand Up @@ -129,7 +129,7 @@
margin-bottom: var(--core-spacing-1200);
}
&__caption {
margin-bottom: var(--core-spacing-400);
margin-bottom: var(--core-spacing-1200);
}
&__moving {
display: flex;
Expand All @@ -139,8 +139,8 @@
&__stats {
display: flex;
padding: var(--core-spacing-600) var(--core-spacing-75);
border-bottom: var(--core-spacing-75) solid var(--semantic-color-monochrome-border-normal-mid);
justify-content: space-between;
border-bottom: var(--core-spacing-75) solid var(--core-color-opacity-black-100);
&__moving {
display: flex;
align-items: center;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ const AccumulatorStats = observer(() => {
/>
</div>
<button className='accumulators-stats__container__expand' onClick={() => setIsOpen(true)}>
<LabelPairedChevronUpSmBoldIcon data-testid='expand-stats-icon' />
<LabelPairedChevronUpSmBoldIcon
data-testid='expand-stats-icon'
fill='var(--semantic-color-monochrome-textIcon-normal-high)'
/>
</button>
</div>
</div>
Expand Down
16 changes: 13 additions & 3 deletions packages/trader/src/AppV2/Components/BottomNav/bottom-nav.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@ $BOTTOM_NAV_HEIGHT: var(--core-spacing-2800);
display: flex;
flex-direction: column;
height: 100%;

&-container {
padding: var(--core-spacing-200);
width: 100%;
border-top: 1px solid var(--core-color-opacity-black-100);
border-top: 1px solid var(--component-navigationBar-border-color);
height: $BOTTOM_NAV_HEIGHT;
z-index: 30;
}
Expand All @@ -19,16 +20,25 @@ $BOTTOM_NAV_HEIGHT: var(--core-spacing-2800);
}
&-item {
font-size: var(--core-fontSize-50);

.quill-navigation-bottom-bar__action-label {
color: var(--component-navigationBar-label-color-default);
}

svg {
fill: var(--component-navigationBar-icon-default);
}

&__position-badge {
z-index: 1;
}
&--active {
.quill-navigation-bottom-bar__action-label {
color: var(--core-color-opacity-coral-600);
color: var(--component-navigationBar-label-color-selected);
}

svg {
fill: var(--core-color-opacity-coral-600);
fill: var(--component-navigationBar-icon-selected);
}
}
&--positions {
Expand Down
47 changes: 30 additions & 17 deletions packages/trader/src/AppV2/Components/BottomNav/bottom-nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,12 @@ import clsx from 'clsx';
import { observer } from 'mobx-react';
import { Localize } from '@deriv/translations';
import { routes } from '@deriv/shared';
import { StandaloneChartCandlestickRegularIcon, StandaloneClockThreeRegularIcon } from '@deriv/quill-icons';
import {
StandaloneChartAreaFillIcon,
StandaloneChartAreaRegularIcon,
StandaloneClockThreeFillIcon,
StandaloneClockThreeRegularIcon,
} from '@deriv/quill-icons';
import { Badge, Navigation } from '@deriv-com/quill-ui';
import { useStore } from '@deriv/stores';
import { useHistory, useLocation } from 'react-router';
Expand All @@ -24,12 +29,8 @@ const BottomNav = observer(({ children, className, onScroll }: BottomNavProps) =

const bottomNavItems = [
{
icon: (
<StandaloneChartCandlestickRegularIcon
iconSize='sm'
fill='var(--semantic-color-monochrome-textIcon-normal-high)'
/>
),
icon: <StandaloneChartAreaRegularIcon iconSize='sm' />,
activeIcon: <StandaloneChartAreaFillIcon iconSize='sm' />,
label: <Localize i18n_default_text='Trade' />,
path: routes.trade,
},
Expand All @@ -45,16 +46,26 @@ const BottomNav = observer(({ children, className, onScroll }: BottomNavProps) =
contentSize='sm'
className='bottom-nav-item__position-badge'
>
<StandaloneClockThreeRegularIcon
iconSize='sm'
fill='var(--semantic-color-monochrome-textIcon-normal-high)'
/>
<StandaloneClockThreeRegularIcon iconSize='sm' />
</Badge>
) : (
<StandaloneClockThreeRegularIcon
iconSize='sm'
fill='var(--semantic-color-monochrome-textIcon-normal-high)'
/>
<StandaloneClockThreeRegularIcon iconSize='sm' />
),
activeIcon:
active_positions_count > 0 ? (
<Badge
variant='notification'
position='top-right'
label={active_positions_count.toString()}
color='danger'
size='sm'
contentSize='sm'
className='bottom-nav-item__position-badge'
>
<StandaloneClockThreeFillIcon iconSize='sm' />
</Badge>
) : (
<StandaloneClockThreeFillIcon iconSize='sm' />
),
label: (
<React.Fragment>
Expand All @@ -65,13 +76,15 @@ const BottomNav = observer(({ children, className, onScroll }: BottomNavProps) =
path: routes.trader_positions,
},
];

const navIndex = bottomNavItems.findIndex(item => item.path === location.pathname);
const [selectedIndex, setSelectedIndex] = React.useState(navIndex > -1 ? navIndex : 0);

const handleSelect = (index: number) => {
setSelectedIndex(index);
history.push(bottomNavItems[index].path);
};

return (
<div className={classNames('bottom-nav', className)}>
<div className='bottom-nav-selection' onScroll={onScroll}>
Expand All @@ -83,8 +96,8 @@ const BottomNav = observer(({ children, className, onScroll }: BottomNavProps) =
<Navigation.BottomAction
key={index}
index={index}
activeIcon={item.icon}
icon={item.icon}
activeIcon={<></>}
icon={index === selectedIndex ? item.activeIcon : item.icon}
label={item.label}
selected={index === selectedIndex}
showLabel
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
.card-wrapper {
display: flex;
flex-direction: column;
background-color: var(--core-color-solid-slate-50);
background-color: var(--semantic-color-slate-solid-surface-frame-low);
padding: var(--semantic-spacing-general-md);
border-radius: var(--core-borderRadius-500);
gap: var(--semantic-spacing-gap-lg);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
gap: var(--core-spacing-200);

&-message {
color: var(--semantic-color-slate-solid-surface-normal-lowest);
color: var(--component-textIcon-static-prominentDark);
}
}
&--loading {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ export const ContractCardStatusTimer = ({
return displayedDuration ? (
<Tag
className='timer'
icon={<LabelPairedStopwatchCaptionRegularIcon key='open-contract-card' />}
icon={
<LabelPairedStopwatchCaptionRegularIcon
key='open-contract-card'
fill='var(--component-tag-label-color-default)'
/>
}
label={displayedDuration}
variant='custom'
size='sm'
Expand Down
Loading

0 comments on commit 5490a4d

Please sign in to comment.