Skip to content

Commit

Permalink
Merge pull request #42 from deriv-com/sandeep/fix-icons
Browse files Browse the repository at this point in the history
sandeep/refactor: 🔥 refactoring the icons using quill-icons library
  • Loading branch information
sandeep-deriv authored Aug 20, 2024
2 parents b2f8b2d + d1d0b9b commit 57715e4
Show file tree
Hide file tree
Showing 21 changed files with 225 additions and 137 deletions.
9 changes: 5 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"@deriv-com/utils": "latest",
"@deriv/deriv-charts": "^2.1.23",
"@deriv/js-interpreter": "^3.0.0",
"@deriv/quill-icons": "~1.22.10",
"@deriv/quill-icons": "~1.23.10",
"@svgr/core": "^8.1.0",
"@tanstack/react-query": "^5.29.2",
"blockly": "^10.4.3",
Expand Down
8 changes: 5 additions & 3 deletions src/components/bot-stopped.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import React from 'react';
import { observer } from 'mobx-react-lite';
import { useStore } from '@/hooks/useStore';
import { Icon, localize } from '@/utils/tmp/dummy';
import { Dialog, Text } from '@deriv-com/ui';
import { localize } from '@/utils/tmp/dummy';
import { LegacyClose1pxIcon } from '@deriv/quill-icons';
import { Text } from '@deriv-com/ui';
import Dialog from './shared_ui/dialog';

const BotStopped = observer(() => {
const { dashboard } = useStore();
Expand Down Expand Up @@ -34,7 +36,7 @@ const BotStopped = observer(() => {
}}
tabIndex={0}
>
<Icon icon='IcCross' />
<LegacyClose1pxIcon height='20px' width='20px' />
</div>
</div>
<Text as='p' align='left' size='xs' color='prominent'>
Expand Down
4 changes: 2 additions & 2 deletions src/components/draggable/draggable.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useEffect, useRef, useState } from 'react';
import { Icon } from '@/utils/tmp/dummy';
import { LegacyClose1pxIcon } from '@deriv/quill-icons';
import {
calculateHeight,
calculateWidth,
Expand Down Expand Up @@ -221,7 +221,7 @@ const Draggable: React.FC<TDraggableProps> = ({
data-testid='dt_react_draggable-close-modal'
onClick={onClose}
>
<Icon icon='IcCross' />
<LegacyClose1pxIcon height='20px' width='20px' />
</div>
</div>
<span className='draggable-content__body' id='draggable-content-body'>
Expand Down
3 changes: 2 additions & 1 deletion src/components/load-modal/load-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import { observer } from 'mobx-react-lite';
import { tabs_title } from '@/constants/load-modal';
import { useStore } from '@/hooks/useStore';
import { localize } from '@/utils/tmp/dummy';
import { Modal, Tabs } from '@deriv-com/ui';
import GoogleDrive from '../../pages/dashboard/load-bot-preview/google-drive';
import MobileFullPageModal from '../shared_ui/mobile-full-page-modal';
import Modal from '../shared_ui/modal';
import Tabs from '../shared_ui/tabs';
import Local from './local';
import LocalFooter from './local-footer';
import Recent from './recent';
Expand Down
8 changes: 5 additions & 3 deletions src/components/load-modal/local.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import classNames from 'classnames';
import { observer } from 'mobx-react-lite';
import { useStore } from '@/hooks/useStore';
import { Icon, Localize, localize } from '@/utils/tmp/dummy';
import { LegacyClose1pxIcon } from '@deriv/quill-icons';
import { Button } from '@deriv-com/ui';
import LocalFooter from './local-footer';
import WorkspaceControl from './workspace-control';
Expand Down Expand Up @@ -31,10 +32,11 @@ const LocalComponent = observer(() => {
<div className='load-strategy__preview-workspace'>
<div id='load-strategy__blockly-container' style={{ height: '100%' }}>
<div className='load-strategy__local-preview-close'>
<Icon
data_testid='dt_load-strategy__local-preview-close'
icon='IcCross'
<LegacyClose1pxIcon
onClick={() => setLoadedLocalFile(null)}
data-testid='dt_load-strategy__local-preview-close'
height='20px'
width='20px'
/>
</div>
<WorkspaceControl />
Expand Down
4 changes: 2 additions & 2 deletions src/components/shared_ui/dialog/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import classNames from 'classnames';
import ReactDOM from 'react-dom';
import { CSSTransition } from 'react-transition-group';
import { useOnClickOutside } from '@/hooks/useOnClickOutside';
import { Icon } from '@/utils/tmp/dummy';
import { LegacyClose1pxIcon } from '@deriv/quill-icons';
import Button from '../button';
import Text from '../text';

Expand Down Expand Up @@ -147,7 +147,7 @@ const Dialog = ({
)}
{has_close_icon && (
<div onClick={handleClose} className='dc-dialog__header--close'>
<Icon icon='IcCross' />
<LegacyClose1pxIcon height='20px' width='20px' />
</div>
)}
</div>
Expand Down
8 changes: 6 additions & 2 deletions src/components/shared_ui/mobile-dialog/mobile-dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import classNames from 'classnames';
import ReactDOM from 'react-dom';
import { CSSTransition } from 'react-transition-group';
import { Icon } from '@/utils/tmp/dummy';
import { LegacyClose1pxIcon } from '@deriv/quill-icons';
import Div100vhContainer from '../div100vh-container';
import Text from '../text/text';
import ThemedScrollbars from '../themed-scrollbars';
Expand Down Expand Up @@ -137,7 +137,11 @@ const MobileDialog = (props: React.PropsWithChildren<TMobileDialog>) => {
className='icons dc-btn-close dc-mobile-dialog__close-btn'
onClick={props.onClose}
>
<Icon icon='IcCross' className='dc-mobile-dialog__close-btn-icon' />
<LegacyClose1pxIcon
className='dc-mobile-dialog__close-btn-icon'
height='20px'
width='20px'
/>
</div>
)}
</div>
Expand Down
13 changes: 8 additions & 5 deletions src/components/shared_ui/modal/modal.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import React from 'react';
import classNames from 'classnames';
import ReactDOM from 'react-dom';
import { CSSTransition } from 'react-transition-group';
import classNames from 'classnames';

import { useOnClickOutside } from '@/hooks/useOnClickOutside';
import { Icon } from '@/utils/tmp/dummy';

import { LegacyClose1pxIcon } from '@deriv/quill-icons';
import Text from '../text/text';

import Body from './modal-body';
import Footer from './modal-footer';

Expand Down Expand Up @@ -208,7 +206,12 @@ const ModalElement = ({
)}
{has_close_icon && (
<div onClick={toggleModal} className='dc-modal-header__close' role='button'>
<Icon icon='IcCross' color={close_icon_color} data_testid='dt_modal_close_icon' />
<LegacyClose1pxIcon
height='20px'
width='20px'
color={close_icon_color}
data-testid='dt_modal_close_icon'
/>
</div>
)}
</div>
Expand Down
3 changes: 2 additions & 1 deletion src/components/shared_ui/page-overlay/page-overlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import classNames from 'classnames';
import ReactDOM from 'react-dom';
import { CSSTransition } from 'react-transition-group';
import { Icon } from '@/utils/tmp/dummy';
import { LegacyClose1pxIcon } from '@deriv/quill-icons';

type TPageOverlay = {
header?: React.ReactNode;
Expand Down Expand Up @@ -56,7 +57,7 @@ const PageOverlay = ({
window.history.back
}
>
<Icon icon='IcCross' />
<LegacyClose1pxIcon height='20px' width='20px' />
</div>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { useFormikContext } from 'formik';
import { observer } from 'mobx-react-lite';
import ThemedScrollbars from '@/components/shared_ui/themed-scrollbars';
import { useStore } from '@/hooks/useStore';
import { Icon, localize } from '@/utils/tmp/dummy';
import { localize } from '@/utils/tmp/dummy';
import { LegacyClose1pxIcon } from '@deriv/quill-icons';
import { Button, Text } from '@deriv-com/ui';
import {
rudderStackSendQsEditStrategyEvent,
Expand Down Expand Up @@ -90,7 +91,7 @@ const FormWrapper: React.FC<TDesktopFormWrapper> = observer(({ children, onClick
}
}}
>
<Icon icon='IcCross' />
<LegacyClose1pxIcon height='20px' width='20px' />
</span>
</div>
</div>
Expand Down
24 changes: 4 additions & 20 deletions src/pages/bot-builder/toolbar/toolbar-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,40 +2,24 @@ import DesktopWrapper from '@/components/shared_ui/desktop-wrapper';
import MobileWrapper from '@/components/shared_ui/mobile-wrapper';
import Popover from '@/components/shared_ui/popover';
import { popover_zindex } from '@/constants/z-indexes';
import { Icon } from '@/utils/tmp/dummy';

type TToolbarIcon = {
popover_message: string;
icon: string;
icon_id: string;
action: () => void;
icon_color?: string;
data_testid?: string;
icon: string | React.ReactNode;
};

const ToolbarIcon = ({ popover_message, icon, icon_id, icon_color, action, data_testid }: TToolbarIcon) => {
const renderIcon = () => (
<Icon
icon={icon}
id={icon_id}
className='toolbar__icon'
onClick={action}
{...(icon_color && { color: icon_color })}
data_testid={data_testid}
/>
);

const ToolbarIcon = ({ popover_message, icon }: TToolbarIcon) => {
return (
<>
<MobileWrapper>{renderIcon()}</MobileWrapper>
<MobileWrapper>{icon}</MobileWrapper>
<DesktopWrapper>
<Popover
alignment='bottom'
message={popover_message}
zIndex={String(popover_zindex.TOOLBAR)}
should_disable_pointer_events
>
{renderIcon()}
{icon}
</Popover>
</DesktopWrapper>
</>
Expand Down
20 changes: 19 additions & 1 deletion src/pages/bot-builder/toolbar/toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,32 @@
&__icon {
cursor: pointer;
border: none;
margin: auto 1.2rem;
margin: auto 0.8rem;
height: 1.6rem;
width: 1.6rem;
fill: var(--text-prominent);

@include mobile {
margin: 1.2rem;
}

&.undo {
svg {
transform: scaleX(-1) rotate(180deg);
}
}

&.redo {
svg {
transform: rotate(180deg);
}
}

&--disabled {
pointer-events: none;
user-select: none;
opacity: 0.5;
}
}

&__group {
Expand Down
2 changes: 1 addition & 1 deletion src/pages/bot-builder/toolbar/toolbar.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react';
import { observer } from 'mobx-react-lite';
import Dialog from '@/components/shared_ui/dialog';
import { useStore } from '@/hooks/useStore';
import { Localize, localize } from '@/utils/tmp/dummy';
import { Dialog } from '@deriv-com/ui';
import { rudderStackSendQsOpenEventFromBotBuilder } from '../quick-strategy/analytics/rudderstack-quick-strategy';
import ToolbarButton from './toolbar-button';
import WorkspaceGroup from './workspace-group';
Expand Down
Loading

0 comments on commit 57715e4

Please sign in to comment.