@squiz/generic-browser-lib 1.67.3 → 1.67.5
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.
- package/CHANGELOG.md +12 -0
- package/lib/Icons/Icon.d.ts +2 -15
- package/lib/Icons/MatrixResources/ContentTemplate.d.ts +15 -0
- package/lib/Icons/MatrixResources/ContentTemplate.js +28 -0
- package/lib/Icons/MatrixResources/MatrixResourceMap.d.ts +2 -1
- package/lib/Icons/MatrixResources/MatrixResourceMap.js +1 -0
- package/lib/Icons/MatrixResources/PageContent.js +8 -10
- package/lib/Icons/MatrixResources/index.d.ts +1 -0
- package/lib/Icons/MatrixResources/index.js +3 -1
- package/lib/PreviewPanel/PreviewPanel.d.ts +4 -1
- package/lib/PreviewPanel/PreviewPanel.js +3 -3
- package/package.json +6 -6
- package/src/Icons/Icon.stories.tsx +6 -0
- package/src/Icons/MatrixResources/ContentTemplate.tsx +33 -0
- package/src/Icons/MatrixResources/MatrixResourceMap.ts +16 -1
- package/src/Icons/MatrixResources/PageContent.tsx +9 -10
- package/src/Icons/MatrixResources/index.tsx +1 -0
- package/src/PreviewPanel/PreviewPanel.tsx +8 -1
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# @squiz/generic-browser-lib
|
2
2
|
|
3
|
+
## 1.67.5
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 3fd4bff: Add ContentTemplate icon for content_template resources
|
8
|
+
|
9
|
+
## 1.67.4
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- cd70ef2: allow pass through of additional unspecified props to controlled component
|
14
|
+
|
3
15
|
## 1.67.3
|
4
16
|
|
5
17
|
### Patch Changes
|
package/lib/Icons/Icon.d.ts
CHANGED
@@ -14,26 +14,13 @@ export declare const iconSources: {
|
|
14
14
|
};
|
15
15
|
matrix: {
|
16
16
|
audio_file: typeof import("./MatrixResources").Audio;
|
17
|
+
content_template: typeof import("./MatrixResources").ContentTemplate;
|
17
18
|
excel_doc: typeof import("./MatrixResources").Excel;
|
18
19
|
folder: typeof import("./MatrixResources").Folder;
|
19
20
|
generic_file: typeof import("./MatrixResources").GenericFile;
|
20
21
|
image: typeof import("./MatrixResources").Image;
|
21
22
|
page_content: typeof import("./MatrixResources").PageContent;
|
22
|
-
page_standard: typeof import("./MatrixResources").Page;
|
23
|
-
* Renders an icon based on the resource source and the icon name
|
24
|
-
* @param {{resourceSource?: ResourceSources; icon?: IconOptions; props: React.HTMLAttributes<HTMLOrSVGElement>}} props - The props for the Icon component
|
25
|
-
* @returns {React.FunctionComponent} - The icon component
|
26
|
-
* @example
|
27
|
-
* <Icon />
|
28
|
-
* @example
|
29
|
-
* <Icon resourceSource="generic" icon="generic_file" />
|
30
|
-
* @example
|
31
|
-
* <Icon resourceSource="matrix" icon="page" />
|
32
|
-
* @example
|
33
|
-
* <Icon resourceSource="matrix" icon="page" height={24} width={24} />
|
34
|
-
* @example
|
35
|
-
* <Icon resourceSource="matrix" icon="page" className="custom-class" />
|
36
|
-
*/
|
23
|
+
page_standard: typeof import("./MatrixResources").Page;
|
37
24
|
pdf_file: typeof import("./MatrixResources").Pdf;
|
38
25
|
powerpoint_doc: typeof import("./MatrixResources").Powerpoint;
|
39
26
|
site: typeof import("./MatrixResources").Site;
|
@@ -0,0 +1,15 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
/**
|
3
|
+
* Renders the ContentTemplate icon
|
4
|
+
* @param {React.SVGProps<SVGSVGElement>} props - The props for the ContentTemplate component
|
5
|
+
* @returns {JSX.Element} - The ContentTemplate component
|
6
|
+
* @example
|
7
|
+
* <ContentTemplate />
|
8
|
+
* @example
|
9
|
+
* <ContentTemplate height={24} width={24} />
|
10
|
+
* @example
|
11
|
+
* <ContentTemplate className="custom-class" />
|
12
|
+
*/
|
13
|
+
export default function ContentTemplate({ isDecorative, ...props }: {
|
14
|
+
isDecorative: boolean;
|
15
|
+
} & React.SVGProps<SVGSVGElement>): React.JSX.Element;
|
@@ -0,0 +1,28 @@
|
|
1
|
+
"use strict";
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
|
+
};
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
+
const react_1 = __importDefault(require("react"));
|
7
|
+
/**
|
8
|
+
* Renders the ContentTemplate icon
|
9
|
+
* @param {React.SVGProps<SVGSVGElement>} props - The props for the ContentTemplate component
|
10
|
+
* @returns {JSX.Element} - The ContentTemplate component
|
11
|
+
* @example
|
12
|
+
* <ContentTemplate />
|
13
|
+
* @example
|
14
|
+
* <ContentTemplate height={24} width={24} />
|
15
|
+
* @example
|
16
|
+
* <ContentTemplate className="custom-class" />
|
17
|
+
*/
|
18
|
+
function ContentTemplate({ isDecorative, ...props }) {
|
19
|
+
return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", ...props },
|
20
|
+
react_1.default.createElement("path", { fill: "#E0D9EF", stroke: "#BCACDD", d: "M20 1.5A1.5 1.5 0 0 1 21.5 3v18a1.5 1.5 0 0 1-1.5 1.5H4A1.5 1.5 0 0 1 2.5 21V3A1.5 1.5 0 0 1 4 1.5h16Z" }),
|
21
|
+
react_1.default.createElement("rect", { width: "7", height: "3", x: "6", y: "5", fill: "#6B47B4", rx: "1" }),
|
22
|
+
react_1.default.createElement("rect", { width: "4", height: "4", x: "6", y: "10", fill: "#6B47B4", rx: "1" }),
|
23
|
+
react_1.default.createElement("rect", { width: "7", height: "4", x: "11", y: "10", fill: "#6B47B4", rx: "1" }),
|
24
|
+
react_1.default.createElement("rect", { width: "12", height: "3", x: "6", y: "16", fill: "#6B47B4", rx: "1" }),
|
25
|
+
react_1.default.createElement("rect", { width: "4", height: "3", x: "14", y: "5", fill: "#6B47B4", rx: "1" }),
|
26
|
+
!isDecorative && react_1.default.createElement("title", null, "content template icon")));
|
27
|
+
}
|
28
|
+
exports.default = ContentTemplate;
|
@@ -1,6 +1,7 @@
|
|
1
|
-
import { Audio, Excel, Folder, GenericFile, Image, Page, PageContent, Pdf, Powerpoint, Site, Video, Word } from '.';
|
1
|
+
import { Audio, ContentTemplate, Excel, Folder, GenericFile, Image, Page, PageContent, Pdf, Powerpoint, Site, Video, Word } from '.';
|
2
2
|
declare const MatrixResourceMap: {
|
3
3
|
audio_file: typeof Audio;
|
4
|
+
content_template: typeof ContentTemplate;
|
4
5
|
excel_doc: typeof Excel;
|
5
6
|
folder: typeof Folder;
|
6
7
|
generic_file: typeof GenericFile;
|
@@ -16,16 +16,14 @@ const react_1 = __importDefault(require("react"));
|
|
16
16
|
* <PageContent className="custom-class" />
|
17
17
|
*/
|
18
18
|
function PageContent({ isDecorative, ...props }) {
|
19
|
-
return (react_1.default.createElement("svg", {
|
20
|
-
react_1.default.createElement("path", { d: "M20 1.
|
21
|
-
react_1.default.createElement("rect", {
|
22
|
-
react_1.default.createElement("rect", {
|
23
|
-
react_1.default.createElement("rect", {
|
24
|
-
react_1.default.createElement("rect", {
|
25
|
-
react_1.default.createElement("rect", {
|
26
|
-
react_1.default.createElement("rect", {
|
27
|
-
react_1.default.createElement("rect", { x: "5", y: "11", width: "3", height: "1", rx: "0.5", fill: "#057E91" }),
|
28
|
-
react_1.default.createElement("rect", { x: "5", y: "13", width: "3", height: "1", rx: "0.5", fill: "#057E91" }),
|
19
|
+
return (react_1.default.createElement("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "none", viewBox: "0 0 24 24", ...props },
|
20
|
+
react_1.default.createElement("path", { fill: "#CCE9ED", stroke: "#73C0CB", d: "M20 1.5A1.5 1.5 0 0 1 21.5 3v18a1.5 1.5 0 0 1-1.5 1.5H4A1.5 1.5 0 0 1 2.5 21V3A1.5 1.5 0 0 1 4 1.5h16Z" }),
|
21
|
+
react_1.default.createElement("rect", { width: "9", height: "4", x: "5", y: "5", fill: "#057E91", rx: "1" }),
|
22
|
+
react_1.default.createElement("rect", { width: "9", height: "3", x: "5", y: "10", fill: "#057E91", rx: "1" }),
|
23
|
+
react_1.default.createElement("rect", { width: "9", height: "3", x: "5", y: "14", fill: "#057E91", rx: "1" }),
|
24
|
+
react_1.default.createElement("rect", { width: "3", height: "2", x: "16", y: "5", fill: "#057E91", rx: "1" }),
|
25
|
+
react_1.default.createElement("rect", { width: "3", height: "2", x: "16", y: "8", fill: "#057E91", rx: "1" }),
|
26
|
+
react_1.default.createElement("rect", { width: "3", height: "2", x: "16", y: "11", fill: "#057E91", rx: "1" }),
|
29
27
|
!isDecorative && react_1.default.createElement("title", null, "page content icon")));
|
30
28
|
}
|
31
29
|
exports.default = PageContent;
|
@@ -3,10 +3,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
4
4
|
};
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
6
|
-
exports.Word = exports.Video = exports.Site = exports.Powerpoint = exports.Pdf = exports.PageContent = exports.Page = exports.Image = exports.GenericFile = exports.Folder = exports.Excel = exports.Audio = void 0;
|
6
|
+
exports.Word = exports.Video = exports.Site = exports.Powerpoint = exports.Pdf = exports.PageContent = exports.Page = exports.Image = exports.GenericFile = exports.Folder = exports.Excel = exports.ContentTemplate = exports.Audio = void 0;
|
7
7
|
// Export all the icons from the MatrixResources folder
|
8
8
|
var Audio_1 = require("./Audio");
|
9
9
|
Object.defineProperty(exports, "Audio", { enumerable: true, get: function () { return __importDefault(Audio_1).default; } });
|
10
|
+
var ContentTemplate_1 = require("./ContentTemplate");
|
11
|
+
Object.defineProperty(exports, "ContentTemplate", { enumerable: true, get: function () { return __importDefault(ContentTemplate_1).default; } });
|
10
12
|
var Excel_1 = require("./Excel");
|
11
13
|
Object.defineProperty(exports, "Excel", { enumerable: true, get: function () { return __importDefault(Excel_1).default; } });
|
12
14
|
var Folder_1 = require("./Folder");
|
@@ -10,5 +10,8 @@ export interface PreviewPanelProps {
|
|
10
10
|
onClose: () => void;
|
11
11
|
ResourceComponent?: React.ElementType;
|
12
12
|
selectionCallback?: (param: any) => void;
|
13
|
+
resourceComponentProps?: {
|
14
|
+
[x: string]: any;
|
15
|
+
};
|
13
16
|
}
|
14
|
-
export declare const PreviewPanel: ({ resource, previewModalOverlayProps, modalState, onSelect, onClose, ResourceComponent, selectionCallback, }: PreviewPanelProps) => React.JSX.Element;
|
17
|
+
export declare const PreviewPanel: ({ resource, previewModalOverlayProps, modalState, onSelect, onClose, ResourceComponent, selectionCallback, resourceComponentProps, }: PreviewPanelProps) => React.JSX.Element;
|
@@ -31,7 +31,7 @@ const react_1 = __importStar(require("react"));
|
|
31
31
|
const react_responsive_1 = require("react-responsive");
|
32
32
|
const Icon_1 = require("../Icons/Icon");
|
33
33
|
const PreviewModal_1 = __importDefault(require("./PreviewModal"));
|
34
|
-
const PreviewPanel = function ({ resource, previewModalOverlayProps, modalState, onSelect, onClose, ResourceComponent, selectionCallback, }) {
|
34
|
+
const PreviewPanel = function ({ resource, previewModalOverlayProps, modalState, onSelect, onClose, ResourceComponent, selectionCallback, resourceComponentProps = {}, }) {
|
35
35
|
// Watch the media size to see if we are on mobile size
|
36
36
|
const isMobile = (0, react_responsive_1.useMediaQuery)({ query: '(max-width: 640px)' });
|
37
37
|
// If we are on mobile and the selected resource changes show the preview panel modal.
|
@@ -41,9 +41,9 @@ const PreviewPanel = function ({ resource, previewModalOverlayProps, modalState,
|
|
41
41
|
}
|
42
42
|
}, [resource, isMobile]);
|
43
43
|
const previewPanel = resource && (react_1.default.createElement(react_1.default.Fragment, null,
|
44
|
-
react_1.default.createElement("div", { className: "flex flex-col grow" }, ResourceComponent && react_1.default.createElement(ResourceComponent, { resource: resource, selectionCallback: selectionCallback })),
|
44
|
+
react_1.default.createElement("div", { className: "flex flex-col grow" }, ResourceComponent && (react_1.default.createElement(ResourceComponent, { ...resourceComponentProps, resource: resource, selectionCallback: selectionCallback }))),
|
45
45
|
react_1.default.createElement("div", { className: "flex justify-end border-t border-gray-300" },
|
46
|
-
react_1.default.createElement("button", { type: "button", onClick: () => onSelect(resource), className: "rounded text-sm text-white bg-blue-300 py-2 px-2.5 m-5 font-bold" }, "Select"))));
|
46
|
+
react_1.default.createElement("button", { type: "button", onClick: () => onSelect(resource), "data-testid": `preview-panel-select-button`, className: "rounded text-sm text-white bg-blue-300 py-2 px-2.5 m-5 font-bold" }, "Select"))));
|
47
47
|
return (react_1.default.createElement("div", { className: "squiz-gb-scope h-full" },
|
48
48
|
!isMobile && react_1.default.createElement("h3", { className: "sr-only" }, "Resource Details"),
|
49
49
|
resource === null && (react_1.default.createElement("div", { className: "max-sm:hidden flex flex-col h-full" },
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@squiz/generic-browser-lib",
|
3
|
-
"version": "1.67.
|
3
|
+
"version": "1.67.5",
|
4
4
|
"description": "Package with reusable components used by resource/component browsers",
|
5
5
|
"main": "lib/index.js",
|
6
6
|
"types": "lib/index.d.ts",
|
@@ -37,23 +37,23 @@
|
|
37
37
|
"@storybook/testing-library": "0.0.14-next.1",
|
38
38
|
"@testing-library/jest-dom": "5.16.5",
|
39
39
|
"@testing-library/react": "14.0.0",
|
40
|
-
"@testing-library/user-event": "14.
|
40
|
+
"@testing-library/user-event": "14.6.1",
|
41
41
|
"@types/react": "^18.2.45",
|
42
42
|
"@types/react-dom": "^18.2.18",
|
43
|
-
"autoprefixer": "10.4.
|
44
|
-
"esbuild": "0.
|
43
|
+
"autoprefixer": "10.4.21",
|
44
|
+
"esbuild": "0.25.0",
|
45
45
|
"esbuild-sass-plugin": "2.8.0",
|
46
46
|
"jest": "29.4.1",
|
47
47
|
"jest-environment-jsdom": "29.4.1",
|
48
48
|
"postcss": "8.4.31",
|
49
49
|
"postcss-nested": "6.0.1",
|
50
|
-
"postcss-prefix-selector": "1.16.
|
50
|
+
"postcss-prefix-selector": "1.16.1",
|
51
51
|
"react": "18.2.0",
|
52
52
|
"react-dom": "18.2.0",
|
53
53
|
"storybook": "^7.6.19",
|
54
54
|
"tailwindcss": "3.3.1",
|
55
55
|
"ts-jest": "29.0.5",
|
56
|
-
"typescript": "4.9.
|
56
|
+
"typescript": "4.9.5",
|
57
57
|
"vite": "^4.5.3"
|
58
58
|
},
|
59
59
|
"peerDependencies": {
|
@@ -36,6 +36,12 @@ Audio.args = {
|
|
36
36
|
resourceSource: 'matrix',
|
37
37
|
};
|
38
38
|
|
39
|
+
export const ContentTemplate = Template.bind({});
|
40
|
+
ContentTemplate.args = {
|
41
|
+
icon: 'content_template',
|
42
|
+
resourceSource: 'matrix',
|
43
|
+
};
|
44
|
+
|
39
45
|
export const Excel = Template.bind({});
|
40
46
|
Excel.args = {
|
41
47
|
icon: 'excel_doc',
|
@@ -0,0 +1,33 @@
|
|
1
|
+
import React from 'react';
|
2
|
+
|
3
|
+
/**
|
4
|
+
* Renders the ContentTemplate icon
|
5
|
+
* @param {React.SVGProps<SVGSVGElement>} props - The props for the ContentTemplate component
|
6
|
+
* @returns {JSX.Element} - The ContentTemplate component
|
7
|
+
* @example
|
8
|
+
* <ContentTemplate />
|
9
|
+
* @example
|
10
|
+
* <ContentTemplate height={24} width={24} />
|
11
|
+
* @example
|
12
|
+
* <ContentTemplate className="custom-class" />
|
13
|
+
*/
|
14
|
+
export default function ContentTemplate({
|
15
|
+
isDecorative,
|
16
|
+
...props
|
17
|
+
}: { isDecorative: boolean } & React.SVGProps<SVGSVGElement>) {
|
18
|
+
return (
|
19
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" {...props}>
|
20
|
+
<path
|
21
|
+
fill="#E0D9EF"
|
22
|
+
stroke="#BCACDD"
|
23
|
+
d="M20 1.5A1.5 1.5 0 0 1 21.5 3v18a1.5 1.5 0 0 1-1.5 1.5H4A1.5 1.5 0 0 1 2.5 21V3A1.5 1.5 0 0 1 4 1.5h16Z"
|
24
|
+
/>
|
25
|
+
<rect width="7" height="3" x="6" y="5" fill="#6B47B4" rx="1" />
|
26
|
+
<rect width="4" height="4" x="6" y="10" fill="#6B47B4" rx="1" />
|
27
|
+
<rect width="7" height="4" x="11" y="10" fill="#6B47B4" rx="1" />
|
28
|
+
<rect width="12" height="3" x="6" y="16" fill="#6B47B4" rx="1" />
|
29
|
+
<rect width="4" height="3" x="14" y="5" fill="#6B47B4" rx="1" />
|
30
|
+
{!isDecorative && <title>content template icon</title>}
|
31
|
+
</svg>
|
32
|
+
);
|
33
|
+
}
|
@@ -1,8 +1,23 @@
|
|
1
|
-
import {
|
1
|
+
import {
|
2
|
+
Audio,
|
3
|
+
ContentTemplate,
|
4
|
+
Excel,
|
5
|
+
Folder,
|
6
|
+
GenericFile,
|
7
|
+
Image,
|
8
|
+
Page,
|
9
|
+
PageContent,
|
10
|
+
Pdf,
|
11
|
+
Powerpoint,
|
12
|
+
Site,
|
13
|
+
Video,
|
14
|
+
Word,
|
15
|
+
} from '.';
|
2
16
|
|
3
17
|
// Define our map of matrix types to icons
|
4
18
|
const MatrixResourceMap = {
|
5
19
|
audio_file: Audio,
|
20
|
+
content_template: ContentTemplate,
|
6
21
|
excel_doc: Excel,
|
7
22
|
folder: Folder,
|
8
23
|
generic_file: GenericFile, // fallback when a type doesn't match.
|
@@ -16,20 +16,19 @@ export default function PageContent({
|
|
16
16
|
...props
|
17
17
|
}: { isDecorative: boolean } & React.SVGProps<SVGSVGElement>) {
|
18
18
|
return (
|
19
|
-
<svg width="24" height="24" viewBox="0 0 24 24"
|
19
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" fill="none" viewBox="0 0 24 24" {...props}>
|
20
20
|
<path
|
21
|
-
d="M20 1.5H4C3.17157 1.5 2.5 2.17157 2.5 3V21C2.5 21.8284 3.17157 22.5 4 22.5H20C20.8284 22.5 21.5 21.8284 21.5 21V3C21.5 2.17157 20.8284 1.5 20 1.5Z"
|
22
21
|
fill="#CCE9ED"
|
23
22
|
stroke="#73C0CB"
|
23
|
+
d="M20 1.5A1.5 1.5 0 0 1 21.5 3v18a1.5 1.5 0 0 1-1.5 1.5H4A1.5 1.5 0 0 1 2.5 21V3A1.5 1.5 0 0 1 4 1.5h16Z"
|
24
24
|
/>
|
25
|
-
<rect
|
26
|
-
<rect
|
27
|
-
<rect
|
28
|
-
<rect
|
29
|
-
<rect
|
30
|
-
<rect
|
31
|
-
|
32
|
-
<rect x="5" y="13" width="3" height="1" rx="0.5" fill="#057E91" />
|
25
|
+
<rect width="9" height="4" x="5" y="5" fill="#057E91" rx="1" />
|
26
|
+
<rect width="9" height="3" x="5" y="10" fill="#057E91" rx="1" />
|
27
|
+
<rect width="9" height="3" x="5" y="14" fill="#057E91" rx="1" />
|
28
|
+
<rect width="3" height="2" x="16" y="5" fill="#057E91" rx="1" />
|
29
|
+
<rect width="3" height="2" x="16" y="8" fill="#057E91" rx="1" />
|
30
|
+
<rect width="3" height="2" x="16" y="11" fill="#057E91" rx="1" />
|
31
|
+
|
33
32
|
{!isDecorative && <title>page content icon</title>}
|
34
33
|
</svg>
|
35
34
|
);
|
@@ -1,5 +1,6 @@
|
|
1
1
|
// Export all the icons from the MatrixResources folder
|
2
2
|
export { default as Audio } from './Audio';
|
3
|
+
export { default as ContentTemplate } from './ContentTemplate';
|
3
4
|
export { default as Excel } from './Excel';
|
4
5
|
export { default as Folder } from './Folder';
|
5
6
|
export { default as GenericFile } from './GenericFile';
|
@@ -15,6 +15,9 @@ export interface PreviewPanelProps {
|
|
15
15
|
onClose: () => void;
|
16
16
|
ResourceComponent?: React.ElementType;
|
17
17
|
selectionCallback?: (param: any) => void;
|
18
|
+
resourceComponentProps?: {
|
19
|
+
[x: string]: any;
|
20
|
+
};
|
18
21
|
}
|
19
22
|
|
20
23
|
export const PreviewPanel = function ({
|
@@ -25,6 +28,7 @@ export const PreviewPanel = function ({
|
|
25
28
|
onClose,
|
26
29
|
ResourceComponent,
|
27
30
|
selectionCallback,
|
31
|
+
resourceComponentProps = {},
|
28
32
|
}: PreviewPanelProps) {
|
29
33
|
// Watch the media size to see if we are on mobile size
|
30
34
|
const isMobile = useMediaQuery({ query: '(max-width: 640px)' });
|
@@ -39,12 +43,15 @@ export const PreviewPanel = function ({
|
|
39
43
|
const previewPanel = resource && (
|
40
44
|
<>
|
41
45
|
<div className="flex flex-col grow">
|
42
|
-
{ResourceComponent &&
|
46
|
+
{ResourceComponent && (
|
47
|
+
<ResourceComponent {...resourceComponentProps} resource={resource} selectionCallback={selectionCallback} />
|
48
|
+
)}
|
43
49
|
</div>
|
44
50
|
<div className="flex justify-end border-t border-gray-300">
|
45
51
|
<button
|
46
52
|
type="button"
|
47
53
|
onClick={() => onSelect(resource)}
|
54
|
+
data-testid={`preview-panel-select-button`}
|
48
55
|
className="rounded text-sm text-white bg-blue-300 py-2 px-2.5 m-5 font-bold"
|
49
56
|
>
|
50
57
|
Select
|