@toptal/picasso-page 5.1.7 → 5.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"file":"PageContent.d.ts","sourceRoot":"","sources":["../../../src/PageContent/PageContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,KAAiC,MAAM,OAAO,CAAA;AAIrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAOvD,MAAM,WAAW,KAAM,SAAQ,SAAS,EAAE,cAAc,CAAC,cAAc,CAAC;IACtE,oDAAoD;IACpD,QAAQ,EAAE,SAAS,CAAA;IACnB,kBAAkB;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAMD,eAAO,MAAM,WAAW,8EAgCvB,CAAA;AAQD,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"PageContent.d.ts","sourceRoot":"","sources":["../../../src/PageContent/PageContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAA;AACtD,OAAO,KAAiC,MAAM,OAAO,CAAA;AACrD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAA;AAQvD,MAAM,WAAW,KAAM,SAAQ,SAAS,EAAE,cAAc,CAAC,cAAc,CAAC;IACtE,oDAAoD;IACpD,QAAQ,EAAE,SAAS,CAAA;IACnB,kBAAkB;IAClB,IAAI,CAAC,EAAE,OAAO,CAAA;CACf;AAED,eAAO,MAAM,WAAW,8EA6BvB,CAAA;AAQD,eAAe,WAAW,CAAA"}
@@ -10,25 +10,17 @@ var __rest = (this && this.__rest) || function (s, e) {
10
10
  return t;
11
11
  };
12
12
  import React, { useContext, forwardRef } from 'react';
13
- import { makeStyles } from '@material-ui/core/styles';
14
- import cx from 'classnames';
15
13
  import { useSidebar } from '@toptal/picasso-provider';
14
+ import { twJoin, twMerge } from '@toptal/picasso-tailwind-merge';
16
15
  import { PageContext } from '../Page';
17
- import styles from './styles';
18
- const useStyles = makeStyles(styles, {
19
- name: 'PicassoPageContent',
20
- });
16
+ import { getMaxWidthClass } from './styles';
21
17
  export const PageContent = forwardRef(function PageContent(props, ref) {
22
18
  const { children, className, style, flex } = props, rest = __rest(props, ["children", "className", "style", "flex"]);
23
- const classes = useStyles();
24
19
  const { width, fullWidth } = useContext(PageContext);
25
20
  const { hasSidebar } = useSidebar();
26
- const innerClassName = cx({
27
- [classes.fullWidth]: fullWidth || width === 'full',
28
- [classes.wide]: width === 'wide',
29
- [classes.flex]: flex,
30
- }, classes.content);
31
- return (React.createElement("div", Object.assign({}, rest, { ref: ref, className: cx(classes.root, { [classes.hasSidebar]: hasSidebar }, className), style: style }),
21
+ const innerClassName = twJoin('h-full grow bg-[#fcfcfc] bg-clip-content', getMaxWidthClass({ fullWidth, width }), flex && 'flex');
22
+ return (React.createElement("div", Object.assign({}, rest, { ref: ref, className: twMerge('flex flex-[1] w-full justify-center', hasSidebar &&
23
+ 'bg-[linear-gradient(90deg,rgb(243,244,246)50%,rgb(252,252,252)50%)]', className), style: style }),
32
24
  React.createElement("div", { className: innerClassName }, children)));
33
25
  });
34
26
  PageContent.defaultProps = {
@@ -1 +1 @@
1
- {"version":3,"file":"PageContent.js","sourceRoot":"","sources":["../../../src/PageContent/PageContent.tsx"],"names":[],"mappings":";;;;;;;;;;;AACA,OAAO,KAAK,EAAE,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,OAAO,CAAA;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,EAAE,MAAM,YAAY,CAAA;AAE3B,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AAErD,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAErC,OAAO,MAAM,MAAM,UAAU,CAAA;AAS7B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: Theme) => import("@material-ui/styles").StyleRules<{}, "root" | "content" | "flex" | "wide" | "fullWidth" | "hasSidebar">;
3
- export default _default;
1
+ import type { PageContextProps } from '../Page/types';
2
+ export declare const getMaxWidthClass: ({ fullWidth, width }: PageContextProps) => "max-w-full" | "max-w-[90em]" | "max-w-[75em]";
4
3
  //# sourceMappingURL=styles.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/PageContent/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,0BAA0B,CAAA;8CAGhB,KAAK;AAA1C,wBA2BI"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../src/PageContent/styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAA;AAErD,eAAO,MAAM,gBAAgB,yBAA0B,gBAAgB,mDAUtE,CAAA"}
@@ -1,29 +1,10 @@
1
- import { createStyles } from '@material-ui/core/styles';
2
- export default ({ layout, palette }) => createStyles({
3
- root: {
4
- flex: 1,
5
- width: '100%',
6
- display: 'flex',
7
- justifyContent: 'center',
8
- },
9
- content: {
10
- height: '100%',
11
- flexGrow: 1,
12
- maxWidth: layout.contentWidth,
13
- backgroundColor: palette.grey.lightest,
14
- backgroundClip: 'content-box',
15
- },
16
- hasSidebar: {
17
- background: `linear-gradient(90deg, ${palette.grey.lighter} 50%, ${palette.grey.lightest} 50%)`,
18
- },
19
- wide: {
20
- maxWidth: layout.contentWidthWide,
21
- },
22
- fullWidth: {
23
- maxWidth: '100%',
24
- },
25
- flex: {
26
- display: 'flex',
27
- },
28
- });
1
+ export const getMaxWidthClass = ({ fullWidth, width }) => {
2
+ if (fullWidth || width === 'full') {
3
+ return 'max-w-full';
4
+ }
5
+ if (width === 'wide') {
6
+ return 'max-w-[90em]';
7
+ }
8
+ return 'max-w-[75em]';
9
+ };
29
10
  //# sourceMappingURL=styles.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/PageContent/styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAA;AAEvD,eAAe,CAAC,EAAE,MAAM,EAAE,OAAO,EAAS,EAAE,EAAE,CAC5C,YAAY,CAAC;IACX,IAAI,EAAE;QACJ,IAAI,EAAE,CAAC;QACP,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,MAAM;QACf,cAAc,EAAE,QAAQ;KACzB;IACD,OAAO,EAAE;QACP,MAAM,EAAE,MAAM;QACd,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,MAAM,CAAC,YAAY;QAC7B,eAAe,EAAE,OAAO,CAAC,IAAI,CAAC,QAAQ;QACtC,cAAc,EAAE,aAAa;KAC9B;IACD,UAAU,EAAE;QACV,UAAU,EAAE,0BAA0B,OAAO,CAAC,IAAI,CAAC,OAAO,SAAS,OAAO,CAAC,IAAI,CAAC,QAAQ,OAAO;KAChG;IACD,IAAI,EAAE;QACJ,QAAQ,EAAE,MAAM,CAAC,gBAAgB;KAClC;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,MAAM;KACjB;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM;KAChB;CACF,CAAC,CAAA"}
1
+ {"version":3,"file":"styles.js","sourceRoot":"","sources":["../../../src/PageContent/styles.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,EAAE,SAAS,EAAE,KAAK,EAAoB,EAAE,EAAE;IACzE,IAAI,SAAS,IAAI,KAAK,KAAK,MAAM,EAAE;QACjC,OAAO,YAAY,CAAA;KACpB;IAED,IAAI,KAAK,KAAK,MAAM,EAAE;QACpB,OAAO,cAAc,CAAA;KACtB;IAED,OAAO,cAAc,CAAA;AACvB,CAAC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@toptal/picasso-page",
3
- "version": "5.1.7",
3
+ "version": "5.1.8",
4
4
  "description": "Toptal UI components library - Page",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -1,14 +1,12 @@
1
1
  import type { ReactNode, HTMLAttributes } from 'react'
2
2
  import React, { useContext, forwardRef } from 'react'
3
- import type { Theme } from '@material-ui/core/styles'
4
- import { makeStyles } from '@material-ui/core/styles'
5
- import cx from 'classnames'
6
3
  import type { BaseProps } from '@toptal/picasso-shared'
7
4
  import { useSidebar } from '@toptal/picasso-provider'
5
+ import { twJoin, twMerge } from '@toptal/picasso-tailwind-merge'
8
6
 
9
7
  import { PageContext } from '../Page'
10
8
  import type { PageContextProps } from '../Page/types'
11
- import styles from './styles'
9
+ import { getMaxWidthClass } from './styles'
12
10
 
13
11
  export interface Props extends BaseProps, HTMLAttributes<HTMLDivElement> {
14
12
  /** Custom components that render content of page */
@@ -17,34 +15,27 @@ export interface Props extends BaseProps, HTMLAttributes<HTMLDivElement> {
17
15
  flex?: boolean
18
16
  }
19
17
 
20
- const useStyles = makeStyles<Theme>(styles, {
21
- name: 'PicassoPageContent',
22
- })
23
-
24
18
  export const PageContent = forwardRef<HTMLDivElement, Props>(
25
19
  function PageContent(props, ref) {
26
20
  const { children, className, style, flex, ...rest } = props
27
21
 
28
- const classes = useStyles()
29
22
  const { width, fullWidth } = useContext<PageContextProps>(PageContext)
30
23
  const { hasSidebar } = useSidebar()
31
24
 
32
- const innerClassName = cx(
33
- {
34
- [classes.fullWidth]: fullWidth || width === 'full',
35
- [classes.wide]: width === 'wide',
36
- [classes.flex]: flex,
37
- },
38
- classes.content
25
+ const innerClassName = twJoin(
26
+ 'h-full grow bg-[#fcfcfc] bg-clip-content',
27
+ getMaxWidthClass({ fullWidth, width }),
28
+ flex && 'flex'
39
29
  )
40
30
 
41
31
  return (
42
32
  <div
43
33
  {...rest}
44
34
  ref={ref}
45
- className={cx(
46
- classes.root,
47
- { [classes.hasSidebar]: hasSidebar },
35
+ className={twMerge(
36
+ 'flex flex-[1] w-full justify-center',
37
+ hasSidebar &&
38
+ 'bg-[linear-gradient(90deg,rgb(243,244,246)50%,rgb(252,252,252)50%)]',
48
39
  className
49
40
  )}
50
41
  style={style}
@@ -1,31 +1,13 @@
1
- import type { Theme } from '@material-ui/core/styles'
2
- import { createStyles } from '@material-ui/core/styles'
1
+ import type { PageContextProps } from '../Page/types'
3
2
 
4
- export default ({ layout, palette }: Theme) =>
5
- createStyles({
6
- root: {
7
- flex: 1,
8
- width: '100%',
9
- display: 'flex',
10
- justifyContent: 'center',
11
- },
12
- content: {
13
- height: '100%',
14
- flexGrow: 1,
15
- maxWidth: layout.contentWidth,
16
- backgroundColor: palette.grey.lightest,
17
- backgroundClip: 'content-box',
18
- },
19
- hasSidebar: {
20
- background: `linear-gradient(90deg, ${palette.grey.lighter} 50%, ${palette.grey.lightest} 50%)`,
21
- },
22
- wide: {
23
- maxWidth: layout.contentWidthWide,
24
- },
25
- fullWidth: {
26
- maxWidth: '100%',
27
- },
28
- flex: {
29
- display: 'flex',
30
- },
31
- })
3
+ export const getMaxWidthClass = ({ fullWidth, width }: PageContextProps) => {
4
+ if (fullWidth || width === 'full') {
5
+ return 'max-w-full'
6
+ }
7
+
8
+ if (width === 'wide') {
9
+ return 'max-w-[90em]'
10
+ }
11
+
12
+ return 'max-w-[75em]'
13
+ }