Skip to content

Commit

Permalink
fix: make header text clickable (#130)
Browse files Browse the repository at this point in the history
* fix: make header text clickable

* move hook out of render return
  • Loading branch information
kristiehuang authored Aug 9, 2022
1 parent 062c2fb commit 6855ca3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
14 changes: 9 additions & 5 deletions src/components/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import styled from 'styled-components/macro'
import { Color, Layer, ThemedText, ThemeProvider } from 'theme'
import { delayUnmountForAnimation } from 'utils/animations'

import { IconButton } from './Button'
import { TextButton } from './Button'
import Column from './Column'
import Row from './Row'
import Rule from './Rule'
Expand Down Expand Up @@ -59,21 +59,25 @@ const HeaderRow = styled(Row)`
padding-top: 0.5em;
${largeIconCss}
`

interface HeaderProps {
title?: ReactElement
ruled?: boolean
children?: ReactNode
}

export function Header({ title, children, ruled }: HeaderProps) {
const onClose = useContext(OnCloseContext)
return (
<>
<Column>
<HeaderRow iconSize={1.2}>
<Row justify="flex-start" gap={0.5}>
<IconButton color="primary" onClick={useContext(OnCloseContext)} icon={ChevronLeft} />
<Row gap={0.5}>{title && <ThemedText.Subhead1>{title}</ThemedText.Subhead1>}</Row>
</Row>
<TextButton color="primary" onClick={onClose}>
<Row justify="flex-start" gap={0.5}>
<ChevronLeft />
<Row gap={0.5}>{title && <ThemedText.Subhead1>{title}</ThemedText.Subhead1>}</Row>
</Row>
</TextButton>
{children}
</HeaderRow>
{ruled && <Rule padded />}
Expand Down
4 changes: 1 addition & 3 deletions src/cosmos/Swap.fixture.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,7 @@ function Fixture() {
resolve(true) // to open our built-in wallet connect flow
})
}
onReviewSwapClick={() => {
return new Promise((resolve) => resolve(true))
}}
onReviewSwapClick={() => new Promise((resolve) => resolve(true))}
onTxSubmit={(txHash: string, data: any) => console.log('tx submitted:', txHash, data)}
onTxSuccess={(txHash: string, data: any) => console.log('tx success:', txHash, data)}
onTxFail={(error: Error, data: any) => console.log('tx fail:', error, data)}
Expand Down

1 comment on commit 6855ca3

@vercel
Copy link

@vercel vercel bot commented on 6855ca3 Aug 9, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

widgets – ./

widgets-git-main-uniswap.vercel.app
widgets-uniswap.vercel.app
widgets-seven-tau.vercel.app

Please sign in to comment.