-
Notifications
You must be signed in to change notification settings - Fork 177
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: limit order mobile view (#8073)
* refactor: make generic slide transition route * chore: wip * fix: route + header styling * chore: style improvements * fix: more style improvements * fix: more style improvements * chore: update imports * chore: remove relative position
- Loading branch information
1 parent
37f5bb4
commit a96f515
Showing
10 changed files
with
158 additions
and
96 deletions.
There are no files selected for viewing
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
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
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
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
42 changes: 0 additions & 42 deletions
42
src/components/MultiHopTrade/components/QuoteList/QuoteListRoute.tsx
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
src/components/MultiHopTrade/components/SlideTransitionRoute.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,57 @@ | ||
import type { CardProps } from '@chakra-ui/react' | ||
import { Center, Flex, useMediaQuery } from '@chakra-ui/react' | ||
import type { FC } from 'react' | ||
import { useCallback, useMemo, useState } from 'react' | ||
import { useHistory } from 'react-router' | ||
import { TradeSlideTransition } from 'components/MultiHopTrade/TradeSlideTransition' | ||
import type { TradeRoutePaths } from 'components/MultiHopTrade/types' | ||
import { breakpoints } from 'theme/theme' | ||
|
||
import type { LimitOrderRoutePaths } from './LimitOrder/types' | ||
|
||
type SlideTransitionComponentProps = { | ||
onBack?: () => void | ||
isLoading: boolean | ||
cardProps?: CardProps | ||
} | ||
|
||
type SlideTransitionRouteProps = { | ||
height: string | number | ||
width: string | number | ||
component: FC<SlideTransitionComponentProps> | ||
parentRoute: TradeRoutePaths | LimitOrderRoutePaths | ||
} | ||
|
||
export const SlideTransitionRoute = ({ | ||
width: initialWidth, | ||
height: initialHeight, | ||
component: Component, | ||
parentRoute, | ||
}: SlideTransitionRouteProps) => { | ||
const [width] = useState(initialWidth) | ||
const [height] = useState(initialHeight) | ||
const history = useHistory() | ||
const [isSmallerThanXl] = useMediaQuery(`(max-width: ${breakpoints.xl})`) | ||
|
||
const handleBack = useCallback(() => { | ||
history.push({ pathname: parentRoute }) | ||
}, [history, parentRoute]) | ||
|
||
const cardProps: CardProps = useMemo( | ||
() => ({ | ||
width, | ||
height, | ||
}), | ||
[width, height], | ||
) | ||
|
||
return ( | ||
<TradeSlideTransition> | ||
<Flex width='full' justifyContent='center' maxWidth={isSmallerThanXl ? '500px' : undefined}> | ||
<Center width='inherit'> | ||
<Component onBack={handleBack} isLoading={false} cardProps={cardProps} /> | ||
</Center> | ||
</Flex> | ||
</TradeSlideTransition> | ||
) | ||
} |
Oops, something went wrong.