Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Grid): migrate Grid to tailwind (#3965)
* feat(Grid): migrate Grid to tailwind * test: update snapshots * test(Layout): remove maxWidth assetion on Grid * test(Grid): add cypress media-query test
- Loading branch information
1 parent
b59a328
commit e19c2ae
Showing
8 changed files
with
237 additions
and
204 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
packages/orbit-components/cypress/integration/pages/grid-media-query.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { defaultTokens } from "@kiwicom/orbit-design-tokens"; | ||
|
||
describe("Grid media properties and gap", () => { | ||
it("should have correct gap for mediumMobile", () => { | ||
cy.visit("/grid-media-props"); | ||
cy.viewport(defaultTokens.widthBreakpointMediumMobile, 600); | ||
cy.findByTestId("test").should("have.css", "gap", "10px"); | ||
cy.findByTestId("test").should("have.css", "max-width", "300px"); | ||
}); | ||
|
||
it("should have correct gap for largeMobile", () => { | ||
cy.visit("/grid-media-props"); | ||
cy.viewport(defaultTokens.widthBreakpointLargeMobile, 600); | ||
cy.findByTestId("test").should("have.css", "gap", "20px"); | ||
cy.findByTestId("test").should("have.css", "max-width", "400px"); | ||
}); | ||
|
||
it("should have correct gap for tablet", () => { | ||
cy.visit("/grid-media-props"); | ||
cy.viewport(defaultTokens.widthBreakpointTablet, 600); | ||
cy.findByTestId("test").should("have.css", "gap", "30px"); | ||
cy.findByTestId("test").should("have.css", "max-width", "500px"); | ||
}); | ||
|
||
it("should have correct gap for desktop", () => { | ||
cy.visit("/grid-media-props"); | ||
cy.viewport(defaultTokens.widthBreakpointDesktop, 600); | ||
cy.findByTestId("test").should("have.css", "gap", "40px"); | ||
cy.findByTestId("test").should("have.css", "max-width", "600px"); | ||
}); | ||
|
||
it("should have correct gap for largeDesktop", () => { | ||
cy.visit("/grid-media-props"); | ||
cy.viewport(defaultTokens.widthBreakpointLargeDesktop, 600); | ||
cy.findByTestId("test").should("have.css", "gap", "50px"); | ||
cy.findByTestId("test").should("have.css", "max-width", "700px"); | ||
}); | ||
}); |
29 changes: 29 additions & 0 deletions
29
packages/orbit-components/cypress/integration/pages/grid-mediaquery-props.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import React from "react"; | ||
import { Grid } from "@kiwicom/orbit-components"; | ||
|
||
const commonStyles = { | ||
height: "30px", | ||
padding: "10px", | ||
width: "50px", | ||
display: "flex", | ||
alignItems: "center", | ||
}; | ||
|
||
export default function StackMediaProps() { | ||
return ( | ||
<Grid | ||
dataTest="test" | ||
columns="repeat(4, 1fr)" | ||
mediumMobile={{ gap: "10px", maxWidth: "300px" }} | ||
largeMobile={{ gap: "20px", maxWidth: "400px" }} | ||
tablet={{ gap: "30px", maxWidth: "500px" }} | ||
desktop={{ gap: "40px", maxWidth: "600px" }} | ||
largeDesktop={{ gap: "50px", maxWidth: "700px" }} | ||
> | ||
<div style={{ background: "blue", ...commonStyles }}>1</div> | ||
<div style={{ background: "red", ...commonStyles }}>2</div> | ||
<div style={{ background: "cyan", ...commonStyles }}>3</div> | ||
<div style={{ background: "magenta", ...commonStyles }}>4</div> | ||
</Grid> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
43 changes: 2 additions & 41 deletions
43
packages/orbit-components/src/utils/Grid/__tests__/__snapshots__/index.test.tsx.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 0 additions & 11 deletions
11
packages/orbit-components/src/utils/Grid/helpers/getDisplay.ts
This file was deleted.
Oops, something went wrong.
33 changes: 0 additions & 33 deletions
33
packages/orbit-components/src/utils/Grid/helpers/getViewportGridStyles.ts
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.