Skip to content

Commit 6433938

Browse files
Thisyahlen/replace quill in modules accounts v2 (deriv-com#13800)
* chore: modules * chore: remaining style fix * chore: komen v3
1 parent f46a7fa commit 6433938

File tree

7 files changed

+50
-68
lines changed

7 files changed

+50
-68
lines changed

packages/account-v2/src/components/FormFields/FormDropDownField.tsx

+7-5
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@ import React, { ComponentProps } from 'react';
22
import { Field, FieldProps } from 'formik';
33
import * as Yup from 'yup';
44
import { useBreakpoint } from '@deriv/quill-design';
5+
import { LabelPairedChevronDownMdRegularIcon } from '@deriv/quill-icons';
6+
import { Dropdown } from '@deriv-com/ui';
57
import { validateField } from '../../utils/validation';
6-
import { WalletDropdown as DropDown } from '../base/WalletDropdown';
78

89
type FormDropDownFieldProps = Omit<
9-
ComponentProps<typeof DropDown>,
10-
'errorMessage' | 'isRequired' | 'onSelect' | 'variant'
10+
ComponentProps<typeof Dropdown>,
11+
'dropdownIcon' | 'errorMessage' | 'isRequired' | 'onSelect' | 'variant'
1112
> & {
1213
name: string;
1314
validationSchema?: Yup.AnySchema;
@@ -26,12 +27,13 @@ const FormDropDownField = ({ name, validationSchema, ...rest }: FormDropDownFiel
2627
return (
2728
<Field name={name} validate={validateField(validationSchema)}>
2829
{({ field, form, meta: { error, touched } }: FieldProps<string>) => (
29-
<DropDown
30+
<Dropdown
3031
{...field}
3132
{...rest}
33+
dropdownIcon={<LabelPairedChevronDownMdRegularIcon />}
3234
errorMessage={error}
3335
isRequired={touched && !!error}
34-
onSelect={(value: string) => form.setFieldValue(name, value)}
36+
onSelect={value => form.setFieldValue(name, value)}
3537
variant={isMobile ? 'prompt' : 'comboBox'}
3638
/>
3739
)}

packages/account-v2/src/components/FormFields/FormInputField.tsx

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React, { ComponentProps } from 'react';
22
import { Field, FieldProps } from 'formik';
33
import * as Yup from 'yup';
4+
import { Input } from '@deriv-com/ui';
45
import { validateField } from '../../utils/validation';
5-
import { WalletTextField as TextField } from '../base/WalletTextField';
66

7-
type FormInputFieldProps = Omit<ComponentProps<typeof TextField>, 'errorMessage' | 'isInvalid' | 'showMessage'> & {
7+
type FormInputFieldProps = Omit<ComponentProps<typeof Input>, 'errorMessage' | 'isInvalid' | 'showMessage'> & {
88
name: string;
99
validationSchema?: Yup.AnySchema;
1010
};
@@ -20,14 +20,12 @@ type FormInputFieldProps = Omit<ComponentProps<typeof TextField>, 'errorMessage'
2020
const FormInputField = ({ name, validationSchema, ...rest }: FormInputFieldProps) => (
2121
<Field name={name} validate={validateField(validationSchema)}>
2222
{({ field, meta: { error, touched } }: FieldProps<string>) => (
23-
<TextField
23+
<Input
2424
{...field}
2525
{...rest}
2626
autoComplete='off'
27-
errorMessage={touched && error}
28-
isInvalid={touched && !!error}
29-
showMessage
30-
type='text'
27+
error={Boolean(error && touched)}
28+
message={touched && error}
3129
/>
3230
)}
3331
</Field>

packages/account-v2/src/modules/AddressFields/AddressFields.tsx

+7-32
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export const AddressFields = () => {
1414

1515
const isSvg =
1616
landingCompanyName === LANDING_COMPANY.SVG || !!upgradableLandingCompanies?.includes(LANDING_COMPANY.SVG);
17-
const { data: statesList, isFetched: statesListFetched } = useStatesList(settings.country_code || '', {
17+
const { data: statesList, isFetched: statesListFetched } = useStatesList(settings.country_code ?? '', {
1818
enabled: !!settings.country_code,
1919
});
2020

@@ -27,25 +27,10 @@ export const AddressFields = () => {
2727
} = addressDetailValidations(settings.country_code ?? '', isSvg);
2828

2929
return (
30-
<div className='space-y-600 pt-400'>
31-
<FormInputField
32-
label='First line of address*'
33-
name='addressLine1'
34-
placeholder='First line of address'
35-
validationSchema={addressLine1Schema}
36-
/>
37-
<FormInputField
38-
label='Second line of address'
39-
name='addressLine2'
40-
placeholder='Second line of address'
41-
validationSchema={addressLine2Schema}
42-
/>
43-
<FormInputField
44-
label='Town/City*'
45-
name='addressCity'
46-
placeholder='Town/City'
47-
validationSchema={addressCitySchema}
48-
/>
30+
<div className='pt-8 space-y-12'>
31+
<FormInputField label='First line of address*' name='addressLine1' validationSchema={addressLine1Schema} />
32+
<FormInputField label='Second line of address' name='addressLine2' validationSchema={addressLine2Schema} />
33+
<FormInputField label='Town/City*' name='addressCity' validationSchema={addressCitySchema} />
4934
{statesListFetched && statesList.length ? (
5035
<FormDropDownField
5136
label='State/Province'
@@ -54,19 +39,9 @@ export const AddressFields = () => {
5439
validationSchema={addressStateSchema}
5540
/>
5641
) : (
57-
<FormInputField
58-
label='State/Province'
59-
name='addressState'
60-
placeholder='State/Province'
61-
validationSchema={addressStateSchema}
62-
/>
42+
<FormInputField label='State/Province' name='addressState' validationSchema={addressStateSchema} />
6343
)}
64-
<FormInputField
65-
label='Postal/ZIP Code'
66-
name='addressPostcode'
67-
placeholder='Postal/ZIP Code'
68-
validationSchema={addressPostcodeSchema}
69-
/>
44+
<FormInputField label='Postal/ZIP Code' name='addressPostcode' validationSchema={addressPostcodeSchema} />
7045
</div>
7146
);
7247
};

packages/account-v2/src/modules/Onfido/OnfidoContainer.tsx

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import React, { useEffect, useState } from 'react';
2-
import clsx from 'clsx';
32
import { useHistory } from 'react-router-dom';
3+
import { twMerge } from 'tailwind-merge';
44
import { useOnfido } from '@deriv/api';
5-
import { qtMerge } from '@deriv/quill-design';
65
import { Button, Loader, Text } from '@deriv-com/ui';
76
import IcAccountMissingDetails from '../../assets/proof-of-identity/ic-account-missing-details.svg';
87
import { ErrorMessage } from '../../components/ErrorMessage';
@@ -58,7 +57,7 @@ export const OnfidoContainer = ({
5857
const hasPersonalDetailsValidationError = ['MissingPersonalDetails', 'InvalidPostalCode'].includes(
5958
serviceTokenError?.error.code ?? ''
6059
);
61-
const showErrorMessage = onfidoInitializationError?.message || serviceTokenError?.error?.message;
60+
const showErrorMessage = onfidoInitializationError?.message ?? serviceTokenError?.error?.message;
6261

6362
if (isServiceTokenLoading) {
6463
return <Loader />;
@@ -98,16 +97,17 @@ export const OnfidoContainer = ({
9897
}
9998

10099
return (
101-
<div className={qtMerge('flex flex-col items-center gap-800 p-800 lg:p-50')}>
100+
<div className={twMerge('flex flex-col items-center gap-16 p-16 lg:p-0')}>
102101
<div
103-
className={clsx(
104-
'[transition:transform_0.35s_ease,_opacity_0.35s_linear]origin-top opacity-1300 p-800',
105-
{ '[display:none]': transitionEnd, 'scale-y-0 opacity-50': isOnfidoEnabled }
102+
className={twMerge(
103+
'[transition:transform_0.35s_ease,_opacity_0.35s_linear]origin-top opacity-24 p-16',
104+
transitionEnd && 'hidden',
105+
isOnfidoEnabled && 'scale-y-0 opacity-50'
106106
)}
107107
>
108-
{/* TODO: Dummy div here replace with PoiConfirmWithExample */}
108+
{/* Do this: Dummy div here replace with PoiConfirmWithExample */}
109109
<div
110-
className='border-75 border-solid border-solid-slate-300 rounded-500 w-[200px] sm:w-[638px] h-[384px]'
110+
className='border-1 border-solid border-solid-grey-2 rounded-lg w-[200px] sm:w-[638px] h-[384px]'
111111
data-testid='dt_poi-confirm-with-example'
112112
onClick={() => setIsOnfidoEnabled(true)}
113113
onKeyDown={() => setIsOnfidoEnabled(true)}

packages/account-v2/src/modules/POAForm/POAFormContainer.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { useState } from 'react';
22
import { useHistory } from 'react-router-dom';
3-
import { useActiveAccount } from '@deriv/api';
3+
import { useActiveTradingAccount } from '@deriv/api';
44
import { Button, Loader, Text } from '@deriv-com/ui';
55
import IcPOAError from '../../assets/verification-status/ic-poa-error.svg';
66
import IcPOAUpload from '../../assets/verification-status/ic-poa-upload.svg';
@@ -14,7 +14,7 @@ import { usePOAInfo } from '../../hooks/usePOAInfo';
1414
import { isNavigationFromDerivGO, isNavigationFromP2P } from '../../utils/platform';
1515

1616
export const POAFormContainer = () => {
17-
const { data: activeAccount } = useActiveAccount();
17+
const { data: activeAccount } = useActiveTradingAccount();
1818
const { data: poaInfo, isLoading } = usePOAInfo();
1919
const [resubmitting, setResubmitting] = useState(false);
2020
const history = useHistory();

packages/account-v2/src/router/components/route-links/route-links.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { defaultRoute, routes } from '../../constants/routes-config';
55
const RouteLinks = () => (
66
<BrowserRouter>
77
<div className='px-4 py-16 gap-6 grid grid-cols-1 sm:grid-cols-[1fr_4fr]'>
8-
<div className='flex-col p-8 d-none sm:flex bg-solid-slate-1 rounded-xs'>
8+
<div className='flex-col hidden p-8 sm:flex bg-solid-slate-1 rounded-xs'>
99
{routes.map(route => (
1010
<NavLink
1111
activeClassName='bg-solid-slate-2 border-solid border-l-4 border-l-solid-red-5 rounded-xs font-bold'

packages/account-v2/tailwind.config.ts

+19-12
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,7 @@
11
import type { Config } from 'tailwindcss';
2-
const plugin = require('tailwindcss/plugin');
3-
import QuillTailwindConfig from '@deriv/quill-design/quill-tailwind/tailwind.config.cjs';
42

53
export default {
64
content: ['./src/**/*.{js,jsx,ts,tsx}'],
7-
plugins: [
8-
plugin(({ addUtilities }) => {
9-
addUtilities({
10-
'.d-none': {
11-
display: 'none',
12-
},
13-
});
14-
}),
15-
],
16-
presets: [QuillTailwindConfig],
175
theme: {
186
extend: {
197
borderRadius: {
@@ -141,6 +129,25 @@ export default {
141129
lg: { min: '1280px' },
142130
xl: { min: '1440px' },
143131
},
132+
opacity: {
133+
0: '0',
134+
4: '0.04',
135+
8: '0.08',
136+
16: '0.16',
137+
24: '0.24',
138+
32: '0.32',
139+
40: '0.4',
140+
48: '0.48',
141+
56: '0.56',
142+
64: '0.64',
143+
72: '0.72',
144+
80: '0.8',
145+
88: '0.88',
146+
96: '0.96',
147+
100: '1',
148+
overlay: '0.72',
149+
disabled: ' 0.32',
150+
},
144151
spacing: {
145152
0: '0px',
146153
1: '1px',

0 commit comments

Comments
 (0)