Skip to content

Commit f0149da

Browse files
committed
refactor(styles): remove deprecated breakpoints
1 parent d50213a commit f0149da

File tree

14 files changed

+27
-311
lines changed

14 files changed

+27
-311
lines changed

packages/components/src/config/variables.ts

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { icons } from '@suite-common/icons/src/icons';
2-
import { breakpoints } from '@trezor/theme';
2+
import { above, below, breakpoints } from '@trezor/theme';
33

44
/**
55
* @deprecated This key is deprecated. Please use `useLayoutSize` hook or breakpoints from `@trezor/theme`.
@@ -12,25 +12,18 @@ export const SCREEN_SIZE = {
1212
XL: `${breakpoints.desktop}px`,
1313
} as const;
1414

15-
const HELPER_SCREEN_SIZE = {
16-
SM: `${breakpoints.mobile - 1}px`,
17-
MD: `${breakpoints.tablet - 1}px`,
18-
LG: `${breakpoints.laptop - 1}px`,
19-
XL: `${breakpoints.desktop - 1}px`,
20-
};
21-
2215
/**
2316
* @deprecated This key is deprecated. Please use `useLayoutSize` hook or breakpoints from `@trezor/theme`.
2417
*/
2518
export const SCREEN_QUERY = {
26-
MOBILE: `@media (max-width: ${HELPER_SCREEN_SIZE.SM})`,
27-
ABOVE_MOBILE: `@media (min-width: ${SCREEN_SIZE.SM})`,
28-
BELOW_TABLET: `@media (max-width: ${HELPER_SCREEN_SIZE.MD})`,
29-
ABOVE_TABLET: `@media (min-width: ${SCREEN_SIZE.MD})`,
30-
BELOW_LAPTOP: `@media (max-width: ${HELPER_SCREEN_SIZE.LG})`,
31-
ABOVE_LAPTOP: `@media (min-width: ${SCREEN_SIZE.LG})`,
32-
BELOW_DESKTOP: `@media (max-width: ${HELPER_SCREEN_SIZE.XL})`,
33-
ABOVE_DESKTOP: `@media (min-width: ${SCREEN_SIZE.XL})`,
19+
MOBILE: `@media ${below(breakpoints.mobile)}`,
20+
ABOVE_MOBILE: `@media ${above(breakpoints.mobile)}`,
21+
BELOW_TABLET: `@media ${below(breakpoints.tablet)}`,
22+
ABOVE_TABLET: `@media ${above(breakpoints.tablet)}`,
23+
BELOW_LAPTOP: `@media ${below(breakpoints.laptop)}`,
24+
ABOVE_LAPTOP: `@media ${above(breakpoints.laptop)}`,
25+
BELOW_DESKTOP: `@media ${below(breakpoints.desktop)}`,
26+
ABOVE_DESKTOP: `@media ${above(breakpoints.desktop)}`,
3427
} as const;
3528

3629
export const LAYOUT_SIZE = {

packages/styles/src/breakpoints.ts

Lines changed: 0 additions & 22 deletions
This file was deleted.

packages/styles/src/createRenderer.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import felaPluginPlaceholderPrefixer from 'fela-plugin-placeholder-prefixer';
66
import felaPluginUnit from 'fela-plugin-unit';
77
import felaSortMediaQueryMobileFirst from 'fela-sort-media-query-mobile-first';
88

9-
import { makeResponsiveValuePlugin } from './plugins/responsiveValues';
109
import { makeTypedSelectorsPlugin } from './plugins/typedSelectors';
1110

1211
const isDevEnv = process.env.NODE_ENV === 'development';
@@ -25,7 +24,6 @@ export const createRenderer = () =>
2524
felaPluginEmbedded(),
2625
felaPluginMultipleSelectors(),
2726
felaPluginPlaceholderPrefixer(),
28-
makeResponsiveValuePlugin() as TPlugin,
2927
],
3028
// NOTE: Using a selector prefix is necessary because Fela generates class names like
3129
// `x y z aa ab ac`, meaning possible conflicts with classes such as `btn`.

packages/styles/src/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ export * from './createRenderer';
66
export * from './useDirection';
77
export * from './mergeStyleObjects';
88
export * from './mergeStyles';
9-
export * from './breakpoints';
109
export * from './mediaQueries';
1110
export * from './utils';

packages/styles/src/plugins/responsiveValues.test.ts

Lines changed: 0 additions & 176 deletions
This file was deleted.

packages/styles/src/plugins/responsiveValues.ts

Lines changed: 0 additions & 63 deletions
This file was deleted.

packages/styles/src/types.ts

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,17 +10,8 @@ import type { CSSColor, NativeTheme, Theme } from '@trezor/theme';
1010
import type { mediaQueries } from './mediaQueries';
1111
import type { getValueAndUnit, isDarkColor, multiply, negative, sum } from './utils';
1212

13-
export type Breakpoint = 'xs' | 'sm' | 'md' | 'lg' | 'xl' | 'xxl';
14-
1513
export type Direction = 'ltr' | 'rtl';
1614

17-
type MediaQuery = string;
18-
19-
type NonZeroBreakpoint = Exclude<Breakpoint, 'xs'>;
20-
type BelowBreakpoints = `below_${NonZeroBreakpoint}`;
21-
22-
export type BreakpointMediaQueries = Record<NonZeroBreakpoint | BelowBreakpoints, MediaQuery>;
23-
2415
export interface DirectionUtils {
2516
direction: Direction;
2617
isLtr: boolean;
@@ -41,7 +32,6 @@ export interface UniversalStyleUtils extends DirectionUtils {
4132
}
4233

4334
export interface StyleUtils extends Theme, UniversalStyleUtils {
44-
breakpoints: BreakpointMediaQueries;
4535
media: typeof mediaQueries;
4636
}
4737

@@ -58,7 +48,7 @@ type PlainResponsiveStyleObject = {
5848
[KPropertyName in Exclude<keyof PlainStyleObject, DisallowedPropertyName>]?:
5949
| PlainStyleObject[KPropertyName]
6050
| {
61-
[KBreakpoint in Breakpoint]?: PlainStyleObject[KPropertyName];
51+
[KBreakpoint in string]?: PlainStyleObject[KPropertyName];
6252
};
6353
} & {
6454
[KPropertyName in DisallowedPropertyName]?: never;

packages/styles/src/useStyles.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import { darken, lighten, transparentize } from 'polished';
55

66
import { NativeTheme, Theme } from '@trezor/theme';
77

8-
import { breakpointMediaQueries } from './breakpoints';
98
import { mediaQueries } from './mediaQueries';
109
import { processNativeStyles, processStyles } from './processStyles';
1110
import {
@@ -47,7 +46,6 @@ export const useStyles = () => {
4746
...theme,
4847
...directionUtils,
4948
...sharedUtils,
50-
breakpoints: breakpointMediaQueries,
5149
media: mediaQueries,
5250
}),
5351
[directionUtils, theme],

packages/suite/src/components/suite/ChangeDeviceLabelForm.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import styled from 'styled-components';
44

55
import { selectDeviceLabel, selectDeviceName } from '@suite-common/wallet-core';
66
import { Button, Input, Tooltip } from '@trezor/components';
7-
import { breakpointMediaQueries } from '@trezor/styles';
7+
import { SCREEN_QUERY } from '@trezor/components/src/config/variables';
88
import { spacingsPx } from '@trezor/theme';
99

1010
import { Translation } from 'src/components/suite';
@@ -17,7 +17,7 @@ const Container = styled.form<{ $isVertical?: boolean }>`
1717
gap: ${spacingsPx.sm};
1818
min-width: ${({ $isVertical }) => $isVertical && '200px'};
1919
20-
${breakpointMediaQueries.below_sm} {
20+
${SCREEN_QUERY.MOBILE} {
2121
min-width: ${({ $isVertical }) => $isVertical && '100%'};
2222
}
2323
`;

0 commit comments

Comments
 (0)