From d44b0fe429c3ebbe65458394378c489799f85835 Mon Sep 17 00:00:00 2001 From: Crash-- Date: Fri, 19 May 2023 10:11:37 +0200 Subject: [PATCH] fix: Use style from UI's hook --- .../AccountSelectorHeader.tsx | 61 ++++++++++++------- 1 file changed, 38 insertions(+), 23 deletions(-) diff --git a/packages/cozy-harvest-lib/src/components/AccountSelectBox/AccountSelectorHeader.tsx b/packages/cozy-harvest-lib/src/components/AccountSelectBox/AccountSelectorHeader.tsx index 6f2f253ecd..ff4494d72f 100644 --- a/packages/cozy-harvest-lib/src/components/AccountSelectBox/AccountSelectorHeader.tsx +++ b/packages/cozy-harvest-lib/src/components/AccountSelectBox/AccountSelectorHeader.tsx @@ -1,9 +1,11 @@ +import cx from 'classnames' import React from 'react' import DialogBackButton from 'cozy-ui/transpiled/react/CozyDialogs/DialogBackButton' import DialogTitle from 'cozy-ui/transpiled/react/Dialog/DialogTitle' import AccountSelectBox from './AccountSelectBox' +import { useDialogContext } from '../DialogContext' interface AccountSelectorHeaderProps { konnector: { slug: string } @@ -18,27 +20,40 @@ export const AccountSelectorHeader = ({ accountsAndTriggers, pushHistory, replaceHistory -}: AccountSelectorHeaderProps): JSX.Element => ( - <> - replaceHistory(`/accounts/${account._id}`)} - /> - - { - pushHistory(`/accounts/${option.account._id}`) - }} - onCreate={(): void => { - pushHistory('/new') - }} - variant="big" +}: AccountSelectorHeaderProps): JSX.Element => { + // @ts-expect-error IDK + const { dialogTitleProps } = useDialogContext() + // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment + const { className: dialogTitlePropsClassName, ...rest } = dialogTitleProps + + return ( + <> + replaceHistory(`/accounts/${account._id}`)} /> - - -) + + + { + pushHistory(`/accounts/${option.account._id}`) + }} + onCreate={(): void => { + pushHistory('/new') + }} + variant="big" + /> + + + ) +}