Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
BREAKING CHANGE: StyledBox removed. `.orbit-box` selector should be used
- Loading branch information
Showing
53 changed files
with
1,422 additions
and
532 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
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
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 |
---|---|---|
@@ -1 +1 @@ | ||
@import "tailwindcss/base"; | ||
@import "../../src/tailwind.css"; |
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
68 changes: 68 additions & 0 deletions
68
packages/orbit-components/cypress/integration/pages/box-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,68 @@ | ||
import { defaultTokens } from "@kiwicom/orbit-design-tokens"; | ||
import color from "onecolor"; | ||
|
||
describe("Box media query", () => { | ||
it("should have correct styles for medium mobile", () => { | ||
cy.visit("/box-media-props"); | ||
cy.viewport(defaultTokens.widthBreakpointMediumMobile, 600); | ||
const element = cy.findByText("Box Content"); | ||
element.should("have.css", "display", "flex"); | ||
element.should("have.css", "flex-wrap", "wrap"); | ||
element.should("have.css", "flex-direction", "row-reverse"); | ||
element.should("have.css", "position", "fixed"); | ||
element.should("have.css", "min-width", "42px"); | ||
element.should("not.have.css", "text-align", "center"); // Assertion of next media query style | ||
}); | ||
it("should have correct styles for large mobile", () => { | ||
cy.visit("/box-media-props"); | ||
cy.viewport(defaultTokens.widthBreakpointLargeMobile, 600); | ||
const element = cy.findByText("Box Content"); | ||
element.should("have.css", "text-align", "center"); | ||
element.should("have.css", "border-radius", defaultTokens.borderRadiusLarge); | ||
element.should("have.css", "overflow", "scroll"); | ||
element.should("have.css", "flex-shrink", "0"); | ||
element.should( | ||
"have.css", | ||
"color", | ||
color(defaultTokens.paletteOrangeDark).css().replaceAll(",", ", "), | ||
); | ||
element.should("not.have.css", "flex-grow", "1"); // Assertion of next media query style | ||
}); | ||
it("should have correct styles for tablet", () => { | ||
cy.visit("/box-media-props"); | ||
cy.viewport(defaultTokens.widthBreakpointTablet, 600); | ||
const element = cy.findByText("Box Content"); | ||
element.should("have.css", "flex-grow", "1"); | ||
element.should("have.css", "z-index", "42"); | ||
element.should("have.css", "width", "100px"); | ||
element.should("have.css", "justify-content", "space-between"); | ||
element.should("not.have.css", "align-items", "flex-end"); // Assertion of next media query style | ||
}); | ||
it("should have correct styles for desktop", () => { | ||
cy.visit("/box-media-props"); | ||
cy.viewport(defaultTokens.widthBreakpointDesktop, 600); | ||
const element = cy.findByText("Box Content"); | ||
element.should("not.have.css", "max-height", "24px"); // Assertion of next media query style | ||
element.should("have.css", "height", "10px"); | ||
element.should("have.css", "top", "10px"); | ||
element.should("have.css", "left", "5px"); | ||
element.should("have.css", "right", "0px"); | ||
element.should("have.css", "bottom", "-1px"); | ||
}); | ||
it("should have correct styles for large desktop", () => { | ||
cy.visit("/box-media-props"); | ||
cy.viewport(defaultTokens.widthBreakpointLargeDesktop, 600); | ||
const element = cy.findByText("Box Content"); | ||
element.should( | ||
"have.css", | ||
"background-color", | ||
color(defaultTokens.paletteRedLight).css().replaceAll(",", ", "), | ||
); | ||
element.should("have.css", "padding", defaultTokens.spaceLarge); | ||
element.should("have.css", "margin-top", defaultTokens.spaceSmall); | ||
element.should("have.css", "margin-left", "0px"); | ||
element.should("have.css", "margin-right", defaultTokens.spaceXSmall); | ||
element.should("have.css", "align-items", "flex-end"); | ||
element.should("have.css", "max-height", "24px"); | ||
}); | ||
}); |
46 changes: 46 additions & 0 deletions
46
packages/orbit-components/cypress/integration/pages/box-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,46 @@ | ||
import React from "react"; | ||
import { Box } from "@kiwicom/orbit-components"; | ||
|
||
export default function BoxMediaProps() { | ||
return ( | ||
<Box | ||
mediumMobile={{ | ||
display: "flex", | ||
wrap: "wrap", | ||
direction: "row-reverse", | ||
position: "fixed", | ||
minWidth: "42px", | ||
}} | ||
largeMobile={{ | ||
textAlign: "center", | ||
borderRadius: "large", | ||
overflow: "scroll", | ||
shrink: 0, | ||
color: "orangeDark", | ||
}} | ||
tablet={{ | ||
grow: 1, | ||
zIndex: 42, | ||
width: "100%", | ||
maxWidth: "100px", | ||
justify: "between", | ||
}} | ||
desktop={{ | ||
height: "10px", | ||
top: "10px", | ||
left: "5px", | ||
right: "0", | ||
bottom: "-1px", | ||
}} | ||
largeDesktop={{ | ||
background: "redLight", | ||
padding: "large", | ||
margin: { top: "small", left: "none", right: "XSmall" }, | ||
align: "end", | ||
maxHeight: "24px", | ||
}} | ||
> | ||
Box Content | ||
</Box> | ||
); | ||
} |
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
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
Oops, something went wrong.