Skip to content

Commit 74fa8d7

Browse files
authored
use 700px for chain selector (#1547)
1 parent 9c29867 commit 74fa8d7

File tree

5 files changed

+24
-5
lines changed

5 files changed

+24
-5
lines changed

src/components/Modal/Modal.styles.ts

+9-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export const Wrapper = styled.div<WrapperType>`
2424
justify-content: center;
2525
2626
width: 100vw;
27-
height: 100vh;
27+
height: 100dvh;
2828
2929
z-index: 99998;
3030
@@ -88,8 +88,15 @@ type ModalWrapperType = {
8888
bottomYOffset?: number;
8989
padding: "normal" | "thin";
9090
};
91+
92+
// minimum y-axis margin
93+
const minimumMargin = 32;
94+
9195
export const ModalContentWrapper = styled.div<ModalWrapperType>`
92-
max-height: ${({ height }) => height ?? 400}px;
96+
max-height: ${({ height, topYOffset }) =>
97+
height
98+
? `min(calc(100svh - ${minimumMargin * 2}px - ${topYOffset ?? 0}px), ${height}px)`
99+
: "calc(100svh - 64px)"};
93100
max-width: ${({ width }) => width ?? 800}px;
94101
95102
height: fit-content;

src/components/Modal/Modal.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export type ModalDirection = {
1616
mobile?: ModalDirectionOrientation;
1717
};
1818

19-
type ModalProps = {
19+
export type ModalProps = {
2020
isOpen?: boolean;
2121
title?: string | JSX.Element;
2222

src/components/Selector/Selector.tsx

+6-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Tooltip } from "components/Tooltip";
66
import { QUERIESV2 } from "utils";
77
import { ReactComponent as II } from "assets/icons/info.svg";
88
import { useSelector } from "./useSelector";
9+
import { ModalProps } from "components/Modal/Modal";
910

1011
export type SelectorElementType<Value> = {
1112
value: Value;
@@ -23,6 +24,7 @@ export type SelectorPropType<Value> = {
2324
elements: SelectorElementType<Value>[];
2425
selectedValue: Value;
2526
setSelectedValue: (ind: Value) => void;
27+
modalProps?: Partial<ModalProps>;
2628
displayElement?: JSX.Element;
2729
disabled?: boolean;
2830
"data-cy"?: string;
@@ -38,6 +40,7 @@ const Selector = <ElementValue,>({
3840
disabled,
3941
"data-cy": dataCy,
4042
allowSelectDisabled,
43+
modalProps,
4144
}: SelectorPropType<ElementValue>) => {
4245
const { displayModal, setDisplayModal, selectedIndex, isMobile } =
4346
useSelector(elements, selectedValue);
@@ -66,8 +69,8 @@ const Selector = <ElementValue,>({
6669
desktop: "top",
6770
mobile: "bottom",
6871
}}
69-
topYOffset={isMobile ? 16 : 112}
70-
bottomYOffset={isMobile ? 112 : undefined}
72+
topYOffset={isMobile ? undefined : 112}
73+
bottomYOffset={isMobile ? 16 : undefined}
7174
exitOnOutsideClick
7275
title={
7376
typeof title === "string" ? (
@@ -80,6 +83,7 @@ const Selector = <ElementValue,>({
8083
}
8184
padding="thin"
8285
data-cy={`${dataCy}-modal`}
86+
{...modalProps}
8387
>
8488
<ElementRowDivider />
8589
<ElementRowWrapper enableScroll={elements.length > 6}>

src/views/Bridge/components/ChainSelector.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ export function ChainSelector({
9797
}
9898
allowSelectDisabled={!isFrom}
9999
data-cy={`${fromOrTo}-chain-select`}
100+
modalProps={{
101+
height: 700,
102+
bottomYOffset: 16,
103+
}}
100104
/>
101105
);
102106
}

src/views/Bridge/components/TokenSelector.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,10 @@ export function TokenSelector({
168168
</Text>
169169
</CoinIconTextWrapper>
170170
}
171+
modalProps={{
172+
height: 700,
173+
bottomYOffset: 16,
174+
}}
171175
selectedValue={tokenToDisplay.symbol}
172176
title="Select a token"
173177
setSelectedValue={(v) => onSelectToken(v)}

0 commit comments

Comments
 (0)