Skip to content

Commit

Permalink
Jim/wall 4348/replace wallet text with text from UI library (deriv-co…
Browse files Browse the repository at this point in the history
…m#16564)

* chore: replace wallettext with text component

* chore: revert back to previous type

* chore: replace text with loader and add missed translations

* chore: add translations

* revert stylelint changes

* chore: revert more stylelint changes

* ci: fix failing tests
  • Loading branch information
jim-deriv authored Sep 16, 2024
1 parent 87fdb26 commit 0ef26a9
Show file tree
Hide file tree
Showing 43 changed files with 220 additions and 454 deletions.
12 changes: 6 additions & 6 deletions packages/wallets/src/components/AppCard/AppCard.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { Text } from '@deriv-com/ui';
import type { TGenericSizes, THooks } from '../../types';
import { AppCardBadge } from '../AppCardBadge';
import { WalletText } from '../Base';
import { WalletGradientBackground } from '../WalletGradientBackground';
import { WalletMarketCurrencyIcon } from '../WalletMarketCurrencyIcon';
import './AppCard.scss';
Expand Down Expand Up @@ -54,13 +54,13 @@ const AppCard: React.FC<TProps> = ({
</div>
{cardSize !== 'sm' && (
<div className='wallets-app-card__bottom'>
<WalletText size='2xs'>{appName}</WalletText>
<WalletText color='less-prominent' size='2xs'>
<Text size='2xs'>{appName}</Text>
<Text color='less-prominent' size='2xs'>
{walletName}
</WalletText>
<WalletText size='sm' weight='bold'>
</Text>
<Text size='sm' weight='bold'>
{balance}
</WalletText>
</Text>
</div>
)}
</div>
Expand Down
10 changes: 5 additions & 5 deletions packages/wallets/src/components/Base/Tabs/TabTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { FC, useCallback } from 'react';
import React, { ComponentProps, FC, useCallback } from 'react';
import classNames from 'classnames';
import WalletText, { WalletTextProps } from '../WalletText/WalletText';
import { Text } from '@deriv-com/ui';

export type TabTitleProps = {
icon?: React.ReactNode;
index: number;
isActive?: boolean;
setSelectedTab: (index: number) => void;
size: WalletTextProps['size'];
size: ComponentProps<typeof Text>['size'];
title: string;
};

Expand All @@ -24,9 +24,9 @@ const TabTitle: FC<TabTitleProps> = ({ icon, index, isActive, setSelectedTab, si
onClick={handleOnClick}
>
{icon}
<WalletText size={size} weight={isActive ? 'bold' : 'normal'}>
<Text size={size} weight={isActive ? 'bold' : 'normal'}>
{title}
</WalletText>
</Text>
</button>
);
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { ReactNode } from 'react';
import { LegacyLossIcon, LegacySettlementFillIcon, LegacyWarningIcon, LegacyWonIcon } from '@deriv/quill-icons';
import { WalletText } from '../index';
import { Text } from '@deriv-com/ui';
import './WalletAlertMessage.scss';

const typeMapper = {
Expand Down Expand Up @@ -44,9 +44,9 @@ const WalletAlertMessage: React.FC<TProps> = ({ children, message, type }) => {
<Icon className='wallets-alert-message__icon-container__icon' fill={fill} iconSize='xs' />
</div>
<div className='wallets-alert-message__message-container'>
<WalletText color={color} size='xs'>
<Text color={color} size='xs'>
{message}
</WalletText>
</Text>
</div>
{children && <>{children}</>}
</div>
Expand Down
184 changes: 0 additions & 184 deletions packages/wallets/src/components/Base/WalletText/WalletText.scss

This file was deleted.

42 changes: 0 additions & 42 deletions packages/wallets/src/components/Base/WalletText/WalletText.tsx

This file was deleted.

1 change: 0 additions & 1 deletion packages/wallets/src/components/Base/WalletText/index.ts

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { InputHTMLAttributes, memo } from 'react';
import WalletText, { WalletTextProps } from '../WalletText/WalletText';
import React, { ComponentProps, InputHTMLAttributes, memo } from 'react';
import { Text } from '@deriv-com/ui';

export type HelperMessageProps = {
inputValue?: InputHTMLAttributes<HTMLInputElement>['value'];
Expand All @@ -11,7 +11,7 @@ export type HelperMessageProps = {

const HelperMessage: React.FC<HelperMessageProps> = memo(
({ inputValue, isError, maxLength, message, messageVariant = 'general' }) => {
const HelperMessageColors: Record<string, WalletTextProps['color']> = {
const HelperMessageColors: Record<string, ComponentProps<typeof Text>['color']> = {
error: 'error',
general: 'less-prominent',
warning: 'warning',
Expand All @@ -21,19 +21,19 @@ const HelperMessage: React.FC<HelperMessageProps> = memo(
<React.Fragment>
{message && (
<div className='wallets-textfield__message-container--msg'>
<WalletText
<Text
color={isError ? HelperMessageColors.error : HelperMessageColors[messageVariant]}
size='xs'
>
{message}
</WalletText>
</Text>
</div>
)}
{maxLength && (
<div className='wallets-textfield__message-container--maxchar'>
<WalletText align='right' color='less-prominent' size='xs'>
<Text align='right' color='less-prominent' size='xs'>
{inputValue?.toString().length || 0} / {maxLength}
</WalletText>
</Text>
</div>
)}
</React.Fragment>
Expand Down
1 change: 0 additions & 1 deletion packages/wallets/src/components/Base/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ export * from './WalletClipboard';
export * from './WalletDialog';
export * from './WalletLink';
export * from './WalletPasswordFieldLazy';
export * from './WalletText';
export * from './WalletTextField';
Loading

0 comments on commit 0ef26a9

Please sign in to comment.