Skip to content

Commit

Permalink
Add a map preview feature to the level select screen.
Browse files Browse the repository at this point in the history
GitOrigin-RevId: c95c335b27a65cd7ded6565f0da99c4d3fd767a2
  • Loading branch information
cpojer committed Mar 7, 2025
1 parent 06e83ce commit 0a3b4ff
Showing 1 changed file with 37 additions and 27 deletions.
64 changes: 37 additions & 27 deletions ui/Dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ export default function Dialog({

export const DialogScrollContainer = ({
children,
horizontalScroll,
navigate,
}: {
children: ReactNode;
horizontalScroll?: boolean;
key: string;
navigate: boolean;
}) => {
Expand Down Expand Up @@ -196,7 +198,10 @@ export const DialogScrollContainer = ({

return (
<div className={scrollContainerStyle}>
<ScrollContainer className={scrollStyle} ref={setRef}>
<ScrollContainer
className={cx(scrollStyle, horizontalScroll && overflowXStyle)}
ref={setRef}
>
{children}
</ScrollContainer>
<div className={cx(scrollDownStyle, showArrow && arrowVisibleStyle)}>
Expand All @@ -208,32 +213,6 @@ export const DialogScrollContainer = ({
);
};

const scrollDownStyle = css`
background-image: linear-gradient(
0deg,
${applyVar('background-color')} 10px,
rgba(255, 255, 255, 0) 30px
);
bottom: -1px;
inset: 0;
opacity: 0;
pointer-events: none;
position: fixed;
transition: opacity 300ms ease;
`;

const scrollDownIconStyle = css`
bottom: 4px;
color: ${applyVar('border-color')};
position: absolute;
right: 4px;
transform: rotate(-90deg);
`;

const arrowVisibleStyle = css`
opacity: 1;
`;

export const DialogTabBar = ({ children }: { children: ReactNode }) => (
<div className={tabBarStyle}>{children}</div>
);
Expand Down Expand Up @@ -350,6 +329,10 @@ const scrollStyle = css`
position: absolute;
`;

const overflowXStyle = css`
overflow-x: auto;
`;

// `translateZ` is required for Safari, otherwise it doesn't place the containing `position: fixed` element correctly.
const scrollContainerStyle = css`
inset: 0;
Expand Down Expand Up @@ -453,3 +436,30 @@ const closeButtonStyle = css`
top: -${DoubleSize}px;
width: ${DoubleSize}px;
`;

const scrollDownStyle = css`
background-image: linear-gradient(
0deg,
${applyVar('background-color')} 10px,
rgba(255, 255, 255, 0) 30px
);
bottom: -1px;
inset: 0;
opacity: 0;
pointer-events: none;
position: fixed;
transition: opacity 300ms ease;
z-index: 1000;
`;

const scrollDownIconStyle = css`
bottom: 4px;
color: ${applyVar('border-color')};
position: absolute;
right: 4px;
transform: rotate(-90deg);
`;

const arrowVisibleStyle = css`
opacity: 1;
`;

0 comments on commit 0a3b4ff

Please sign in to comment.