Skip to content

Commit 0a3b4ff

Browse files
committed
Add a map preview feature to the level select screen.
GitOrigin-RevId: c95c335b27a65cd7ded6565f0da99c4d3fd767a2
1 parent 06e83ce commit 0a3b4ff

File tree

1 file changed

+37
-27
lines changed

1 file changed

+37
-27
lines changed

ui/Dialog.tsx

+37-27
Original file line numberDiff line numberDiff line change
@@ -122,9 +122,11 @@ export default function Dialog({
122122

123123
export const DialogScrollContainer = ({
124124
children,
125+
horizontalScroll,
125126
navigate,
126127
}: {
127128
children: ReactNode;
129+
horizontalScroll?: boolean;
128130
key: string;
129131
navigate: boolean;
130132
}) => {
@@ -196,7 +198,10 @@ export const DialogScrollContainer = ({
196198

197199
return (
198200
<div className={scrollContainerStyle}>
199-
<ScrollContainer className={scrollStyle} ref={setRef}>
201+
<ScrollContainer
202+
className={cx(scrollStyle, horizontalScroll && overflowXStyle)}
203+
ref={setRef}
204+
>
200205
{children}
201206
</ScrollContainer>
202207
<div className={cx(scrollDownStyle, showArrow && arrowVisibleStyle)}>
@@ -208,32 +213,6 @@ export const DialogScrollContainer = ({
208213
);
209214
};
210215

211-
const scrollDownStyle = css`
212-
background-image: linear-gradient(
213-
0deg,
214-
${applyVar('background-color')} 10px,
215-
rgba(255, 255, 255, 0) 30px
216-
);
217-
bottom: -1px;
218-
inset: 0;
219-
opacity: 0;
220-
pointer-events: none;
221-
position: fixed;
222-
transition: opacity 300ms ease;
223-
`;
224-
225-
const scrollDownIconStyle = css`
226-
bottom: 4px;
227-
color: ${applyVar('border-color')};
228-
position: absolute;
229-
right: 4px;
230-
transform: rotate(-90deg);
231-
`;
232-
233-
const arrowVisibleStyle = css`
234-
opacity: 1;
235-
`;
236-
237216
export const DialogTabBar = ({ children }: { children: ReactNode }) => (
238217
<div className={tabBarStyle}>{children}</div>
239218
);
@@ -350,6 +329,10 @@ const scrollStyle = css`
350329
position: absolute;
351330
`;
352331

332+
const overflowXStyle = css`
333+
overflow-x: auto;
334+
`;
335+
353336
// `translateZ` is required for Safari, otherwise it doesn't place the containing `position: fixed` element correctly.
354337
const scrollContainerStyle = css`
355338
inset: 0;
@@ -453,3 +436,30 @@ const closeButtonStyle = css`
453436
top: -${DoubleSize}px;
454437
width: ${DoubleSize}px;
455438
`;
439+
440+
const scrollDownStyle = css`
441+
background-image: linear-gradient(
442+
0deg,
443+
${applyVar('background-color')} 10px,
444+
rgba(255, 255, 255, 0) 30px
445+
);
446+
bottom: -1px;
447+
inset: 0;
448+
opacity: 0;
449+
pointer-events: none;
450+
position: fixed;
451+
transition: opacity 300ms ease;
452+
z-index: 1000;
453+
`;
454+
455+
const scrollDownIconStyle = css`
456+
bottom: 4px;
457+
color: ${applyVar('border-color')};
458+
position: absolute;
459+
right: 4px;
460+
transform: rotate(-90deg);
461+
`;
462+
463+
const arrowVisibleStyle = css`
464+
opacity: 1;
465+
`;

0 commit comments

Comments
 (0)