fix(web): keep pull request panel within viewport (#6451)
This commit is contained in:
1 parent
5015d7cf9f
commit
97db94c9bf
2 files changed
+12
-2
No files matched your search
@@ -1,6 +1,8 @@
|
||||
import { jsx } from "react/jsx-runtime";
|
||||
import { renderToStaticMarkup } from "react-dom/server";
|
||||
import { describe, expect, it } from "vite-plus/test";
|
||||
|
||||
import { getPreviewPanelMaxWidth } from "./PreviewPanelShell";
|
||||
import { getPreviewPanelMaxWidth, PreviewPanelShell } from "./PreviewPanelShell";
|
||||
|
||||
describe("getPreviewPanelMaxWidth", () => {
|
||||
it("allows the panel to use 70% of an ultra-wide viewport without a pixel ceiling", () => {
|
||||
@@ -10,4 +12,12 @@ describe("getPreviewPanelMaxWidth", () => {
|
||||
it("rounds fractional CSS pixels down", () => {
|
||||
expect(getPreviewPanelMaxWidth(2_001)).toBe(1_400);
|
||||
});
|
||||
|
||||
it("keeps inline panels inside their containing workspace", () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
jsx(PreviewPanelShell, { mode: "inline", defaultWidth: 1_000, children: "Panel" }),
|
||||
);
|
||||
|
||||
expect(markup).toContain("max-w-full");
|
||||
});
|
||||
});
|
||||
@@ -51,7 +51,7 @@ export function PreviewPanelShell(props: {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
"relative flex h-full min-h-0 min-w-0 flex-col self-stretch bg-background",
|
||||
"relative flex h-full min-h-0 min-w-0 max-w-full flex-col self-stretch bg-background",
|
||||
isInline
|
||||
? props.maximized
|
||||
? "flex-1 border-l border-border"
|
||||
|
||||
Reference in new issue
Block a user