Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(Stack): do not apply flex сlasses, when not needed #4162

Merged
merged 1 commit into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
15 changes: 15 additions & 0 deletions packages/orbit-components/src/Stack/Stack.ct-story.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import React from "react";

import type { Props } from "./types";

import Stack from ".";

export default function StackStory(props: Omit<Props, "children">) {
return (
<Stack {...props}>
<div className="bg-blue-normal text-white-normal flex h-[50px] items-center">First child</div>
<div className="bg-blue-dark text-white-normal flex h-[70px] items-center">Second child</div>
<div className="bg-blue-darker text-white-normal flex h-[90px] items-center">Third child</div>
</Stack>
);
}
76 changes: 76 additions & 0 deletions packages/orbit-components/src/Stack/Stack.ct.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import * as React from "react";
import { test, expect } from "@playwright/experimental-ct-react";

import { DIRECTIONS, SPACINGS } from "../utils/layout/consts";
import { ALIGN } from "../common/tailwind/alignItems";
import StackStory from "./Stack.ct-story";
import { JUSTIFY } from "../common/tailwind/justify";
import Box from "../Box";

test.describe("visual Stack", () => {
test(`Stack default`, async ({ mount }) => {
const component = await mount(<StackStory />);

await expect(component).toHaveScreenshot();
});

Object.values(SPACINGS).forEach(spacing => {
test(`Stack with spacing ${spacing}`, async ({ mount }) => {
const component = await mount(<StackStory spacing={spacing} />);

await expect(component).toHaveScreenshot();
});
});

test("Stack with inline", async ({ mount }) => {
const component = await mount(<StackStory inline />);

await expect(component).toHaveScreenshot();
});

test("Stack with gap", async ({ mount }) => {
const component = await mount(<StackStory flex legacy={false} />);

await expect(component).toHaveScreenshot();
});

Object.values(DIRECTIONS).forEach(direction => {
test(`Stack with direction ${direction}`, async ({ mount }) => {
const component = await mount(<StackStory direction={direction} />);

await expect(component).toHaveScreenshot();
});
});

Object.values(ALIGN).forEach(align => {
test(`Stack with align ${align} and direction row`, async ({ mount }) => {
const component = await mount(<StackStory align={align} />);

await expect(component).toHaveScreenshot();
});

test(`Stack with align ${align} and direction column`, async ({ mount }) => {
const component = await mount(<StackStory direction="column" align={align} />);

await expect(component).toHaveScreenshot();
});
});

Object.values(JUSTIFY).forEach(justify => {
test(`Stack with justify ${justify} and direction row`, async ({ mount }) => {
const component = await mount(<StackStory flex justify={justify} />);

await expect(component).toHaveScreenshot();
});

test(`Stack with justify ${justify} and direction column`, async ({ mount }) => {
const component = await mount(
<Box height="350px" background="cloudDark">
<StackStory flex direction="column" justify={justify} />
</Box>,
);

await expect(component).toHaveScreenshot();
});
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading