jamespot-react-components 1.0.9 → 1.0.16

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.
Files changed (30) hide show
  1. package/.storybook/StorybookContainer/StorybookContainer.css +1 -0
  2. package/babel.config.js +0 -1
  3. package/build/jamespot-react-components.js +224 -221
  4. package/build/jamespot-react-components.js.LICENSE.txt +22 -0
  5. package/build/jamespot-react-components.js.map +1 -1
  6. package/build/src/components/JRCAppContainer/JRCAppContainer.d.ts +1 -0
  7. package/build/src/components/Templates/JRCBase.template.d.ts +9 -0
  8. package/build/src/components/Templates/JRCTemplate.stories.d.ts +13 -0
  9. package/build/src/components/Templates/JRCTwoColumns.template.d.ts +7 -0
  10. package/build/src/index.d.ts +3 -2
  11. package/build/src/styles/theme.d.ts +3 -1
  12. package/build/src/types.d.ts +2 -2
  13. package/externals.json +1 -0
  14. package/package.json +4 -3
  15. package/src/components/JRCAppContainer/JRCAppContainer.tsx +6 -2
  16. package/src/components/JRCAppLeftColumn/JRCAppLeftColumn.styles.tsx +2 -1
  17. package/src/components/JRCAvatar/JRCAvatar.test.tsx +10 -6
  18. package/src/components/JRCAvatar/JRCAvatar.tsx +1 -0
  19. package/src/components/JRCButton/__snapshots__/JRCButton.test.tsx.snap +1 -2
  20. package/src/components/JRCModal/JRCModal.tsx +88 -89
  21. package/src/components/JRCThemeProvider/font.css +1 -1
  22. package/src/components/JRCTypography/__snapshots__/JRCTypography.test.tsx.snap +1 -1
  23. package/src/components/Templates/JRCBase.template.tsx +39 -0
  24. package/src/components/Templates/JRCTemplate.stories.tsx +55 -0
  25. package/src/components/Templates/JRCTwoColumns.template.tsx +20 -0
  26. package/src/index.tsx +8 -3
  27. package/src/styles/theme.tsx +9 -4
  28. package/src/types.ts +4 -2
  29. package/build/src/components/JRCColumnCenterTitle/JRCColumnCenterTitle.d.ts +0 -12
  30. package/src/components/JRCColumnCenterTitle/JRCColumnCenterTitle.tsx +0 -26
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ export declare const CONTAINER_PADDING = 32;
2
3
  export interface JRCAppContainerProps {
3
4
  children: React.ReactNode;
4
5
  }
@@ -0,0 +1,9 @@
1
+ import * as React from 'react';
2
+ export declare type JRCTemplateBaseProps = {
3
+ children: React.ReactNode;
4
+ isLoading: boolean;
5
+ title?: React.ReactNode;
6
+ };
7
+ export declare const ChildrenContainerStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
8
+ export declare const ChildrenContainer: (props: JRCTemplateBaseProps) => JSX.Element;
9
+ export declare const JRCTemplateBase: React.FC<any>;
@@ -0,0 +1,13 @@
1
+ import React from 'react';
2
+ import { JRCTemplateBaseProps } from './JRCBase.template';
3
+ import { Story } from '@storybook/react';
4
+ import { JRCTemplateTwoColumnsProps } from './JRCTwoColumns.template';
5
+ declare const _default: {
6
+ title: string;
7
+ component: React.FC<any>;
8
+ };
9
+ export default _default;
10
+ export declare const BaseTemplateDemo: Story<JRCTemplateBaseProps>;
11
+ export declare const BaseTemplateDemoLoading: Story<JRCTemplateBaseProps>;
12
+ export declare const TemplateWithLeftColumnDemo: Story<JRCTemplateTwoColumnsProps<any>>;
13
+ export declare const TemplateWithLeftColumnDemoLoading: Story<JRCTemplateTwoColumnsProps<any>>;
@@ -0,0 +1,7 @@
1
+ import * as React from 'react';
2
+ import { JRCAppLeftColumnProps, SectionEntry } from 'types';
3
+ import { JRCTemplateBaseProps } from './JRCBase.template';
4
+ export declare type JRCTemplateTwoColumnsProps<T extends SectionEntry> = {
5
+ leftColumn: JRCAppLeftColumnProps<T>;
6
+ } & JRCTemplateBaseProps;
7
+ export declare const JRCTemplateTwoColumns: React.FC<any>;
@@ -15,6 +15,7 @@ declare global {
15
15
  reactDnd: any;
16
16
  reactDndHtml5Backend: any;
17
17
  reactHookForm: any;
18
+ reactRouterDom: any;
18
19
  }
19
20
  }
20
21
  /****
@@ -39,8 +40,6 @@ export { JRCButtonDropdown };
39
40
  export { JRCCard } from './components/JRCCard/JRCCard';
40
41
  import JRCColumnCenter from './components/JRCColumnCenter/JRCColumnCenter';
41
42
  export { JRCColumnCenter };
42
- import JRCColumnCenterTitle from './components/JRCColumnCenterTitle/JRCColumnCenterTitle';
43
- export { JRCColumnCenterTitle };
44
43
  import JRCColumnLeft from './components/JRCColumnLeft/JRCColumnLeft';
45
44
  export { JRCColumnLeft };
46
45
  import JRCColumnRight from './components/JRCColumnRight/JRCColumnRight';
@@ -111,6 +110,8 @@ export { JRCInputCommunity } from './components/Form/Input/JRCSelect/JRCAutocomp
111
110
  export { JRCInputText } from './components/Form/Input/JRCInputText/JRCInputText';
112
111
  export { JRCInputTextarea } from './components/Form/Input/JRCInputTextarea/JRCInputTextarea';
113
112
  export { JRCInputDate } from './components/Form/Input/JRCInputDate/JRCInputDate';
113
+ export { JRCTemplateBase } from './components/Templates/JRCBase.template';
114
+ export { JRCTemplateTwoColumns } from './components/Templates/JRCTwoColumns.template';
114
115
  /****
115
116
  *
116
117
  * PLEASE RESPECT ALPHABETICAL ORDER
@@ -4,6 +4,7 @@ export interface ITheme {
4
4
  initTheme: (options: ThemeConfigOptions) => void;
5
5
  }
6
6
  export declare type ThemeConfigOptions = {
7
+ fontFamily: string;
7
8
  linkColor: string;
8
9
  buttonColor: string;
9
10
  headerColor: string;
@@ -25,8 +26,10 @@ declare type ThemeConfigShadeType = {
25
26
  [color in Shades]: string;
26
27
  };
27
28
  export declare type FontWeight = {
29
+ light: number;
28
30
  normal: number;
29
31
  medium: number;
32
+ semiBold: number;
30
33
  bold: number;
31
34
  };
32
35
  export declare type ThemeType = {
@@ -37,7 +40,6 @@ export declare type ThemeType = {
37
40
  hrefColor: string;
38
41
  size: string;
39
42
  lineHeight: string;
40
- fontWeight: number;
41
43
  weight: FontWeight;
42
44
  };
43
45
  color: ThemeConfigColorType & ThemeConfigShadeType;
@@ -31,8 +31,6 @@ export { JRCButtonProps };
31
31
  export { JRCButtonDropdownProps } from './components/JRCButtonDropdown/JRCButtonDropdown';
32
32
  import { JRCColumnCenterProps } from './components/JRCColumnCenter/JRCColumnCenter';
33
33
  export { JRCColumnCenterProps };
34
- import { JRCColumnCenterTitleProps } from './components/JRCColumnCenterTitle/JRCColumnCenterTitle';
35
- export { JRCColumnCenterTitleProps };
36
34
  import { JRCColumnLeftProps } from './components/JRCColumnLeft/JRCColumnLeft';
37
35
  export { JRCColumnLeftProps };
38
36
  import { JRCColumnRightProps } from './components/JRCColumnRight/JRCColumnRight';
@@ -77,6 +75,8 @@ import { JRCValueLabelProps } from './components/Form/Common/types';
77
75
  export { JRCValueLabelProps };
78
76
  import { JRCWritableFormInputProps } from './components/Form/Input/JRCFormFieldRender';
79
77
  export { JRCWritableFormInputProps };
78
+ export { JRCTemplateBaseProps } from './components/Templates/JRCBase.template';
79
+ export { JRCTemplateTwoColumnsProps } from './components/Templates/JRCTwoColumns.template';
80
80
  import { JRCTypographyProps } from './components/JRCTypography/JRCTypography.d';
81
81
  export { JRCTypographyProps };
82
82
  export { JRCValidationButtonProps } from './components/JRCButton/JRCValidationButton';
package/externals.json CHANGED
@@ -9,6 +9,7 @@
9
9
  "redux": "redux",
10
10
  "redux-form": "reduxForm",
11
11
  "react-intl": "reactIntl",
12
+ "react-router-dom": "reactRouterDom",
12
13
  "styled-components": "styledComponents",
13
14
  "react-dnd": "reactDnd",
14
15
  "react-dnd-html5-backend": "reactDndHtml5Backend",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "jamespot-react-components",
3
- "version": "1.0.9",
3
+ "version": "1.0.16",
4
4
  "description": "",
5
5
  "main": "./build/jamespot-react-components.js",
6
6
  "types": "./build/src/index.d.ts",
@@ -49,6 +49,7 @@
49
49
  "@types/react": "^17.0.2",
50
50
  "@types/react-dom": "^17.0.2",
51
51
  "@types/react-redux": "^7.1.9",
52
+ "@types/react-router-dom": "^5.3.3",
52
53
  "@types/react-select": "^3.1.2",
53
54
  "@types/react-slick": "^0.23.4",
54
55
  "@types/react-table": "^7.7.3",
@@ -85,7 +86,6 @@
85
86
  "webpack-dev-server": "^4.4.0"
86
87
  },
87
88
  "dependencies": {
88
- "@quickbaseoss/babel-plugin-styled-components-css-namespace": "^1.0.1",
89
89
  "@tiptap/extension-color": "^2.0.0-beta.8",
90
90
  "@tiptap/extension-heading": "^2.0.0-beta.23",
91
91
  "@tiptap/extension-link": "^2.0.0-beta.28",
@@ -96,7 +96,7 @@
96
96
  "@types/redux-logger": "^3.0.8",
97
97
  "chroma-js": "^2.1.1",
98
98
  "classnames": "^2.3.1",
99
- "jamespot-user-api": "1.0.13",
99
+ "jamespot-user-api": "file:../jamespot-user-api",
100
100
  "moment": "^2.29.1",
101
101
  "react": "^17.x",
102
102
  "react-dnd": "^14.0.4",
@@ -105,6 +105,7 @@
105
105
  "react-hook-form": "^7.25.0",
106
106
  "react-intl": "^5.8.6",
107
107
  "react-redux": "^7.2.3",
108
+ "react-router-dom": "^6.2.1",
108
109
  "react-select": "^3.2.0",
109
110
  "react-slick": "^0.28.1",
110
111
  "react-table": "^7.7.0",
@@ -1,13 +1,17 @@
1
1
  import * as React from 'react';
2
2
  import styled from 'styled-components';
3
3
 
4
+ export const CONTAINER_PADDING = 32;
5
+
4
6
  const Container = styled.div`
5
7
  display: flex;
6
8
  max-width: 1600px;
7
9
  width: 100%;
8
10
  margin: auto;
9
- gap: 16px;
10
- padding: 16px;
11
+ gap: ${CONTAINER_PADDING}px;
12
+ padding: ${CONTAINER_PADDING}px;
13
+ background-color: ${(props) => props.theme.color.white};
14
+ min-height: calc(var(--body-height) - ${CONTAINER_PADDING * 2}px);
11
15
  `;
12
16
 
13
17
  export interface JRCAppContainerProps {
@@ -2,6 +2,7 @@ import { ItemButton } from '../JRCTabs/JRCTabs';
2
2
  import styled from 'styled-components';
3
3
  import { JRCH2 } from '../JRCTypo/JRCTypo';
4
4
  import { JRCIconButton } from '../JRCIconButton/JRCIconButton';
5
+ import { CONTAINER_PADDING } from 'components/JRCAppContainer/JRCAppContainer';
5
6
 
6
7
  export const JRCAppLeftColumnWrapperTop = styled.div`
7
8
  display: flex;
@@ -21,7 +22,7 @@ export const ColumnRelativeSticky = styled.div<{ isMinimized: boolean; isClosed:
21
22
  display: flex;
22
23
  position: sticky;
23
24
  bottom: 0;
24
- min-height: calc(var(--body-height) - 32px);
25
+ min-height: calc(var(--body-height) - ${CONTAINER_PADDING * 2}px);
25
26
  background: ${(props) => props.theme.color.grey0};
26
27
  min-width: ${(props) => (props.isMinimized ? '80px' : '300px')};
27
28
  overflow: ${(props) => (props.isClosed ? 'visible' : 'hidden')};
@@ -4,19 +4,23 @@ import { screen } from '@testing-library/react';
4
4
 
5
5
  import JRCAvatar from './JRCAvatar';
6
6
 
7
+ const SIZE = 3;
8
+
7
9
  describe('JRCAvatar', () => {
8
10
  beforeEach(() => {
9
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
10
- // @ts-ignore FIXME remove that when upgrading to typescript version > 4.2.x
11
- renderWithWrapper(<JRCAvatar type="user" recordId="1234" size="3" alt="avatar of user John Doe" />);
11
+ renderWithWrapper(
12
+ <JRCAvatar type="user" recordId="1234" size={SIZE} alt="avatar of user John Doe" />,
13
+ );
12
14
  });
13
15
 
14
16
  test('medium avatar to have a proper size', () => {
15
- expect(screen.getByRole('img')).toHaveAttribute('width', '24');
16
- expect(screen.getByRole('img')).toHaveAttribute('height', '24');
17
+ const width = (8 * SIZE).toString();
18
+ expect(screen.getByRole('img')).toHaveAttribute('width', width);
19
+ expect(screen.getByRole('img')).toHaveAttribute('height', width);
17
20
  });
18
21
 
19
22
  test('medium avatar to download an img twice the container size', () => {
20
- expect(screen.getByRole('img')).toHaveAttribute('src', '/imagecache/48x48/user/1234.png');
23
+ const width = (Math.ceil(window.devicePixelRatio) * 8 * SIZE).toString();
24
+ expect(screen.getByRole('img')).toHaveAttribute('src', `/imagecache/${width}x${width}/user/1234.png`);
21
25
  });
22
26
  });
@@ -71,6 +71,7 @@ const JRCAvatar = (props: JRCAvatarProps) => {
71
71
  ...otherProps,
72
72
  width: imgSize,
73
73
  height: imgSize,
74
+ size: `${imgSize * 2}x${imgSize * 2}`,
74
75
  format: format,
75
76
  alt: alt,
76
77
  'aria-hidden': alt ? undefined : true,
@@ -3,8 +3,7 @@
3
3
  exports[`JRCButton match snapshot 1`] = `
4
4
  <DocumentFragment>
5
5
  <button
6
- class="sc-dkPtRN kttjSS"
7
- color="primary"
6
+ class="sc-jRQBWg LNyd"
8
7
  type="button"
9
8
  >
10
9
  I'm a text
@@ -96,109 +96,108 @@ const JRCModalContainerClickAway = ({
96
96
  const JRCModal = React.forwardRef(
97
97
  (
98
98
  {
99
- open,
100
- closeHandler,
101
- buttons,
102
- children,
103
- title,
104
- showIconClose,
105
- enableClickAwayCloseModal,
106
- isFull,
107
- headerButtons,
108
- portalId = 'react-modal',
109
- inPlace = false,
110
- className,
111
- }: JRCModalProps,
99
+ open,
100
+ closeHandler,
101
+ buttons,
102
+ children,
103
+ title,
104
+ showIconClose,
105
+ enableClickAwayCloseModal,
106
+ isFull,
107
+ headerButtons,
108
+ portalId = 'react-modal',
109
+ inPlace = false,
110
+ className,
111
+ }: JRCModalProps,
112
112
  ref: React.ForwardedRef<HTMLDivElement>,
113
- ) => {
114
-
115
- const closeModal = () => {
116
- closeHandler();
117
- };
113
+ ) => {
114
+ const closeModal = () => {
115
+ closeHandler();
116
+ };
118
117
 
119
- const escapeHandler = (e: React.KeyboardEvent) => {
120
- if (e.key == 'Escape') closeHandler();
121
- };
118
+ const escapeHandler = (e: React.KeyboardEvent) => {
119
+ if (e.key == 'Escape') closeHandler();
120
+ };
122
121
 
123
122
  const handleClickAway = (event: any) => {
124
123
  event.stopPropagation();
125
124
  closeHandler();
126
125
  };
127
126
 
128
- const getClickHandlerList = () => {
129
- const handlerList: (() => void)[] = [];
130
- if (buttons != undefined) {
131
- buttons.map((button: JRCModalButtonType) => {
132
- if (button.isClosed == undefined || !button.isClosed)
133
- handlerList.push(() => {
134
- closeHandler();
135
- button.clickHandler != undefined && button.clickHandler();
136
- });
137
- else
138
- handlerList.push(() => {
139
- /* dummy void */
140
- });
141
- });
142
- }
143
- return handlerList;
144
- }
127
+ const getClickHandlerList = () => {
128
+ const handlerList: (() => void)[] = [];
129
+ if (buttons != undefined) {
130
+ buttons.map((button: JRCModalButtonType) => {
131
+ if (button.isClosed == undefined || !button.isClosed)
132
+ handlerList.push(() => {
133
+ closeHandler();
134
+ button.clickHandler != undefined && button.clickHandler();
135
+ });
136
+ else
137
+ handlerList.push(() => {
138
+ /* dummy void */
139
+ });
140
+ });
141
+ }
142
+ return handlerList;
143
+ };
145
144
 
146
145
  const displayHeaderButtons = headerButtons ? headerButtons : null;
147
146
  const clickHandlerList = getClickHandlerList();
148
147
  const portalDiv = document.getElementById(portalId);
149
148
 
150
- const ModalBox = () => (
151
- <JRCModalBox onKeyDown={(e) => escapeHandler(e)} tabIndex={0} ref={ref} className={className}>
152
- <JRCModalContainerClickAway
153
- className="modal-container"
154
- onClickAway={enableClickAwayCloseModal ? handleClickAway : undefined}
155
- isFull={isFull}>
156
- {(title || showIconClose) && (
157
- <JRCModalHeader className={'modal-header'}>
158
- {title && <JRCH3>{title}</JRCH3>}
159
- {displayHeaderButtons}
160
- {showIconClose && (
161
- <JRCModalClose>
162
- <JRCIconButton icon="icon-times" onClick={closeModal} />
163
- </JRCModalClose>
164
- )}
165
- </JRCModalHeader>
166
- )}
167
-
168
- <JRCModalContent className="modal-content">{children}</JRCModalContent>
169
-
170
- {buttons ? (
171
- <JRCModalFooter>
172
- {buttons.map((button: JRCModalButtonType, index: number) => (
173
- <JRCButton
174
- key={index}
175
- color={button.color}
176
- variant={button.variant}
177
- onClick={button.isClosed ? closeModal : clickHandlerList[index]}>
178
- {button.children}
179
- </JRCButton>
180
- ))}
181
- </JRCModalFooter>
182
- ) : null}
183
- </JRCModalContainerClickAway>
184
- </JRCModalBox>
185
- );
186
-
187
- if (open) {
188
- if (inPlace) {
189
- return <ModalBox />;
190
- } else if (portalDiv) {
191
- // when using a portal, we need to provide the Theme explicitely
192
- return ReactDOM.createPortal(
193
- <JRCThemeProvider>
194
- <ModalBox />
195
- </JRCThemeProvider>,
196
- portalDiv,
197
- );
149
+ const ModalBox = () => (
150
+ <JRCModalBox onKeyDown={(e) => escapeHandler(e)} tabIndex={0} ref={ref} className={className}>
151
+ <JRCModalContainerClickAway
152
+ className="modal-container"
153
+ onClickAway={enableClickAwayCloseModal ? handleClickAway : undefined}
154
+ isFull={isFull}>
155
+ {(title || showIconClose) && (
156
+ <JRCModalHeader className={'modal-header'}>
157
+ {title && <JRCH3>{title}</JRCH3>}
158
+ {displayHeaderButtons}
159
+ {showIconClose && (
160
+ <JRCModalClose>
161
+ <JRCIconButton icon="icon-times" onClick={closeModal} />
162
+ </JRCModalClose>
163
+ )}
164
+ </JRCModalHeader>
165
+ )}
166
+
167
+ <JRCModalContent className="modal-content">{children}</JRCModalContent>
168
+
169
+ {buttons ? (
170
+ <JRCModalFooter>
171
+ {buttons.map((button: JRCModalButtonType, index: number) => (
172
+ <JRCButton
173
+ key={index}
174
+ color={button.color}
175
+ variant={button.variant}
176
+ onClick={button.isClosed ? closeModal : clickHandlerList[index]}>
177
+ {button.children}
178
+ </JRCButton>
179
+ ))}
180
+ </JRCModalFooter>
181
+ ) : null}
182
+ </JRCModalContainerClickAway>
183
+ </JRCModalBox>
184
+ );
185
+
186
+ if (open) {
187
+ if (inPlace) {
188
+ return <ModalBox />;
189
+ } else if (portalDiv) {
190
+ // when using a portal, we need to provide the Theme explicitely
191
+ return ReactDOM.createPortal(
192
+ <JRCThemeProvider>
193
+ <ModalBox />
194
+ </JRCThemeProvider>,
195
+ portalDiv,
196
+ );
197
+ }
198
198
  }
199
- }
200
- return null;
201
- }
199
+ return null;
200
+ },
202
201
  );
203
202
 
204
203
  export default JRCModal;
@@ -5,7 +5,7 @@
5
5
  .react-reset button,
6
6
  .react-reset select,
7
7
  .react-reset textarea {
8
- font-family: 'Poppins';
8
+ font-family: var(--font-family);
9
9
  font-size: 14px;
10
10
  line-height: 1.5em;
11
11
  font-weight: 400;
@@ -3,7 +3,7 @@
3
3
  exports[`JRCTypography match snapshot 1`] = `
4
4
  <DocumentFragment>
5
5
  <p
6
- class="sc-bdvvtL iOYRhi"
6
+ class="sc-bdvvtL gGmII"
7
7
  >
8
8
  JRCTypography
9
9
  </p>
@@ -0,0 +1,39 @@
1
+ import { JRCAppContainer } from 'components/JRCAppContainer/JRCAppContainer';
2
+ import JRCLoader from 'components/JRCLoader/JRCLoader';
3
+ import { JRCTypography } from 'components/JRCTypography/JRCTypography';
4
+ import * as React from 'react';
5
+ import styled from 'styled-components';
6
+
7
+ export type JRCTemplateBaseProps = {
8
+ children: React.ReactNode;
9
+ isLoading: boolean;
10
+ title?: React.ReactNode;
11
+ };
12
+
13
+ export const ChildrenContainerStyle = styled.div`
14
+ display: block;
15
+ width: 100%;
16
+ `;
17
+
18
+ export const ChildrenContainer = (props: JRCTemplateBaseProps) => {
19
+ return (
20
+ <ChildrenContainerStyle>
21
+ {props.title && (
22
+ <JRCTypography variant="h1" size="xl" weight="medium">
23
+ {props.title}
24
+ </JRCTypography>
25
+ )}
26
+ {props.isLoading ? <JRCLoader variant="skeleton" /> : <>{props.children}</>}
27
+ </ChildrenContainerStyle>
28
+ );
29
+ };
30
+
31
+ export const JRCTemplateBase: React.FC<any> = (props: JRCTemplateBaseProps) => {
32
+ return (
33
+ <JRCAppContainer>
34
+ <ChildrenContainer title={props.title} isLoading={props.isLoading}>
35
+ {props.children}
36
+ </ChildrenContainer>
37
+ </JRCAppContainer>
38
+ );
39
+ };
@@ -0,0 +1,55 @@
1
+ import React from 'react';
2
+ import { JRCTemplateBase, JRCTemplateBaseProps } from './JRCBase.template';
3
+ import { Story } from '@storybook/react';
4
+ import { JRCTemplateTwoColumns, JRCTemplateTwoColumnsProps } from './JRCTwoColumns.template';
5
+
6
+ export default {
7
+ title: 'JRCTemplateBase',
8
+ component: JRCTemplateBase,
9
+ };
10
+
11
+ const Template: Story<JRCTemplateBaseProps> = (args: JRCTemplateBaseProps) => {
12
+ return <JRCTemplateBase {...args}>{args.children}</JRCTemplateBase>;
13
+ };
14
+
15
+ export const BaseTemplateDemo = Template.bind({});
16
+ BaseTemplateDemo.args = {
17
+ children: 'App content',
18
+ title: 'content title',
19
+ };
20
+ export const BaseTemplateDemoLoading = Template.bind({});
21
+ BaseTemplateDemoLoading.args = {
22
+ children: 'App content',
23
+ isLoading: true,
24
+ title: 'content title',
25
+ };
26
+
27
+ const TemplateWithLeftColumn: Story<JRCTemplateTwoColumnsProps<any>> = (args: JRCTemplateTwoColumnsProps<any>) => {
28
+ return <JRCTemplateTwoColumns {...args}>{args.children}</JRCTemplateTwoColumns>;
29
+ };
30
+
31
+ export const TemplateWithLeftColumnDemo = TemplateWithLeftColumn.bind({});
32
+ TemplateWithLeftColumnDemo.args = {
33
+ children: 'App content',
34
+ title: 'content title',
35
+ leftColumn: {
36
+ icon: 'icon-edit',
37
+ color: 'red',
38
+ title: 'App title',
39
+ description: 'description',
40
+ },
41
+ };
42
+
43
+ export const TemplateWithLeftColumnDemoLoading = TemplateWithLeftColumn.bind({});
44
+
45
+ TemplateWithLeftColumnDemoLoading.args = {
46
+ children: 'App content',
47
+ title: 'content title',
48
+ isLoading: true,
49
+ leftColumn: {
50
+ icon: 'icon-edit',
51
+ color: 'red',
52
+ title: 'App title',
53
+ description: 'description',
54
+ },
55
+ };
@@ -0,0 +1,20 @@
1
+ import { JRCAppContainer, JRCAppLeftColumn } from 'index';
2
+ import * as React from 'react';
3
+ import { JRCAppLeftColumnProps, SectionEntry } from 'types';
4
+ import { ChildrenContainer, JRCTemplateBaseProps } from './JRCBase.template';
5
+
6
+ export type JRCTemplateTwoColumnsProps<T extends SectionEntry> = {
7
+ leftColumn: JRCAppLeftColumnProps<T>;
8
+ } & JRCTemplateBaseProps;
9
+
10
+ export const JRCTemplateTwoColumns: React.FC<any> = <T extends SectionEntry>(props: JRCTemplateTwoColumnsProps<T>) => {
11
+ const { icon, color, title, description } = props.leftColumn;
12
+ return (
13
+ <JRCAppContainer>
14
+ <JRCAppLeftColumn icon={icon} color={color} title={title} description={description} />
15
+ <ChildrenContainer title={props.title} isLoading={props.isLoading}>
16
+ {props.children}
17
+ </ChildrenContainer>
18
+ </JRCAppContainer>
19
+ );
20
+ };
package/src/index.tsx CHANGED
@@ -10,6 +10,7 @@ import * as jamespotUserApi from 'jamespot-user-api';
10
10
  import * as reactDnd from 'react-dnd';
11
11
  import * as reactDndHtml5Backend from 'react-dnd-html5-backend';
12
12
  import * as reactHookForm from 'react-hook-form';
13
+ import * as reactRouterDom from 'react-router-dom';
13
14
 
14
15
  /****
15
16
  * DECLARE SHARED LIBRARIES ON GLOBAL
@@ -29,6 +30,7 @@ declare global {
29
30
  reactDnd: any;
30
31
  reactDndHtml5Backend: any;
31
32
  reactHookForm: any;
33
+ reactRouterDom: any;
32
34
  }
33
35
  }
34
36
 
@@ -45,6 +47,7 @@ window.styledComponents = styled;
45
47
  window.reactDnd = reactDnd;
46
48
  window.reactDndHtml5Backend = reactDndHtml5Backend;
47
49
  window.reactHookForm = reactHookForm;
50
+ window.reactRouterDom = reactRouterDom;
48
51
 
49
52
  /****
50
53
  *
@@ -56,6 +59,7 @@ import JRCAlert from './components/JRCAlert/JRCAlert';
56
59
  export { JRCAlert };
57
60
 
58
61
  export { JRCAppHeader } from './components/JRCAppHeader/JRCAppHeader';
62
+
59
63
  export { JRCAppContainer } from './components/JRCAppContainer/JRCAppContainer';
60
64
  export { JRCAppLeftColumn } from './components/JRCAppLeftColumn/JRCAppLeftColumn';
61
65
 
@@ -79,9 +83,6 @@ export { JRCCard } from './components/JRCCard/JRCCard';
79
83
  import JRCColumnCenter from './components/JRCColumnCenter/JRCColumnCenter';
80
84
  export { JRCColumnCenter };
81
85
 
82
- import JRCColumnCenterTitle from './components/JRCColumnCenterTitle/JRCColumnCenterTitle';
83
- export { JRCColumnCenterTitle };
84
-
85
86
  import JRCColumnLeft from './components/JRCColumnLeft/JRCColumnLeft';
86
87
  export { JRCColumnLeft };
87
88
 
@@ -173,6 +174,7 @@ import { JRCH1, JRCH2, JRCH3, JRCH4, JRCH5, JRCText } from './components/JRCTypo
173
174
  export { JRCH1, JRCH2, JRCH3, JRCH4, JRCH5, JRCText };
174
175
 
175
176
  import { JRCTypography } from './components/JRCTypography/JRCTypography';
177
+ import { JRCAppHeader } from 'components/JRCAppHeader/JRCAppHeader';
176
178
  export { JRCTypography };
177
179
 
178
180
  export { JRCValidationButton } from './components/JRCButton/JRCValidationButton';
@@ -195,6 +197,9 @@ export { JRCInputText } from './components/Form/Input/JRCInputText/JRCInputText'
195
197
  export { JRCInputTextarea } from './components/Form/Input/JRCInputTextarea/JRCInputTextarea';
196
198
  export { JRCInputDate } from './components/Form/Input/JRCInputDate/JRCInputDate';
197
199
 
200
+ export { JRCTemplateBase } from './components/Templates/JRCBase.template';
201
+ export { JRCTemplateTwoColumns } from './components/Templates/JRCTwoColumns.template';
202
+
198
203
  /****
199
204
  *
200
205
  * PLEASE RESPECT ALPHABETICAL ORDER