Adding icons for Single Types and Collection type (#9416)

This commit is contained in:
Marvin Frachet 2021-02-16 12:00:24 +01:00 committed by GitHub
parent 6dd67d5c76
commit db3784ce32
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 631 additions and 11 deletions

View File

@ -0,0 +1,21 @@
import React from 'react';
import PropTypes from 'prop-types';
import CTSelected from './icons/CTSelected';
import CTUnselected from './icons/CTUnselected';
const CT = ({ selected }) =>
selected ? (
<CTSelected aria-hidden data-testid="ct-selected" />
) : (
<CTUnselected aria-hidden data-testid="ct-unselected" />
);
CT.defaultProps = {
selected: false,
};
CT.propTypes = {
selected: PropTypes.bool,
};
export default CT;

View File

@ -0,0 +1,21 @@
import React from 'react';
import PropTypes from 'prop-types';
import STSelected from './icons/STSelected';
import STUnselected from './icons/STUnselected';
const ST = ({ selected }) =>
selected ? (
<STSelected aria-hidden data-testid="st-selected" />
) : (
<STUnselected aria-hidden data-testid="st-unselected" />
);
ST.defaultProps = {
selected: false,
};
ST.propTypes = {
selected: PropTypes.bool,
};
export default ST;

View File

@ -0,0 +1,136 @@
/* eslint-disable */
import React from 'react';
const CTSelected = props => (
<svg width="79px" height="86px" viewBox="0 0 79 86" {...props}>
<defs>
<filter
x="-1.7%"
y="-2.3%"
width="103.5%"
height="104.7%"
filterUnits="objectBoundingBox"
id="filter-1"
>
<feOffset dx="0" dy="2" in="SourceAlpha" result="shadowOffsetOuter1" />
<feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1" />
<feColorMatrix
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"
type="matrix"
in="shadowBlurOuter1"
result="shadowMatrixOuter1"
/>
<feMerge>
<feMergeNode in="shadowMatrixOuter1" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
</defs>
<g id="Prototype---Single-types" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
<g
id="Plugins-/-Types-Builder-/-Single-page-settings"
transform="translate(-396.000000, -443.000000)"
>
<g
id="Modal---Edit-Single-Type"
filter="url(#filter-1)"
transform="translate(323.000000, 145.000000)"
>
<g id="Repeatable-content-type" transform="translate(31.000000, 269.000000)">
<g id="Icon" transform="translate(51.000000, 38.000000)">
<g id="file-text-o" transform="translate(17.142857, 0.000000)">
<rect
id="Rectangle"
fill="#E4F0FC"
x="1.71428571"
y="3.42857143"
width="30.8571429"
height="44.5714286"
/>
<rect
id="Rectangle"
fill="#E4F0FC"
x="32.5714286"
y="16.2857143"
width="8.57142857"
height="31.7142857"
/>
<polygon
id="Path-2"
fill="#E4F0FC"
points="29.5714286 3.42857143 41.1428571 15.4285714 29.5714286 16.2857143 27.2444196 15.4285714 27.2444196 3.42857143"
/>
<path
d="M40.9598214,10.6026786 C41.4806548,11.1235119 41.9270833,11.8303571 42.2991071,12.7232143 C42.671131,13.6160714 42.8571429,14.4345238 42.8571429,15.1785714 L42.8571429,47.3214286 C42.8571429,48.0654762 42.5967262,48.6979167 42.0758929,49.21875 C41.5550595,49.7395833 40.922619,50 40.1785714,50 L2.67857143,50 C1.93452381,50 1.30208333,49.7395833 0.78125,49.21875 C0.260416667,48.6979167 0,48.0654762 0,47.3214286 L0,2.67857143 C0,1.93452381 0.260416667,1.30208333 0.78125,0.78125 C1.30208333,0.260416667 1.93452381,0 2.67857143,0 L27.6785714,0 C28.422619,0 29.2410714,0.186011905 30.1339286,0.558035714 C31.0267857,0.930059524 31.733631,1.3764881 32.2544643,1.89732143 L40.9598214,10.6026786 Z M28.5714286,3.79464286 L28.5714286,14.2857143 L39.0625,14.2857143 C38.8764881,13.7462798 38.671875,13.3649554 38.4486607,13.1417411 L29.7154018,4.40848214 C29.4921875,4.18526786 29.1108631,3.98065476 28.5714286,3.79464286 Z M39.2857143,46.4285714 L39.2857143,17.8571429 L27.6785714,17.8571429 C26.9345238,17.8571429 26.3020833,17.5967262 25.78125,17.0758929 C25.2604167,16.5550595 25,15.922619 25,15.1785714 L25,3.57142857 L3.57142857,3.57142857 L3.57142857,46.4285714 L39.2857143,46.4285714 Z M10.7142857,22.3214286 C10.7142857,22.0610119 10.7979911,21.8470982 10.9654018,21.6796875 C11.1328125,21.5122768 11.3467262,21.4285714 11.6071429,21.4285714 L31.25,21.4285714 C31.5104167,21.4285714 31.7243304,21.5122768 31.8917411,21.6796875 C32.0591518,21.8470982 32.1428571,22.0610119 32.1428571,22.3214286 L32.1428571,24.1071429 C32.1428571,24.3675595 32.0591518,24.5814732 31.8917411,24.7488839 C31.7243304,24.9162946 31.5104167,25 31.25,25 L11.6071429,25 C11.3467262,25 11.1328125,24.9162946 10.9654018,24.7488839 C10.7979911,24.5814732 10.7142857,24.3675595 10.7142857,24.1071429 L10.7142857,22.3214286 Z M31.25,28.5714286 C31.5104167,28.5714286 31.7243304,28.6551339 31.8917411,28.8225446 C32.0591518,28.9899554 32.1428571,29.203869 32.1428571,29.4642857 L32.1428571,31.25 C32.1428571,31.5104167 32.0591518,31.7243304 31.8917411,31.8917411 C31.7243304,32.0591518 31.5104167,32.1428571 31.25,32.1428571 L11.6071429,32.1428571 C11.3467262,32.1428571 11.1328125,32.0591518 10.9654018,31.8917411 C10.7979911,31.7243304 10.7142857,31.5104167 10.7142857,31.25 L10.7142857,29.4642857 C10.7142857,29.203869 10.7979911,28.9899554 10.9654018,28.8225446 C11.1328125,28.6551339 11.3467262,28.5714286 11.6071429,28.5714286 L31.25,28.5714286 Z M31.25,35.7142857 C31.5104167,35.7142857 31.7243304,35.7979911 31.8917411,35.9654018 C32.0591518,36.1328125 32.1428571,36.3467262 32.1428571,36.6071429 L32.1428571,38.3928571 C32.1428571,38.6532738 32.0591518,38.8671875 31.8917411,39.0345982 C31.7243304,39.2020089 31.5104167,39.2857143 31.25,39.2857143 L11.6071429,39.2857143 C11.3467262,39.2857143 11.1328125,39.2020089 10.9654018,39.0345982 C10.7979911,38.8671875 10.7142857,38.6532738 10.7142857,38.3928571 L10.7142857,36.6071429 C10.7142857,36.3467262 10.7979911,36.1328125 10.9654018,35.9654018 C11.1328125,35.7979911 11.3467262,35.7142857 11.6071429,35.7142857 L31.25,35.7142857 Z"
id="Shape"
fill="#A5D5FF"
fillRule="nonzero"
/>
</g>
<g id="file-text-o" transform="translate(8.571429, 8.571429)">
<rect
id="Rectangle"
fill="#E4F0FC"
x="1.71428571"
y="3.42857143"
width="30.8571429"
height="44.5714286"
/>
<rect
id="Rectangle"
fill="#E4F0FC"
x="32.5714286"
y="16.2857143"
width="8.57142857"
height="31.7142857"
/>
<polygon
id="Path-2"
fill="#E4F0FC"
points="29.5714286 3.42857143 41.1428571 15.4285714 29.5714286 16.2857143 27.2444196 15.4285714 27.2444196 3.42857143"
/>
<path
d="M40.9598214,10.6026786 C41.4806548,11.1235119 41.9270833,11.8303571 42.2991071,12.7232143 C42.671131,13.6160714 42.8571429,14.4345238 42.8571429,15.1785714 L42.8571429,47.3214286 C42.8571429,48.0654762 42.5967262,48.6979167 42.0758929,49.21875 C41.5550595,49.7395833 40.922619,50 40.1785714,50 L2.67857143,50 C1.93452381,50 1.30208333,49.7395833 0.78125,49.21875 C0.260416667,48.6979167 0,48.0654762 0,47.3214286 L0,2.67857143 C0,1.93452381 0.260416667,1.30208333 0.78125,0.78125 C1.30208333,0.260416667 1.93452381,0 2.67857143,0 L27.6785714,0 C28.422619,0 29.2410714,0.186011905 30.1339286,0.558035714 C31.0267857,0.930059524 31.733631,1.3764881 32.2544643,1.89732143 L40.9598214,10.6026786 Z M28.5714286,3.79464286 L28.5714286,14.2857143 L39.0625,14.2857143 C38.8764881,13.7462798 38.671875,13.3649554 38.4486607,13.1417411 L29.7154018,4.40848214 C29.4921875,4.18526786 29.1108631,3.98065476 28.5714286,3.79464286 Z M39.2857143,46.4285714 L39.2857143,17.8571429 L27.6785714,17.8571429 C26.9345238,17.8571429 26.3020833,17.5967262 25.78125,17.0758929 C25.2604167,16.5550595 25,15.922619 25,15.1785714 L25,3.57142857 L3.57142857,3.57142857 L3.57142857,46.4285714 L39.2857143,46.4285714 Z M10.7142857,22.3214286 C10.7142857,22.0610119 10.7979911,21.8470982 10.9654018,21.6796875 C11.1328125,21.5122768 11.3467262,21.4285714 11.6071429,21.4285714 L31.25,21.4285714 C31.5104167,21.4285714 31.7243304,21.5122768 31.8917411,21.6796875 C32.0591518,21.8470982 32.1428571,22.0610119 32.1428571,22.3214286 L32.1428571,24.1071429 C32.1428571,24.3675595 32.0591518,24.5814732 31.8917411,24.7488839 C31.7243304,24.9162946 31.5104167,25 31.25,25 L11.6071429,25 C11.3467262,25 11.1328125,24.9162946 10.9654018,24.7488839 C10.7979911,24.5814732 10.7142857,24.3675595 10.7142857,24.1071429 L10.7142857,22.3214286 Z M31.25,28.5714286 C31.5104167,28.5714286 31.7243304,28.6551339 31.8917411,28.8225446 C32.0591518,28.9899554 32.1428571,29.203869 32.1428571,29.4642857 L32.1428571,31.25 C32.1428571,31.5104167 32.0591518,31.7243304 31.8917411,31.8917411 C31.7243304,32.0591518 31.5104167,32.1428571 31.25,32.1428571 L11.6071429,32.1428571 C11.3467262,32.1428571 11.1328125,32.0591518 10.9654018,31.8917411 C10.7979911,31.7243304 10.7142857,31.5104167 10.7142857,31.25 L10.7142857,29.4642857 C10.7142857,29.203869 10.7979911,28.9899554 10.9654018,28.8225446 C11.1328125,28.6551339 11.3467262,28.5714286 11.6071429,28.5714286 L31.25,28.5714286 Z M31.25,35.7142857 C31.5104167,35.7142857 31.7243304,35.7979911 31.8917411,35.9654018 C32.0591518,36.1328125 32.1428571,36.3467262 32.1428571,36.6071429 L32.1428571,38.3928571 C32.1428571,38.6532738 32.0591518,38.8671875 31.8917411,39.0345982 C31.7243304,39.2020089 31.5104167,39.2857143 31.25,39.2857143 L11.6071429,39.2857143 C11.3467262,39.2857143 11.1328125,39.2020089 10.9654018,39.0345982 C10.7979911,38.8671875 10.7142857,38.6532738 10.7142857,38.3928571 L10.7142857,36.6071429 C10.7142857,36.3467262 10.7979911,36.1328125 10.9654018,35.9654018 C11.1328125,35.7979911 11.3467262,35.7142857 11.6071429,35.7142857 L31.25,35.7142857 Z"
id="Shape"
fill="#A5D5FF"
fillRule="nonzero"
/>
</g>
<g id="file-text-o" transform="translate(0.000000, 17.142857)">
<rect
id="Rectangle"
fill="#E4F0FC"
x="1.71428571"
y="3.42857143"
width="30.8571429"
height="44.5714286"
/>
<rect
id="Rectangle"
fill="#E4F0FC"
x="31.5714286"
y="16.2857143"
width="8.57142857"
height="31.7142857"
/>
<polygon
id="Path-2"
fill="#E4F0FC"
points="29.5714286 3.42857143 41.1428571 15.4285714 29.5714286 16.2857143 27.2444196 15.4285714 27.2444196 3.42857143"
/>
<path
d="M40.9598214,10.6026786 C41.4806548,11.1235119 41.9270833,11.8303571 42.2991071,12.7232143 C42.671131,13.6160714 42.8571429,14.4345238 42.8571429,15.1785714 L42.8571429,47.3214286 C42.8571429,48.0654762 42.5967262,48.6979167 42.0758929,49.21875 C41.5550595,49.7395833 40.922619,50 40.1785714,50 L2.67857143,50 C1.93452381,50 1.30208333,49.7395833 0.78125,49.21875 C0.260416667,48.6979167 0,48.0654762 0,47.3214286 L0,2.67857143 C0,1.93452381 0.260416667,1.30208333 0.78125,0.78125 C1.30208333,0.260416667 1.93452381,0 2.67857143,0 L27.6785714,0 C28.422619,0 29.2410714,0.186011905 30.1339286,0.558035714 C31.0267857,0.930059524 31.733631,1.3764881 32.2544643,1.89732143 L40.9598214,10.6026786 Z M28.5714286,3.79464286 L28.5714286,14.2857143 L39.0625,14.2857143 C38.8764881,13.7462798 38.671875,13.3649554 38.4486607,13.1417411 L29.7154018,4.40848214 C29.4921875,4.18526786 29.1108631,3.98065476 28.5714286,3.79464286 Z M39.2857143,46.4285714 L39.2857143,17.8571429 L27.6785714,17.8571429 C26.9345238,17.8571429 26.3020833,17.5967262 25.78125,17.0758929 C25.2604167,16.5550595 25,15.922619 25,15.1785714 L25,3.57142857 L3.57142857,3.57142857 L3.57142857,46.4285714 L39.2857143,46.4285714 Z M10.7142857,22.3214286 C10.7142857,22.0610119 10.7979911,21.8470982 10.9654018,21.6796875 C11.1328125,21.5122768 11.3467262,21.4285714 11.6071429,21.4285714 L31.25,21.4285714 C31.5104167,21.4285714 31.7243304,21.5122768 31.8917411,21.6796875 C32.0591518,21.8470982 32.1428571,22.0610119 32.1428571,22.3214286 L32.1428571,24.1071429 C32.1428571,24.3675595 32.0591518,24.5814732 31.8917411,24.7488839 C31.7243304,24.9162946 31.5104167,25 31.25,25 L11.6071429,25 C11.3467262,25 11.1328125,24.9162946 10.9654018,24.7488839 C10.7979911,24.5814732 10.7142857,24.3675595 10.7142857,24.1071429 L10.7142857,22.3214286 Z M31.25,28.5714286 C31.5104167,28.5714286 31.7243304,28.6551339 31.8917411,28.8225446 C32.0591518,28.9899554 32.1428571,29.203869 32.1428571,29.4642857 L32.1428571,31.25 C32.1428571,31.5104167 32.0591518,31.7243304 31.8917411,31.8917411 C31.7243304,32.0591518 31.5104167,32.1428571 31.25,32.1428571 L11.6071429,32.1428571 C11.3467262,32.1428571 11.1328125,32.0591518 10.9654018,31.8917411 C10.7979911,31.7243304 10.7142857,31.5104167 10.7142857,31.25 L10.7142857,29.4642857 C10.7142857,29.203869 10.7979911,28.9899554 10.9654018,28.8225446 C11.1328125,28.6551339 11.3467262,28.5714286 11.6071429,28.5714286 L31.25,28.5714286 Z M31.25,35.7142857 C31.5104167,35.7142857 31.7243304,35.7979911 31.8917411,35.9654018 C32.0591518,36.1328125 32.1428571,36.3467262 32.1428571,36.6071429 L32.1428571,38.3928571 C32.1428571,38.6532738 32.0591518,38.8671875 31.8917411,39.0345982 C31.7243304,39.2020089 31.5104167,39.2857143 31.25,39.2857143 L11.6071429,39.2857143 C11.3467262,39.2857143 11.1328125,39.2020089 10.9654018,39.0345982 C10.7979911,38.8671875 10.7142857,38.6532738 10.7142857,38.3928571 L10.7142857,36.6071429 C10.7142857,36.3467262 10.7979911,36.1328125 10.9654018,35.9654018 C11.1328125,35.7979911 11.3467262,35.7142857 11.6071429,35.7142857 L31.25,35.7142857 Z"
id="Shape"
fill="#A5D5FF"
fillRule="nonzero"
/>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>
);
export default CTSelected;

View File

@ -0,0 +1,136 @@
/* eslint-disable */
import React from 'react';
const CTUnSelected = props => (
<svg width="79px" height="86px" viewBox="0 0 79 86" {...props}>
<defs>
<filter
x="-1.7%"
y="-2.3%"
width="103.5%"
height="104.7%"
filterUnits="objectBoundingBox"
id="filter-1"
>
<feOffset dx="0" dy="2" in="SourceAlpha" result="shadowOffsetOuter1" />
<feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1" />
<feColorMatrix
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"
type="matrix"
in="shadowBlurOuter1"
result="shadowMatrixOuter1"
/>
<feMerge>
<feMergeNode in="shadowMatrixOuter1" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
</defs>
<g id="Prototype---Single-types" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
<g
id="Plugins-/-Types-Builder-/-Single-page-settings"
transform="translate(-396.000000, -443.000000)"
>
<g
id="Modal---Edit-Single-Type"
filter="url(#filter-1)"
transform="translate(323.000000, 145.000000)"
>
<g id="Repeatable-content-type" transform="translate(31.000000, 269.000000)">
<g id="Icon" transform="translate(51.000000, 38.000000)">
<g id="file-text-o" transform="translate(17.142857, 0.000000)">
<rect
id="Rectangle"
fill="#FAFAFB"
x="1.71428571"
y="3.42857143"
width="30.8571429"
height="44.5714286"
/>
<rect
id="Rectangle"
fill="#FAFAFB"
x="32.5714286"
y="16.2857143"
width="8.57142857"
height="31.7142857"
/>
<polygon
id="Path-2"
fill="#FAFAFB"
points="29.5714286 3.42857143 41.1428571 15.4285714 29.5714286 16.2857143 27.2444196 15.4285714 27.2444196 3.42857143"
/>
<path
d="M40.9598214,10.6026786 C41.4806548,11.1235119 41.9270833,11.8303571 42.2991071,12.7232143 C42.671131,13.6160714 42.8571429,14.4345238 42.8571429,15.1785714 L42.8571429,47.3214286 C42.8571429,48.0654762 42.5967262,48.6979167 42.0758929,49.21875 C41.5550595,49.7395833 40.922619,50 40.1785714,50 L2.67857143,50 C1.93452381,50 1.30208333,49.7395833 0.78125,49.21875 C0.260416667,48.6979167 0,48.0654762 0,47.3214286 L0,2.67857143 C0,1.93452381 0.260416667,1.30208333 0.78125,0.78125 C1.30208333,0.260416667 1.93452381,0 2.67857143,0 L27.6785714,0 C28.422619,0 29.2410714,0.186011905 30.1339286,0.558035714 C31.0267857,0.930059524 31.733631,1.3764881 32.2544643,1.89732143 L40.9598214,10.6026786 Z M28.5714286,3.79464286 L28.5714286,14.2857143 L39.0625,14.2857143 C38.8764881,13.7462798 38.671875,13.3649554 38.4486607,13.1417411 L29.7154018,4.40848214 C29.4921875,4.18526786 29.1108631,3.98065476 28.5714286,3.79464286 Z M39.2857143,46.4285714 L39.2857143,17.8571429 L27.6785714,17.8571429 C26.9345238,17.8571429 26.3020833,17.5967262 25.78125,17.0758929 C25.2604167,16.5550595 25,15.922619 25,15.1785714 L25,3.57142857 L3.57142857,3.57142857 L3.57142857,46.4285714 L39.2857143,46.4285714 Z M10.7142857,22.3214286 C10.7142857,22.0610119 10.7979911,21.8470982 10.9654018,21.6796875 C11.1328125,21.5122768 11.3467262,21.4285714 11.6071429,21.4285714 L31.25,21.4285714 C31.5104167,21.4285714 31.7243304,21.5122768 31.8917411,21.6796875 C32.0591518,21.8470982 32.1428571,22.0610119 32.1428571,22.3214286 L32.1428571,24.1071429 C32.1428571,24.3675595 32.0591518,24.5814732 31.8917411,24.7488839 C31.7243304,24.9162946 31.5104167,25 31.25,25 L11.6071429,25 C11.3467262,25 11.1328125,24.9162946 10.9654018,24.7488839 C10.7979911,24.5814732 10.7142857,24.3675595 10.7142857,24.1071429 L10.7142857,22.3214286 Z M31.25,28.5714286 C31.5104167,28.5714286 31.7243304,28.6551339 31.8917411,28.8225446 C32.0591518,28.9899554 32.1428571,29.203869 32.1428571,29.4642857 L32.1428571,31.25 C32.1428571,31.5104167 32.0591518,31.7243304 31.8917411,31.8917411 C31.7243304,32.0591518 31.5104167,32.1428571 31.25,32.1428571 L11.6071429,32.1428571 C11.3467262,32.1428571 11.1328125,32.0591518 10.9654018,31.8917411 C10.7979911,31.7243304 10.7142857,31.5104167 10.7142857,31.25 L10.7142857,29.4642857 C10.7142857,29.203869 10.7979911,28.9899554 10.9654018,28.8225446 C11.1328125,28.6551339 11.3467262,28.5714286 11.6071429,28.5714286 L31.25,28.5714286 Z M31.25,35.7142857 C31.5104167,35.7142857 31.7243304,35.7979911 31.8917411,35.9654018 C32.0591518,36.1328125 32.1428571,36.3467262 32.1428571,36.6071429 L32.1428571,38.3928571 C32.1428571,38.6532738 32.0591518,38.8671875 31.8917411,39.0345982 C31.7243304,39.2020089 31.5104167,39.2857143 31.25,39.2857143 L11.6071429,39.2857143 C11.3467262,39.2857143 11.1328125,39.2020089 10.9654018,39.0345982 C10.7979911,38.8671875 10.7142857,38.6532738 10.7142857,38.3928571 L10.7142857,36.6071429 C10.7142857,36.3467262 10.7979911,36.1328125 10.9654018,35.9654018 C11.1328125,35.7979911 11.3467262,35.7142857 11.6071429,35.7142857 L31.25,35.7142857 Z"
id="Shape"
fill="#EEEEEE"
fillRule="nonzero"
/>
</g>
<g id="file-text-o" transform="translate(8.571429, 8.571429)">
<rect
id="Rectangle"
fill="#FAFAFB"
x="1.71428571"
y="3.42857143"
width="30.8571429"
height="44.5714286"
/>
<rect
id="Rectangle"
fill="#FAFAFB"
x="32.5714286"
y="16.2857143"
width="8.57142857"
height="31.7142857"
/>
<polygon
id="Path-2"
fill="#FAFAFB"
points="29.5714286 3.42857143 41.1428571 15.4285714 29.5714286 16.2857143 27.2444196 15.4285714 27.2444196 3.42857143"
/>
<path
d="M40.9598214,10.6026786 C41.4806548,11.1235119 41.9270833,11.8303571 42.2991071,12.7232143 C42.671131,13.6160714 42.8571429,14.4345238 42.8571429,15.1785714 L42.8571429,47.3214286 C42.8571429,48.0654762 42.5967262,48.6979167 42.0758929,49.21875 C41.5550595,49.7395833 40.922619,50 40.1785714,50 L2.67857143,50 C1.93452381,50 1.30208333,49.7395833 0.78125,49.21875 C0.260416667,48.6979167 0,48.0654762 0,47.3214286 L0,2.67857143 C0,1.93452381 0.260416667,1.30208333 0.78125,0.78125 C1.30208333,0.260416667 1.93452381,0 2.67857143,0 L27.6785714,0 C28.422619,0 29.2410714,0.186011905 30.1339286,0.558035714 C31.0267857,0.930059524 31.733631,1.3764881 32.2544643,1.89732143 L40.9598214,10.6026786 Z M28.5714286,3.79464286 L28.5714286,14.2857143 L39.0625,14.2857143 C38.8764881,13.7462798 38.671875,13.3649554 38.4486607,13.1417411 L29.7154018,4.40848214 C29.4921875,4.18526786 29.1108631,3.98065476 28.5714286,3.79464286 Z M39.2857143,46.4285714 L39.2857143,17.8571429 L27.6785714,17.8571429 C26.9345238,17.8571429 26.3020833,17.5967262 25.78125,17.0758929 C25.2604167,16.5550595 25,15.922619 25,15.1785714 L25,3.57142857 L3.57142857,3.57142857 L3.57142857,46.4285714 L39.2857143,46.4285714 Z M10.7142857,22.3214286 C10.7142857,22.0610119 10.7979911,21.8470982 10.9654018,21.6796875 C11.1328125,21.5122768 11.3467262,21.4285714 11.6071429,21.4285714 L31.25,21.4285714 C31.5104167,21.4285714 31.7243304,21.5122768 31.8917411,21.6796875 C32.0591518,21.8470982 32.1428571,22.0610119 32.1428571,22.3214286 L32.1428571,24.1071429 C32.1428571,24.3675595 32.0591518,24.5814732 31.8917411,24.7488839 C31.7243304,24.9162946 31.5104167,25 31.25,25 L11.6071429,25 C11.3467262,25 11.1328125,24.9162946 10.9654018,24.7488839 C10.7979911,24.5814732 10.7142857,24.3675595 10.7142857,24.1071429 L10.7142857,22.3214286 Z M31.25,28.5714286 C31.5104167,28.5714286 31.7243304,28.6551339 31.8917411,28.8225446 C32.0591518,28.9899554 32.1428571,29.203869 32.1428571,29.4642857 L32.1428571,31.25 C32.1428571,31.5104167 32.0591518,31.7243304 31.8917411,31.8917411 C31.7243304,32.0591518 31.5104167,32.1428571 31.25,32.1428571 L11.6071429,32.1428571 C11.3467262,32.1428571 11.1328125,32.0591518 10.9654018,31.8917411 C10.7979911,31.7243304 10.7142857,31.5104167 10.7142857,31.25 L10.7142857,29.4642857 C10.7142857,29.203869 10.7979911,28.9899554 10.9654018,28.8225446 C11.1328125,28.6551339 11.3467262,28.5714286 11.6071429,28.5714286 L31.25,28.5714286 Z M31.25,35.7142857 C31.5104167,35.7142857 31.7243304,35.7979911 31.8917411,35.9654018 C32.0591518,36.1328125 32.1428571,36.3467262 32.1428571,36.6071429 L32.1428571,38.3928571 C32.1428571,38.6532738 32.0591518,38.8671875 31.8917411,39.0345982 C31.7243304,39.2020089 31.5104167,39.2857143 31.25,39.2857143 L11.6071429,39.2857143 C11.3467262,39.2857143 11.1328125,39.2020089 10.9654018,39.0345982 C10.7979911,38.8671875 10.7142857,38.6532738 10.7142857,38.3928571 L10.7142857,36.6071429 C10.7142857,36.3467262 10.7979911,36.1328125 10.9654018,35.9654018 C11.1328125,35.7979911 11.3467262,35.7142857 11.6071429,35.7142857 L31.25,35.7142857 Z"
id="Shape"
fill="#EEEEEE"
fillRule="nonzero"
/>
</g>
<g id="file-text-o" transform="translate(0.000000, 17.142857)">
<rect
id="Rectangle"
fill="#FAFAFB"
x="1.71428571"
y="3.42857143"
width="30.8571429"
height="44.5714286"
/>
<rect
id="Rectangle"
fill="#FAFAFB"
x="32.5714286"
y="16.2857143"
width="8.57142857"
height="31.7142857"
/>
<polygon
id="Path-2"
fill="#FAFAFB"
points="29.5714286 3.42857143 41.1428571 15.4285714 29.5714286 16.2857143 27.2444196 15.4285714 27.2444196 3.42857143"
/>
<path
d="M40.9598214,10.6026786 C41.4806548,11.1235119 41.9270833,11.8303571 42.2991071,12.7232143 C42.671131,13.6160714 42.8571429,14.4345238 42.8571429,15.1785714 L42.8571429,47.3214286 C42.8571429,48.0654762 42.5967262,48.6979167 42.0758929,49.21875 C41.5550595,49.7395833 40.922619,50 40.1785714,50 L2.67857143,50 C1.93452381,50 1.30208333,49.7395833 0.78125,49.21875 C0.260416667,48.6979167 0,48.0654762 0,47.3214286 L0,2.67857143 C0,1.93452381 0.260416667,1.30208333 0.78125,0.78125 C1.30208333,0.260416667 1.93452381,0 2.67857143,0 L27.6785714,0 C28.422619,0 29.2410714,0.186011905 30.1339286,0.558035714 C31.0267857,0.930059524 31.733631,1.3764881 32.2544643,1.89732143 L40.9598214,10.6026786 Z M28.5714286,3.79464286 L28.5714286,14.2857143 L39.0625,14.2857143 C38.8764881,13.7462798 38.671875,13.3649554 38.4486607,13.1417411 L29.7154018,4.40848214 C29.4921875,4.18526786 29.1108631,3.98065476 28.5714286,3.79464286 Z M39.2857143,46.4285714 L39.2857143,17.8571429 L27.6785714,17.8571429 C26.9345238,17.8571429 26.3020833,17.5967262 25.78125,17.0758929 C25.2604167,16.5550595 25,15.922619 25,15.1785714 L25,3.57142857 L3.57142857,3.57142857 L3.57142857,46.4285714 L39.2857143,46.4285714 Z M10.7142857,22.3214286 C10.7142857,22.0610119 10.7979911,21.8470982 10.9654018,21.6796875 C11.1328125,21.5122768 11.3467262,21.4285714 11.6071429,21.4285714 L31.25,21.4285714 C31.5104167,21.4285714 31.7243304,21.5122768 31.8917411,21.6796875 C32.0591518,21.8470982 32.1428571,22.0610119 32.1428571,22.3214286 L32.1428571,24.1071429 C32.1428571,24.3675595 32.0591518,24.5814732 31.8917411,24.7488839 C31.7243304,24.9162946 31.5104167,25 31.25,25 L11.6071429,25 C11.3467262,25 11.1328125,24.9162946 10.9654018,24.7488839 C10.7979911,24.5814732 10.7142857,24.3675595 10.7142857,24.1071429 L10.7142857,22.3214286 Z M31.25,28.5714286 C31.5104167,28.5714286 31.7243304,28.6551339 31.8917411,28.8225446 C32.0591518,28.9899554 32.1428571,29.203869 32.1428571,29.4642857 L32.1428571,31.25 C32.1428571,31.5104167 32.0591518,31.7243304 31.8917411,31.8917411 C31.7243304,32.0591518 31.5104167,32.1428571 31.25,32.1428571 L11.6071429,32.1428571 C11.3467262,32.1428571 11.1328125,32.0591518 10.9654018,31.8917411 C10.7979911,31.7243304 10.7142857,31.5104167 10.7142857,31.25 L10.7142857,29.4642857 C10.7142857,29.203869 10.7979911,28.9899554 10.9654018,28.8225446 C11.1328125,28.6551339 11.3467262,28.5714286 11.6071429,28.5714286 L31.25,28.5714286 Z M31.25,35.7142857 C31.5104167,35.7142857 31.7243304,35.7979911 31.8917411,35.9654018 C32.0591518,36.1328125 32.1428571,36.3467262 32.1428571,36.6071429 L32.1428571,38.3928571 C32.1428571,38.6532738 32.0591518,38.8671875 31.8917411,39.0345982 C31.7243304,39.2020089 31.5104167,39.2857143 31.25,39.2857143 L11.6071429,39.2857143 C11.3467262,39.2857143 11.1328125,39.2020089 10.9654018,39.0345982 C10.7979911,38.8671875 10.7142857,38.6532738 10.7142857,38.3928571 L10.7142857,36.6071429 C10.7142857,36.3467262 10.7979911,36.1328125 10.9654018,35.9654018 C11.1328125,35.7979911 11.3467262,35.7142857 11.6071429,35.7142857 L31.25,35.7142857 Z"
id="Shape"
fill="#EEEEEE"
fillRule="nonzero"
/>
</g>
</g>
</g>
</g>
</g>
</g>
</svg>
);
export default CTUnSelected;

View File

@ -0,0 +1,80 @@
/* eslint-disable */
import React from 'react';
const STSelected = props => (
<svg width="61px" height="68px" viewBox="0 0 61 68" {...props}>
<defs>
<filter
x="-1.7%"
y="-2.3%"
width="103.5%"
height="104.7%"
filterUnits="objectBoundingBox"
id="filter-1"
>
<feOffset dx="0" dy="2" in="SourceAlpha" result="shadowOffsetOuter1"></feOffset>
<feGaussianBlur
stdDeviation="2"
in="shadowOffsetOuter1"
result="shadowBlurOuter1"
></feGaussianBlur>
<feColorMatrix
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"
type="matrix"
in="shadowBlurOuter1"
result="shadowMatrixOuter1"
></feColorMatrix>
<feMerge>
<feMergeNode in="shadowMatrixOuter1"></feMergeNode>
<feMergeNode in="SourceGraphic"></feMergeNode>
</feMerge>
</filter>
</defs>
<g id="Prototype---Single-types" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
<g
id="Plugins-/-Types-Builder-/-Single-page-settings"
transform="translate(-849.000000, -452.000000)"
>
<g
id="Modal---Edit-Single-Type"
filter="url(#filter-1)"
transform="translate(323.000000, 145.000000)"
>
<g id="Single-content-type" transform="translate(476.000000, 269.000000)">
<g id="file-text-o" transform="translate(59.000000, 47.000000)">
<rect
id="Rectangle"
fill="#E4F0FC"
x="1.69491525"
y="3.38983051"
width="30.5084746"
height="44.0677966"
></rect>
<rect
id="Rectangle"
fill="#E4F0FC"
x="31.2033898"
y="16.1016949"
width="8.47457627"
height="31.3559322"
></rect>
<polygon
id="Path-2"
fill="#E4F0FC"
points="29.2372881 3.38983051 40.6779661 15.2542373 29.2372881 16.1016949 26.9365731 15.2542373 26.9365731 3.38983051"
></polygon>
<path
d="M40.4969986,10.4828743 C41.0119468,10.9978225 41.453331,11.6966808 41.8211511,12.5794492 C42.1889713,13.4622175 42.3728814,14.2714218 42.3728814,15.0070621 L42.3728814,46.7867232 C42.3728814,47.5223635 42.1154073,48.1476577 41.600459,48.6626059 C41.0855108,49.1775541 40.4602166,49.4350282 39.7245763,49.4350282 L2.64830508,49.4350282 C1.91266478,49.4350282 1.28737053,49.1775541 0.772422316,48.6626059 C0.257474105,48.1476577 0,47.5223635 0,46.7867232 L0,2.64830508 C0,1.91266478 0.257474105,1.28737053 0.772422316,0.772422316 C1.28737053,0.257474105 1.91266478,0 2.64830508,0 L27.3658192,0 C28.1014595,0 28.9106638,0.183910075 29.7934322,0.551730226 C30.6762006,0.919550377 31.3750589,1.36093456 31.8900071,1.87588277 L40.4969986,10.4828743 Z M28.2485876,3.75176554 L28.2485876,14.1242938 L38.6211158,14.1242938 C38.4372057,13.5909546 38.2349047,13.2139389 38.0142126,12.9932468 L29.3796345,4.35866879 C29.1589424,4.13797669 28.7819268,3.93567561 28.2485876,3.75176554 Z M38.8418079,45.9039548 L38.8418079,17.6553672 L27.3658192,17.6553672 C26.6301789,17.6553672 26.0048847,17.3978931 25.4899364,16.8829449 C24.9749882,16.3679967 24.7175141,15.7427024 24.7175141,15.0070621 L24.7175141,3.53107345 L3.53107345,3.53107345 L3.53107345,45.9039548 L38.8418079,45.9039548 Z M10.5932203,22.069209 C10.5932203,21.8117349 10.6759799,21.6002383 10.8414989,21.4347193 C11.007018,21.2692002 11.2185146,21.1864407 11.4759887,21.1864407 L30.8968927,21.1864407 C31.1543668,21.1864407 31.3658633,21.2692002 31.5313824,21.4347193 C31.6969015,21.6002383 31.779661,21.8117349 31.779661,22.069209 L31.779661,23.8347458 C31.779661,24.0922199 31.6969015,24.3037165 31.5313824,24.4692355 C31.3658633,24.6347546 31.1543668,24.7175141 30.8968927,24.7175141 L11.4759887,24.7175141 C11.2185146,24.7175141 11.007018,24.6347546 10.8414989,24.4692355 C10.6759799,24.3037165 10.5932203,24.0922199 10.5932203,23.8347458 L10.5932203,22.069209 Z M30.8968927,28.2485876 C31.1543668,28.2485876 31.3658633,28.3313471 31.5313824,28.4968662 C31.6969015,28.6623852 31.779661,28.8738818 31.779661,29.1313559 L31.779661,30.8968927 C31.779661,31.1543668 31.6969015,31.3658633 31.5313824,31.5313824 C31.3658633,31.6969015 31.1543668,31.779661 30.8968927,31.779661 L11.4759887,31.779661 C11.2185146,31.779661 11.007018,31.6969015 10.8414989,31.5313824 C10.6759799,31.3658633 10.5932203,31.1543668 10.5932203,30.8968927 L10.5932203,29.1313559 C10.5932203,28.8738818 10.6759799,28.6623852 10.8414989,28.4968662 C11.007018,28.3313471 11.2185146,28.2485876 11.4759887,28.2485876 L30.8968927,28.2485876 Z M30.8968927,35.3107345 C31.1543668,35.3107345 31.3658633,35.393494 31.5313824,35.5590131 C31.6969015,35.7245321 31.779661,35.9360287 31.779661,36.1935028 L31.779661,37.9590395 C31.779661,38.2165137 31.6969015,38.4280102 31.5313824,38.5935293 C31.3658633,38.7590484 31.1543668,38.8418079 30.8968927,38.8418079 L11.4759887,38.8418079 C11.2185146,38.8418079 11.007018,38.7590484 10.8414989,38.5935293 C10.6759799,38.4280102 10.5932203,38.2165137 10.5932203,37.9590395 L10.5932203,36.1935028 C10.5932203,35.9360287 10.6759799,35.7245321 10.8414989,35.5590131 C11.007018,35.393494 11.2185146,35.3107345 11.4759887,35.3107345 L30.8968927,35.3107345 Z"
id="Shape"
fill="#A5D5FF"
fillRule="nonzero"
></path>
</g>
</g>
</g>
</g>
</g>
</svg>
);
export default STSelected;

View File

@ -0,0 +1,76 @@
/* eslint-disable */
import React from 'react';
const STUnselected = props => (
<svg width="61px" height="68px" viewBox="0 0 61 68" {...props}>
<defs>
<filter
x="-1.7%"
y="-2.3%"
width="103.5%"
height="104.7%"
filterUnits="objectBoundingBox"
id="filter-1"
>
<feOffset dx="0" dy="2" in="SourceAlpha" result="shadowOffsetOuter1" />
<feGaussianBlur stdDeviation="2" in="shadowOffsetOuter1" result="shadowBlurOuter1" />
<feColorMatrix
values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0.05 0"
type="matrix"
in="shadowBlurOuter1"
result="shadowMatrixOuter1"
/>
<feMerge>
<feMergeNode in="shadowMatrixOuter1" />
<feMergeNode in="SourceGraphic" />
</feMerge>
</filter>
</defs>
<g id="Prototype---Single-types" stroke="none" strokeWidth="1" fill="none" fillRule="evenodd">
<g
id="Plugins-/-Types-Builder-/-Single-page-settings"
transform="translate(-849.000000, -452.000000)"
>
<g
id="Modal---Edit-Single-Type"
filter="url(#filter-1)"
transform="translate(323.000000, 145.000000)"
>
<g id="Single-content-type" transform="translate(476.000000, 269.000000)">
<g id="file-text-o" transform="translate(59.000000, 47.000000)">
<rect
id="Rectangle"
fill="#FAFAFB"
x="1.69491525"
y="3.38983051"
width="30.5084746"
height="44.0677966"
/>
<rect
id="Rectangle"
fill="#FAFAFB"
x="31.2033898"
y="16.1016949"
width="8.47457627"
height="31.3559322"
/>
<polygon
id="Path-2"
fill="#FAFAFB"
points="29.2372881 3.38983051 40.6779661 15.2542373 29.2372881 16.1016949 26.9365731 15.2542373 26.9365731 3.38983051"
/>
<path
d="M40.4969986,10.4828743 C41.0119468,10.9978225 41.453331,11.6966808 41.8211511,12.5794492 C42.1889713,13.4622175 42.3728814,14.2714218 42.3728814,15.0070621 L42.3728814,46.7867232 C42.3728814,47.5223635 42.1154073,48.1476577 41.600459,48.6626059 C41.0855108,49.1775541 40.4602166,49.4350282 39.7245763,49.4350282 L2.64830508,49.4350282 C1.91266478,49.4350282 1.28737053,49.1775541 0.772422316,48.6626059 C0.257474105,48.1476577 0,47.5223635 0,46.7867232 L0,2.64830508 C0,1.91266478 0.257474105,1.28737053 0.772422316,0.772422316 C1.28737053,0.257474105 1.91266478,0 2.64830508,0 L27.3658192,0 C28.1014595,0 28.9106638,0.183910075 29.7934322,0.551730226 C30.6762006,0.919550377 31.3750589,1.36093456 31.8900071,1.87588277 L40.4969986,10.4828743 Z M28.2485876,3.75176554 L28.2485876,14.1242938 L38.6211158,14.1242938 C38.4372057,13.5909546 38.2349047,13.2139389 38.0142126,12.9932468 L29.3796345,4.35866879 C29.1589424,4.13797669 28.7819268,3.93567561 28.2485876,3.75176554 Z M38.8418079,45.9039548 L38.8418079,17.6553672 L27.3658192,17.6553672 C26.6301789,17.6553672 26.0048847,17.3978931 25.4899364,16.8829449 C24.9749882,16.3679967 24.7175141,15.7427024 24.7175141,15.0070621 L24.7175141,3.53107345 L3.53107345,3.53107345 L3.53107345,45.9039548 L38.8418079,45.9039548 Z M10.5932203,22.069209 C10.5932203,21.8117349 10.6759799,21.6002383 10.8414989,21.4347193 C11.007018,21.2692002 11.2185146,21.1864407 11.4759887,21.1864407 L30.8968927,21.1864407 C31.1543668,21.1864407 31.3658633,21.2692002 31.5313824,21.4347193 C31.6969015,21.6002383 31.779661,21.8117349 31.779661,22.069209 L31.779661,23.8347458 C31.779661,24.0922199 31.6969015,24.3037165 31.5313824,24.4692355 C31.3658633,24.6347546 31.1543668,24.7175141 30.8968927,24.7175141 L11.4759887,24.7175141 C11.2185146,24.7175141 11.007018,24.6347546 10.8414989,24.4692355 C10.6759799,24.3037165 10.5932203,24.0922199 10.5932203,23.8347458 L10.5932203,22.069209 Z M30.8968927,28.2485876 C31.1543668,28.2485876 31.3658633,28.3313471 31.5313824,28.4968662 C31.6969015,28.6623852 31.779661,28.8738818 31.779661,29.1313559 L31.779661,30.8968927 C31.779661,31.1543668 31.6969015,31.3658633 31.5313824,31.5313824 C31.3658633,31.6969015 31.1543668,31.779661 30.8968927,31.779661 L11.4759887,31.779661 C11.2185146,31.779661 11.007018,31.6969015 10.8414989,31.5313824 C10.6759799,31.3658633 10.5932203,31.1543668 10.5932203,30.8968927 L10.5932203,29.1313559 C10.5932203,28.8738818 10.6759799,28.6623852 10.8414989,28.4968662 C11.007018,28.3313471 11.2185146,28.2485876 11.4759887,28.2485876 L30.8968927,28.2485876 Z M30.8968927,35.3107345 C31.1543668,35.3107345 31.3658633,35.393494 31.5313824,35.5590131 C31.6969015,35.7245321 31.779661,35.9360287 31.779661,36.1935028 L31.779661,37.9590395 C31.779661,38.2165137 31.6969015,38.4280102 31.5313824,38.5935293 C31.3658633,38.7590484 31.1543668,38.8418079 30.8968927,38.8418079 L11.4759887,38.8418079 C11.2185146,38.8418079 11.007018,38.7590484 10.8414989,38.5935293 C10.6759799,38.4280102 10.5932203,38.2165137 10.5932203,37.9590395 L10.5932203,36.1935028 C10.5932203,35.9360287 10.6759799,35.7245321 10.8414989,35.5590131 C11.007018,35.393494 11.2185146,35.3107345 11.4759887,35.3107345 L30.8968927,35.3107345 Z"
id="Shape"
fill="#EEEEEE"
fillRule="nonzero"
/>
</g>
</g>
</g>
</g>
</g>
</svg>
);
export default STUnselected;

View File

@ -1,11 +1,29 @@
import React from 'react';
import PropTypes from 'prop-types';
import { useGlobalContext } from 'strapi-helper-plugin';
import { Flex } from '@buffetjs/core';
import styled from 'styled-components';
import CTIcon from './CT';
import STIcon from './ST';
import CustomLabel from './Label';
import Enumeration from './Enumeration';
import EnumerationWrapper from './EnumerationWrapper';
import Wrapper from './Wrapper';
/**
* TODO: Those should not exist, remove with design system
*/
const CTHackSpan = styled.span`
margin-left: -1rem;
margin-right: 1rem;
margin-top: -1.3rem;
`;
const STHackSpan = styled.span`
margin-left: -1rem;
margin-right: 1rem;
margin-top: -0.5rem;
`;
const BooleanBox = ({ label, name, onChange, onChangeCallback, options, value }) => {
const { formatMessage } = useGlobalContext();
@ -31,17 +49,37 @@ const BooleanBox = ({ label, name, onChange, onChangeCallback, options, value })
value={option.value}
/>
))}
{options.map(option => (
<EnumerationWrapper
className="option"
key={option.value}
htmlFor={option.value.toString()}
>
<span className="option__indicator" />
<span className="option__title">{formatMessage({ id: option.headerId })}</span>
<p>{formatMessage({ id: option.descriptionId })}</p>
</EnumerationWrapper>
))}
{options.map(option => {
const isST = option.value === 'singleType';
const isCT = option.value === 'collectionType';
return (
<EnumerationWrapper
className="option"
key={option.value}
htmlFor={option.value.toString()}
>
<Flex>
{isST && (
<STHackSpan>
<STIcon selected={value === 'singleType'} />
</STHackSpan>
)}
{isCT && (
<CTHackSpan>
<CTIcon selected={value === 'collectionType'} />
</CTHackSpan>
)}
<div>
<span className="option__indicator" />
<span className="option__title">{formatMessage({ id: option.headerId })}</span>
<p>{formatMessage({ id: option.descriptionId })}</p>
</div>
</Flex>
</EnumerationWrapper>
);
})}
</Wrapper>
</div>
);

View File

@ -0,0 +1,112 @@
import React from 'react';
import { render, screen } from '@testing-library/react';
import { ThemeProvider } from 'styled-components';
import defaultThemes from '../../../../../../strapi-admin/admin/src/themes';
import BooleanBox from "..";
jest.mock('strapi-helper-plugin', () => ({
useGlobalContext: () => ({ formatMessage: ({ id }) => id }),
}));
describe('BooleanBox', () => {
it('has single type selected by default and verifies the other states', () => {
const options = [
{
headerId: 'menu.section.models.name.singular',
descriptionId: 'form.button.collection-type.description',
value: 'collectionType',
},
{
headerId: 'menu.section.single-types.name.singular',
descriptionId: 'form.button.single-type.description',
value: 'singleType',
},
];
render(
<ThemeProvider theme={defaultThemes}>
<BooleanBox
label="Hello world"
name="box"
onChange={() => null}
onChangeCallback={() => null}
options={options}
value="singleType"
/>
</ThemeProvider>
);
expect(screen.getByTestId('st-selected')).toBeVisible();
expect(screen.getByTestId('ct-unselected')).toBeVisible();
expect(screen.queryByTestId('ct-selected')).toBeFalsy();
expect(screen.queryByTestId('st-unselected')).toBeFalsy();
});
it('has collection type selected by default and verifies the other states', () => {
const options = [
{
headerId: 'menu.section.models.name.singular',
descriptionId: 'form.button.collection-type.description',
value: 'collectionType',
},
{
headerId: 'menu.section.single-types.name.singular',
descriptionId: 'form.button.single-type.description',
value: 'singleType',
},
];
render(
<ThemeProvider theme={defaultThemes}>
<BooleanBox
label="Hello world"
name="box"
onChange={() => null}
onChangeCallback={() => null}
options={options}
value="collectionType"
/>
</ThemeProvider>
);
expect(screen.getByTestId('ct-selected')).toBeVisible();
expect(screen.getByTestId('st-unselected')).toBeVisible();
expect(screen.queryByTestId('st-selected')).toBeFalsy();
expect(screen.queryByTestId('ct-unselected')).toBeFalsy();
});
it('does not show the ST and CT icons for other types', () => {
const options = [
{
headerId: 'menu.section.models.name.singular',
descriptionId: 'form.button.collection-type.description',
value: 'text',
},
{
headerId: 'menu.section.single-types.name.singular',
descriptionId: 'form.button.single-type.description',
value: 'string',
},
];
render(
<ThemeProvider theme={defaultThemes}>
<BooleanBox
label="Hello world"
name="box"
onChange={() => null}
onChangeCallback={() => null}
options={options}
value="collectionType"
/>
</ThemeProvider>
);
expect(screen.queryByTestId('ct-selected')).toBeFalsy();
expect(screen.queryByTestId('st-unselected')).toBeFalsy();
expect(screen.queryByTestId('st-selected')).toBeFalsy();
expect(screen.queryByTestId('ct-unselected')).toBeFalsy();
});
});