Skip to content

Commit 6a4bb9c

Browse files
committed
Added test story and formatted story
1 parent 23777fc commit 6a4bb9c

File tree

2 files changed

+95
-9
lines changed

2 files changed

+95
-9
lines changed

src/components/stories/02-components/Testing.stories.mdx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Meta, Story, Preview, Props } from "@storybook/addon-docs/blocks";
2-
import { StateDriven, AnchoredDefaultOrdering } from "../Utils";
2+
import { StateDriven, AnchoredDefaultOrdering, SpaceDemoStacked1 } from "../Utils";
33

44
<Meta title="Testing/State" />
55

@@ -14,3 +14,9 @@ import { StateDriven, AnchoredDefaultOrdering } from "../Utils";
1414
<AnchoredDefaultOrdering />
1515
</Story>
1616
</Preview>
17+
18+
<Preview>
19+
<Story name="Test stacked spaces">
20+
<SpaceDemoStacked1 />
21+
</Story>
22+
</Preview>

src/components/stories/Utils.tsx

Lines changed: 88 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,21 @@ export const ResizableProps = () => (
140140
<>
141141
<PropsHeader>Resizable properties</PropsHeader>
142142
<Prop name="handleSize" type="number" default="5" description="Size of the resize handle in pixels." />
143-
<Prop name="touchHandleSize" type="number" default="5" description={<>An optional handle size that can be used to make the handle area bigger for touches. This extends outside the dimensions of the resize handle. <strong>NOTE: You should ensure that you try not to place clickable elements underneath this extended handle area as the handle area will block interaction with that element.</strong></>} />
143+
<Prop
144+
name="touchHandleSize"
145+
type="number"
146+
default="5"
147+
description={
148+
<>
149+
An optional handle size that can be used to make the handle area bigger for touches. This extends outside the dimensions of the
150+
resize handle.{" "}
151+
<strong>
152+
NOTE: You should ensure that you try not to place clickable elements underneath this extended handle area as the handle area
153+
will block interaction with that element.
154+
</strong>
155+
</>
156+
}
157+
/>
144158
<Prop
145159
name="handlePlacement"
146160
type="ResizeHandlePlacement.OverlayInside ('overlay-inside'), ResizeHandlePlacement.Inside ('inside'), ResizeHandlePlacement.OverlayBoundary ('overlay-boundary')"
@@ -278,13 +292,79 @@ export const StateDriven: React.FC = () => {
278292
};
279293

280294
export const AnchoredDefaultOrdering = () => {
281-
return <ViewPort as="main">
282-
<Left size="25%" style={blue} centerContent={CenterType.HorizontalVertical}>Left 1</Left>
283-
<Left size="25%" style={green} centerContent={CenterType.HorizontalVertical}>Left 2</Left>
284-
<Left size="25%" style={red} centerContent={CenterType.HorizontalVertical}>Left 3</Left>
285-
<Fill style={blue} centerContent={CenterType.HorizontalVertical}>Fill</Fill>
286-
</ViewPort>
287-
}
295+
return (
296+
<ViewPort as="main">
297+
<Left size="25%" style={blue} centerContent={CenterType.HorizontalVertical}>
298+
Left 1
299+
</Left>
300+
<Left size="25%" style={green} centerContent={CenterType.HorizontalVertical}>
301+
Left 2
302+
</Left>
303+
<Left size="25%" style={red} centerContent={CenterType.HorizontalVertical}>
304+
Left 3
305+
</Left>
306+
<Fill style={blue} centerContent={CenterType.HorizontalVertical}>
307+
Fill
308+
</Fill>
309+
</ViewPort>
310+
);
311+
};
312+
313+
export const SpaceDemoStacked1 = () => (
314+
<>
315+
<Fixed height={400}>
316+
<LeftResizable trackSize={true} handleSize={30} size="10%" order={1} style={{ backgroundColor: "#e0eee0" }}>
317+
{Description("Left 1", "L1")}
318+
</LeftResizable>
319+
<LeftResizable trackSize={true} handleSize={30} size="10%" order={2} style={{ backgroundColor: "#e0eeee" }}>
320+
{Description("Left 2", "L2")}
321+
</LeftResizable>
322+
<Fill trackSize={true} style={{ backgroundColor: "#eee0e0" }}>
323+
{Description("Fill", "F")}
324+
</Fill>
325+
<RightResizable trackSize={true} handleSize={30} size="10%" order={2} style={{ backgroundColor: "#e0eeee" }}>
326+
{Description("Right 2", "R2")}
327+
</RightResizable>
328+
<RightResizable trackSize={true} handleSize={30} size="10%" order={1} style={{ backgroundColor: "#e0eee0" }}>
329+
{Description("Right 1", "R1")}
330+
</RightResizable>
331+
</Fixed>
332+
<Fixed height={400}>
333+
<LeftResizable trackSize={true} handleSize={30} size="10%" order={1} style={{ backgroundColor: "#e0eee0" }}>
334+
{Description("Left 1", "L1")}
335+
</LeftResizable>
336+
<LeftResizable trackSize={true} handleSize={30} size="10%" order={2} style={{ backgroundColor: "#e0eeee" }}>
337+
{Description("Left 2", "L2")}
338+
</LeftResizable>
339+
<Fill trackSize={true} style={{ backgroundColor: "#eee0e0" }}>
340+
{Description("Fill", "F")}
341+
</Fill>
342+
<RightResizable trackSize={true} handleSize={30} size="10%" order={2} style={{ backgroundColor: "#e0eeee" }}>
343+
{Description("Right 2", "R2")}
344+
</RightResizable>
345+
<RightResizable trackSize={true} handleSize={30} size="10%" order={1} style={{ backgroundColor: "#e0eee0" }}>
346+
{Description("Right 1", "R1")}
347+
</RightResizable>
348+
</Fixed>
349+
</>
350+
);
351+
352+
const Description = (desc: string, mobileDesc: string) => (
353+
<Centered>
354+
<span className="description">
355+
<strong className="desc">{desc}</strong>
356+
<strong className="mobileDesc">{mobileDesc}</strong>
357+
<br />
358+
<Info>
359+
{(info) => (
360+
<span>
361+
{info.width.toFixed()} x {info.height.toFixed()}
362+
</span>
363+
)}
364+
</Info>
365+
</span>
366+
</Centered>
367+
);
288368

289369
const white = { backgroundColor: "#ffffff", padding: 15 };
290370
export const blue: CSSProperties = { backgroundColor: "rgb(224, 238, 238, 0.7)" };

0 commit comments

Comments
 (0)