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(Hide): use native tailwind breakpoint range classes #4153

Merged
merged 3 commits into from
Nov 20, 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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ describe("Hide", () => {
);
expect(container.childNodes[1]).toMatchInlineSnapshot(`
<div
class="inline-block sm-mm:hidden lm-tb:hidden ld:hidden"
class="inline-block sm:max-mm:hidden lm:max-tb:hidden ld:hidden"
>
content
</div>
Expand Down
10 changes: 5 additions & 5 deletions packages/orbit-components/src/Hide/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import type { Props } from "./types";
const Hide = ({ on = [], block, children }: Props) => (
<div
className={cx(block ? "block" : "inline-block", {
"sm-mm:hidden": on.includes("smallMobile"),
"mm-lm:hidden": on.includes("mediumMobile"),
"lm-tb:hidden": on.includes("largeMobile"),
"tb-de:hidden": on.includes("tablet"),
"de-ld:hidden": on.includes("desktop"),
"sm:max-mm:hidden": on.includes("smallMobile"),
"mm:max-lm:hidden": on.includes("mediumMobile"),
"lm:max-tb:hidden": on.includes("largeMobile"),
"tb:max-de:hidden": on.includes("tablet"),
"de:max-ld:hidden": on.includes("desktop"),
"ld:hidden": on.includes("largeDesktop"),
})}
>
Expand Down
2 changes: 1 addition & 1 deletion packages/orbit-components/src/Modal/ModalFooter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const ModalFooter = ({ dataTest, children, flex = "0 1 auto" }: Props) => {
"orbit-modal-footer",
"z-overlay bg-white-normal px-md pb-md box-border flex w-full pt-0",
"duration-fast transition-shadow ease-in-out",
"sm-lm:[&_.orbit-button-primitive]:h-form-box-normal sm-lm:[&_.orbit-button-primitive]:text-button-normal",
"sm:max-lm:[&_.orbit-button-primitive]:h-form-box-normal sm:max-lm:[&_.orbit-button-primitive]:text-button-normal",
childrenLength > 1 ? "lm:justify-between" : "lm:justify-end",
!isMobileFullPage && "lm:rounded-b-modal",
"[&_.orbit-modal-footer-child:last-of-type]:p-0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("Desktop", () => {
render(<Desktop>kek</Desktop>);
expect(screen.getByText("kek")).toMatchInlineSnapshot(`
<div
class="inline-block sm-mm:hidden mm-lm:hidden lm-tb:hidden tb-de:hidden"
class="inline-block sm:max-mm:hidden mm:max-lm:hidden lm:max-tb:hidden tb:max-de:hidden"
>
kek
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ describe("Mobile", () => {
render(<Mobile>kek</Mobile>);
expect(screen.getByText("kek")).toMatchInlineSnapshot(`
<div
class="inline-block de-ld:hidden ld:hidden"
class="inline-block de:max-ld:hidden ld:hidden"
>
kek
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2999,33 +2999,11 @@ exports[`orbitPreset should match snapshot 1`] = `
},
"screens": {
"de": "992px",
"de-ld": {
"max": "1199px",
"min": "992px",
},
"ld": "1200px",
"lm": "576px",
"lm-tb": {
"max": "767px",
"min": "576px",
},
"mm": "414px",
"mm-lm": {
"max": "575px",
"min": "414px",
},
"sm": "320px",
"sm-lm": {
"max": "575px",
},
"sm-mm": {
"max": "413px",
},
"tb": "768px",
"tb-de": {
"max": "991px",
"min": "768px",
},
},
"scrollMargin": {
"0": "0px",
Expand Down
24 changes: 0 additions & 24 deletions packages/orbit-tailwind-preset/src/presets/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ const COLORS: Partial<ExportedComponentLevelTokens>[] = [
"countryFlag",
];

const px = (n: number) => `${n}px`;

interface Options {
/** default: true e.g. does not include default normalize styles */
disablePreflight?: boolean;
Expand Down Expand Up @@ -88,28 +86,6 @@ const cfg = (options?: Options): Config => {
},
theme: {
extend: {
screens: {
"sm-mm": { max: px(tokens.breakpointMediumMobile - 1) },
"sm-lm": {
max: px(tokens.breakpointLargeMobile - 1),
},
Comment on lines -93 to -95
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is being used in ModalFooter.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch, thanks

"mm-lm": {
min: px(tokens.breakpointMediumMobile),
max: px(tokens.breakpointLargeMobile - 1),
},
"lm-tb": {
min: px(tokens.breakpointLargeMobile),
max: px(tokens.breakpointTablet - 1),
},
"tb-de": {
min: px(tokens.breakpointTablet),
max: px(tokens.breakpointDesktop - 1),
},
"de-ld": {
min: px(tokens.breakpointDesktop),
max: px(tokens.breakpointLargeDesktop - 1),
},
},
fontSize: {
"heading-display": tokens.headingDisplayFontSize,
"heading-display-subtitle": tokens.headingDisplaySubtitleFontSize,
Expand Down
Loading