-
Notifications
You must be signed in to change notification settings - Fork 899
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #22973 from brave/fix-wallet-make-send-and-swap-ac…
…tion-views-in-panel fix(wallet): Make Send and Swap Action Views in Panel
- Loading branch information
Showing
3 changed files
with
75 additions
and
6 deletions.
There are no files selected for viewing
68 changes: 68 additions & 0 deletions
68
components/brave_wallet_ui/components/desktop/card-headers/panel-action-header.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// Copyright (c) 2024 The Brave Authors. All rights reserved. | ||
// This Source Code Form is subject to the terms of the Mozilla Public | ||
// License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
// You can obtain one at https://mozilla.org/MPL/2.0/. | ||
|
||
import * as React from 'react' | ||
import { useHistory } from 'react-router-dom' | ||
|
||
// Types | ||
import { WalletRoutes } from '../../../constants/types' | ||
|
||
// Utils | ||
import { openWalletRouteTab } from '../../../utils/routes-utils' | ||
|
||
// Styled Components | ||
import { | ||
Button, | ||
ButtonIcon, | ||
LeftRightContainer | ||
} from './shared-panel-headers.style' | ||
import { Row } from '../../shared/style' | ||
import { HeaderTitle } from './shared-card-headers.style' | ||
|
||
interface Props { | ||
title: string | ||
expandRoute: WalletRoutes | ||
} | ||
|
||
export const PanelActionHeader = (props: Props) => { | ||
const { title, expandRoute } = props | ||
|
||
// Routing | ||
const history = useHistory() | ||
|
||
// Methods | ||
const onClose = () => { | ||
if (history.length > 1) { | ||
history.goBack() | ||
return | ||
} | ||
history.push(WalletRoutes.PortfolioAssets) | ||
} | ||
|
||
return ( | ||
<Row | ||
padding='18px 16px' | ||
justifyContent='space-between' | ||
> | ||
<LeftRightContainer | ||
width='unset' | ||
justifyContent='flex-start' | ||
> | ||
<Button onClick={() => openWalletRouteTab(expandRoute)}> | ||
<ButtonIcon name='expand' /> | ||
</Button> | ||
</LeftRightContainer> | ||
<HeaderTitle isPanel={true}>{title}</HeaderTitle> | ||
<LeftRightContainer | ||
width='unset' | ||
justifyContent='flex-end' | ||
> | ||
<Button onClick={onClose}> | ||
<ButtonIcon name='close' /> | ||
</Button> | ||
</LeftRightContainer> | ||
</Row> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters