Skip to content

Commit 384fe45

Browse files
authored
fix(landing): scrollbar offset fix (#704)
fixes these 2 offsets when a scrollbar is present <img width="188" height="154" alt="Screenshot 2026-01-06 at 10 53 43 PM" src="https://github.com/user-attachments/assets/d9db27f6-e297-4542-9702-2b656b5b2e2d" /> <img width="323" height="260" alt="Screenshot 2026-01-06 at 10 54 05 PM" src="https://github.com/user-attachments/assets/472b790f-5905-42a1-867c-c42cfcbe6b01" /> also moved container width to a central `--x` variable so it's consistent wherever it's used to calculate offsets (sidebars, header-divider, footer, etc.)
1 parent e6b8aab commit 384fe45

7 files changed

Lines changed: 46 additions & 31 deletions

File tree

‎packages/mcp-cloudflare/src/client/app.tsx‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@ export default function App() {
3232
};
3333

3434
return (
35-
<div className="overflow-x-clip max-w-screen relative">
35+
<div
36+
className="overflow-x-clip max-w-screen relative w-full"
37+
style={
38+
{
39+
"container-type": "inline-size",
40+
"--scrollbar-width": "calc(100vw - 100cqw)",
41+
} as React.CSSProperties
42+
}
43+
>
3644
{/* //!NOTE: order matters for z- */}
3745
<Sidebars isChatOpen={isChatOpen} toggleChat={toggleChat} />
3846
<Header toggleChat={toggleChat} isChatOpen={isChatOpen} />
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
export function HeaderDivider() {
22
return (
3-
<div className="sticky top-17 z-50 sm:-mb-64 sm:mt-64 md:-mb-58 md:mt-58 xl:-mb-44 xl:mt-44 2xl:-mb-38 2xl:mt-38 w-screen border-b-[1px] border-violet-300/20 [--x:0] sm:[--x:40rem] md:[--x:48rem] lg:[--x:48rem] xl:[--x:72rem] 2xl:[--x:90rem]">
4-
<div className="absolute top-0 left-[calc((100vw-var(--x))/2)] -translate-x-[calc(50%+0.5px)] -translate-y-1/2 h-4 w-4 border bg-white/5 backdrop-blur border-violet-300/20" />
5-
<div className="absolute top-0 right-0 sm:right-[calc((100vw-var(--x))/2)] translate-x-[calc(50%+0.5px)] -translate-y-1/2 h-4 w-4 border bg-white/5 backdrop-blur border-violet-300/20" />
3+
<div className="sticky top-[calc(var(--spacing)_*_17_-_1px)] z-50 sm:-mb-64 sm:mt-64 md:-mb-58 md:mt-58 xl:-mb-44 xl:mt-44 2xl:-mb-38 2xl:mt-38 w-full border-b-[1px] border-violet-300/20">
4+
<div className="absolute top-0 left-(--sidebar-width) -translate-x-[calc(50%+0.5px)] -translate-y-1/2 size-4 border bg-white/5 backdrop-blur border-violet-300/20" />
5+
<div className="absolute top-0 right-0 sm:right-(--sidebar-width) translate-x-[calc(50%+0.5px)] -translate-y-1/2 size-4 border bg-white/5 backdrop-blur border-violet-300/20" />
66
</div>
77
);
88
}

‎packages/mcp-cloudflare/src/client/components/home-layout/footer.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ export default function Footer({ isChatOpen }: { isChatOpen: boolean }) {
44
return (
55
<>
66
<div
7-
className={`group inset-x-0 bottom-14 bg-background-2 w-full sm:h-40 max-sm:gap-4 bg-fixed z-10 border-t flex-col bg-clip-padding border-white/20 flex font-mono py-6 justify-around motion-safe:duration-300 [--x:0] xl:[--x:20rem] 2xl:[--x:24rem] ${
8-
isChatOpen && "xl:-translate-x-[var(--x)]"
7+
className={`group inset-x-0 bottom-14 bg-background-2 w-full sm:h-40 max-sm:gap-4 bg-fixed z-10 border-t flex-col bg-clip-padding border-white/20 flex font-mono py-6 justify-around motion-safe:duration-300 ${
8+
isChatOpen && "xl:-translate-x-[calc(var(--x)/4)]"
99
}`}
1010
>
1111
<div className="flex items-center gap-2 flex-shrink-0 sm:mx-auto max-sm:mx-4 font-sans">
@@ -86,8 +86,8 @@ export default function Footer({ isChatOpen }: { isChatOpen: boolean }) {
8686
</div>
8787
</div>
8888
<div
89-
className={`group inset-x-0 bottom-0 bg-background-2 w-full h-14 bg-fixed bg-[repeating-linear-gradient(45deg,#fff2,#fff2_4px,#fff0_4.5px,#fff0_12px)] z-10 border-t flex max-sm:px-4 sm:justify-center items-center bg-clip-padding border-white/20 opacity-75 [--x:0] xl:[--x:20rem] 2xl:[--x:24rem] motion-safe:duration-300 ${
90-
isChatOpen && "xl:-translate-x-[var(--x)]"
89+
className={`group inset-x-0 bottom-0 bg-background-2 w-full h-14 bg-fixed bg-[repeating-linear-gradient(45deg,#fff2,#fff2_4px,#fff0_4.5px,#fff0_12px)] z-10 border-t flex max-sm:px-4 sm:justify-center items-center bg-clip-padding border-white/20 opacity-75 motion-safe:duration-300 ${
90+
isChatOpen && "xl:-translate-x-[calc(var(--x)/4)]"
9191
}`}
9292
>
9393
<span className="opacity-50 text-xs sm:max-w-2/3">

‎packages/mcp-cloudflare/src/client/components/home-layout/sidebars.tsx‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ export function Sidebars({ isChatOpen, toggleChat }: SidebarProps) {
77
return (
88
<>
99
{/* left sidebar */}
10-
<aside className="group hidden sm:block fixed left-0 inset-y-0 h-full sm:w-[calc((100vw-40rem)/2)] md:w-[calc((100vw-48rem)/2)] lg:w-[calc((100vw-48rem)/2)] xl:w-[calc((100vw-72rem)/2)] 2xl:w-[calc((100vw-90rem)/2)] bg-fixed bg-[repeating-linear-gradient(-45deg,#fff2,#fff2_1px,#fff0_1.5px,#fff0_12px)] z-10 border-r opacity-50 bg-clip-padding border-white/20" />
10+
<aside className="group hidden sm:block fixed left-0 inset-y-0 h-full w-(--sidebar-width) bg-fixed bg-[repeating-linear-gradient(-45deg,#fff2,#fff2_1px,#fff0_1.5px,#fff0_12px)] z-10 border-r opacity-50 bg-clip-padding border-white/20" />
1111
{/* right sidebar */}
1212
<button
13-
className={`group hidden sm:grid fixed right-0 inset-y-0 h-full w-[50vw] duration-300 cursor-pointer place-items-center z-40 border-l sm:[--x:20rem] md:[--x:24rem] lg:[--x:24rem] xl:[--x:36rem] 2xl:[--x:45rem] transition-colors ${
13+
className={`group hidden sm:grid fixed right-0 inset-y-0 h-full w-1/2 duration-300 cursor-pointer place-items-center z-40 border-l transition-colors ${
1414
isChatOpen
1515
? "bg-background-2 -translate-x-[1px] opacity-100 border-white/10 motion-safe:transition-all"
16-
: "translate-x-[var(--x)] opacity-50 hover:bg-background-2 bg-clip-padding border-white/20 bg-[repeating-linear-gradient(-45deg,#fff2,#fff2_1px,#fff0_1.5px,#fff0_12px)]"
16+
: "translate-x-[calc(var(--x)/2)] opacity-50 hover:bg-background-2 bg-clip-padding border-white/20 bg-[repeating-linear-gradient(-45deg,#fff2,#fff2_1px,#fff0_1.5px,#fff0_12px)]"
1717
}`}
1818
onClick={() => toggleChat(true)}
1919
onKeyDown={(e) => {
@@ -27,7 +27,7 @@ export function Sidebars({ isChatOpen, toggleChat }: SidebarProps) {
2727
>
2828
<span className="sr-only">Open chat panel</span>
2929
{!isChatOpen && (
30-
<div className="font-mono absolute w-8 xl:w-12 min-[1800px]:w-fit min-[1800px]:flex-nowrap text-center flex flex-wrap justify-center md:left-[calc((100vw-48rem)/4)] lg:left-[calc((100vw-48rem)/4)] xl:left-[calc((100vw-72rem)/4)] 2xl:left-[calc((100vw-90rem)/4)] top-1/2 -translate-1/2 opacity-0 group-hover:opacity-100 px-1 gap-0.25 gap-x-2">
30+
<div className="font-mono absolute w-8 xl:w-12 min-[1800px]:w-fit min-[1800px]:flex-nowrap text-center flex flex-wrap justify-center md:left-[calc((100vw-var(--x))/4)] top-1/2 -translate-1/2 opacity-0 group-hover:opacity-100 px-1 gap-0.25 gap-x-2">
3131
<div className="flex flex-nowrap">
3232
{"open".split("").map((char, i) => (
3333
<span
@@ -52,7 +52,6 @@ export function Sidebars({ isChatOpen, toggleChat }: SidebarProps) {
5252
</span>
5353
))}
5454
</div>
55-
5655
<div className="flex flex-nowrap">
5756
{"chat".split("").map((char, i) => {
5857
// offset so "chat" follows "open" + 1ch space

‎packages/mcp-cloudflare/src/client/components/ui/header.tsx‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ interface HeaderProps {
1212
export const Header: React.FC<HeaderProps> = ({ toggleChat, isChatOpen }) => {
1313
return (
1414
<header className="pl-4 container mx-auto w-full px-4 sm:px-8 sticky py-4 top-0 z-30 backdrop-blur-xl bg-gradient-to-b from-background to-1% to-background/80">
15-
{/* <div className="absolute inset-0 h-full w-full -z-10 pointer-events-none bg-gradient-to-r from-transparent to-background-2 hidden md:block" /> */}
1615
<div className="absolute inset-0 h-full w-screen left-1/2 -translate-x-1/2 [mask-image:linear-gradient(to_right,transparent,red_4rem,red_calc(100%-4rem),transparent)] border-b-[1px] border-white/15 pointer-events-none -z-10" />
1716
<div className="flex items-center justify-between w-full">
1817
<div className="flex items-center gap-2 flex-shrink-0">
@@ -30,8 +29,8 @@ export const Header: React.FC<HeaderProps> = ({ toggleChat, isChatOpen }) => {
3029
</div>
3130
</div>
3231
<div
33-
className={`flex items-center gap-4 motion-safe:duration-300 [--x:0] xl:[--x:26.25rem] 2xl:[--x:35.25rem] ${
34-
isChatOpen ? "-translate-x-[var(--x)]" : ""
32+
className={`flex items-center gap-4 motion-safe:duration-300 [--offset:0] xl:[--offset:26.25rem] 2xl:[--offset:35.25rem] ${
33+
isChatOpen ? "xl:-translate-x-(--offset)" : ""
3534
}`}
3635
>
3736
<Button

‎packages/mcp-cloudflare/src/client/components/ui/sliding-panel.tsx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ export function SlidingPanel({
5151
{children}
5252
</div>
5353
<div
54-
className={`fixed hidden xl:flex inset-y-0 right-0 w-full max-w-[50vw] bg-background-2 flex-col ease-out ${
54+
className={`fixed hidden xl:flex inset-y-0 right-0 w-full max-w-1/2 bg-background-2 flex-col ease-out ${
5555
isOpen
5656
? "translate-x-0 scale-100 opacity-100 pointer-events-auto motion-safe:duration-300 delay-150 transition-[opacity,filter,scale]"
5757
: "translate-x-full motion-safe:scale-90 opacity-0 pointer-events-none duration-0"

‎packages/mcp-cloudflare/src/client/index.css‎

Lines changed: 23 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -127,27 +127,36 @@
127127
--color-sidebar-ring: var(--sidebar-ring);
128128

129129
--font-sans: "Rubik", sans-serif;
130+
131+
--sidebar-width: calc((100% - var(--x)) / 2);
130132
}
131133

132-
@utility container {
133-
width: 100%;
134-
@media (width >= 40rem /* 640px */) {
135-
max-width: 40rem /* 640px */;
134+
@media (width >= 40rem /* 640px */) {
135+
:root {
136+
--x: 40rem /* 640px */;
136137
}
137-
@media (width >= 48rem /* 768px */) {
138-
max-width: 48rem /* 768px */;
139-
}
140-
@media (width >= 64rem /* 1024px */) {
141-
max-width: 48rem /* 1024px */;
138+
}
139+
@media (width >= 48rem /* 768px */) {
140+
:root {
141+
--x: 48rem /* 768px */;
142142
}
143-
@media (width >= 80rem /* 1280px */) {
144-
max-width: 72rem /* 1280px */;
143+
}
144+
@media (width >= 80rem /* 1280px */) {
145+
:root {
146+
--x: 72rem /* 1152px */;
145147
}
146-
@media (width >= 96rem /* 1536px */) {
147-
max-width: 90rem /* 1536px */;
148+
}
149+
@media (width >= 96rem /* 1536px */) {
150+
:root {
151+
--x: 90rem /* 1440px */;
148152
}
149153
}
150154

155+
@utility container {
156+
width: 100%;
157+
max-width: var(--x, 100%);
158+
}
159+
151160
@layer base {
152161
* {
153162
@apply border-border outline-ring/50;
@@ -159,7 +168,7 @@
159168
}
160169

161170
body {
162-
@apply bg-background text-foreground;
171+
@apply bg-background text-foreground overflow-x-clip;
163172
min-height: 100vh;
164173
font-family: "Rubik", -apple-system, "BlinkMacSystemFont", "Segoe UI",
165174
"Helvetica", "Arial", sans-serif, "Apple Color Emoji", "Segoe UI Emoji",

0 commit comments

Comments
 (0)