@griddo/ax 10.2.11 → 10.2.13

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 (56) hide show
  1. package/package.json +2 -2
  2. package/src/__tests__/components/Fields/ReferenceField/ReferenceField.test.tsx +1 -1
  3. package/src/__tests__/components/Fields/UrlField/UrlField.test.tsx +1 -1
  4. package/src/components/Fields/AsyncSelect/index.tsx +12 -8
  5. package/src/components/Fields/AsyncSelect/style.tsx +58 -1
  6. package/src/components/Fields/CheckField/index.tsx +15 -2
  7. package/src/components/Fields/IntegrationsField/IntegrationItem/CustomPanel/index.tsx +49 -47
  8. package/src/components/Fields/IntegrationsField/IntegrationItem/CustomPanel/style.tsx +6 -1
  9. package/src/components/Fields/IntegrationsField/IntegrationItem/VariablesPanel/index.tsx +13 -11
  10. package/src/components/Fields/IntegrationsField/IntegrationItem/VariablesPanel/style.tsx +6 -3
  11. package/src/components/Fields/MultiCheckSelect/style.tsx +1 -0
  12. package/src/components/Fields/ReferenceField/AutoPanel/AutoItem/index.tsx +6 -5
  13. package/src/components/Fields/ReferenceField/AutoPanel/index.tsx +277 -40
  14. package/src/components/Fields/ReferenceField/AutoPanel/style.tsx +117 -15
  15. package/src/components/Fields/ReferenceField/Context/index.tsx +18 -10
  16. package/src/components/Fields/ReferenceField/ItemList/Item/index.tsx +9 -30
  17. package/src/components/Fields/ReferenceField/ItemList/Item/style.tsx +9 -51
  18. package/src/components/Fields/ReferenceField/ItemList/index.tsx +14 -18
  19. package/src/components/Fields/ReferenceField/ManualPanel/Item/index.tsx +1 -1
  20. package/src/components/Fields/ReferenceField/ManualPanel/Item/style.tsx +25 -26
  21. package/src/components/Fields/ReferenceField/ManualPanel/index.tsx +91 -36
  22. package/src/components/Fields/ReferenceField/ManualPanel/style.tsx +29 -1
  23. package/src/components/Fields/ReferenceField/index.tsx +18 -11
  24. package/src/components/Fields/Select/index.tsx +10 -13
  25. package/src/components/Fields/Select/style.tsx +13 -7
  26. package/src/components/Fields/TimeField/index.tsx +1 -0
  27. package/src/components/Fields/UniqueCheck/index.tsx +3 -1
  28. package/src/components/Fields/UrlField/index.tsx +3 -1
  29. package/src/components/Fields/UrlField/style.tsx +6 -1
  30. package/src/components/FloatingPanel/style.tsx +0 -1
  31. package/src/components/PageFinder/index.tsx +8 -7
  32. package/src/components/SearchField/index.tsx +2 -3
  33. package/src/helpers/arrays.tsx +2 -2
  34. package/src/modules/Analytics/DimensionPanel/index.tsx +44 -42
  35. package/src/modules/Analytics/DimensionPanel/style.tsx +6 -1
  36. package/src/modules/Analytics/GroupPanel/index.tsx +57 -64
  37. package/src/modules/Analytics/GroupPanel/style.tsx +6 -0
  38. package/src/modules/Categories/CategoriesList/CategoryPanel/index.tsx +15 -13
  39. package/src/modules/Categories/CategoriesList/CategoryPanel/style.tsx +11 -4
  40. package/src/modules/GlobalSettings/Robots/Item/RobotsPanel/index.tsx +20 -18
  41. package/src/modules/GlobalSettings/Robots/Item/RobotsPanel/style.tsx +6 -1
  42. package/src/modules/Navigation/Menus/List/Table/ConfigPanel/index.tsx +8 -6
  43. package/src/modules/Navigation/Menus/List/Table/ConfigPanel/style.tsx +6 -1
  44. package/src/modules/Navigation/Menus/List/Table/SidePanel/index.tsx +15 -13
  45. package/src/modules/Navigation/Menus/List/Table/SidePanel/style.tsx +9 -2
  46. package/src/modules/PublicPreview/index.tsx +1 -1
  47. package/src/modules/Redirects/RedirectPanel/index.tsx +33 -31
  48. package/src/modules/Redirects/RedirectPanel/style.tsx +6 -1
  49. package/src/modules/Redirects/index.tsx +0 -1
  50. package/src/modules/Settings/Integrations/IntegrationForm/VariablePanel/index.tsx +63 -61
  51. package/src/modules/Settings/Integrations/IntegrationForm/VariablePanel/style.tsx +6 -1
  52. package/src/modules/Settings/Integrations/IntegrationForm/index.tsx +5 -3
  53. package/src/modules/Settings/Integrations/IntegrationForm/style.tsx +6 -0
  54. package/src/modules/Settings/Languages/LanguagePanel/index.tsx +14 -12
  55. package/src/modules/Settings/Languages/LanguagePanel/style.tsx +8 -1
  56. package/src/types/index.tsx +1 -1
@@ -16,14 +16,14 @@ const Select = (props: ISelectProps): JSX.Element => {
16
16
  mandatory,
17
17
  onChange,
18
18
  alignRight,
19
+ maxWidth,
19
20
  } = props;
20
21
  const className = error ? `react-select-error ${type}` : type;
21
- const emptyOption = { value: null, label: placeholder || "Empty" };
22
+ const emptyOption = { value: "", label: placeholder || "Empty" };
22
23
 
23
- const isMandatory = !mandatory && type !== "inline";
24
- const [hasEmptyOption, setHasEmptyOption] = useState(isMandatory);
24
+ const [hasEmptyOption, setHasEmptyOption] = useState(!mandatory);
25
25
 
26
- const optionValues: any = hasEmptyOption ? [emptyOption, ...options] : options;
26
+ const optionValues: IOptionProps[] = hasEmptyOption ? [emptyOption, ...options] : options;
27
27
 
28
28
  const handleChange = (selectedValue: IOptionProps) => {
29
29
  onChange(selectedValue.value);
@@ -31,18 +31,13 @@ const Select = (props: ISelectProps): JSX.Element => {
31
31
 
32
32
  const handleInputChange = (newValue: string) => {
33
33
  const inputValue = newValue.replace(/\W/g, "");
34
- setHasEmptyOption(isMandatory && inputValue.length === 0);
34
+ setHasEmptyOption(!mandatory && inputValue.length === 0);
35
35
  return inputValue;
36
36
  };
37
37
 
38
38
  // tslint:disable-next-line: no-shadowed-variable
39
- const getObjectValue = (value: string | number | undefined, options: IOptionProps[]) => {
40
- if (!value) {
41
- return null;
42
- } else {
43
- return options.find((option) => option.value === value);
44
- }
45
- };
39
+ const getObjectValue = (value: string | undefined, options: IOptionProps[]) =>
40
+ options.find((option) => option.value === value);
46
41
 
47
42
  const searchable = type === "inline" || type === "mini" ? false : true;
48
43
 
@@ -50,7 +45,7 @@ const Select = (props: ISelectProps): JSX.Element => {
50
45
  <div data-testid="select-component">
51
46
  <S.StyledSelect
52
47
  name={name}
53
- value={getObjectValue(value, optionValues)}
48
+ value={getObjectValue(value, optionValues) || ""}
54
49
  options={optionValues}
55
50
  isMulti={isMulti}
56
51
  isDisabled={disabled}
@@ -65,6 +60,7 @@ const Select = (props: ISelectProps): JSX.Element => {
65
60
  onInputChange={handleInputChange}
66
61
  alignRight={alignRight}
67
62
  aria-label={name}
63
+ maxWidth={maxWidth}
68
64
  />
69
65
  </div>
70
66
  );
@@ -83,6 +79,7 @@ export interface ISelectProps {
83
79
  mandatory?: boolean;
84
80
  alignRight?: boolean;
85
81
  onChange: (value: string) => void;
82
+ maxWidth?: number;
86
83
  }
87
84
 
88
85
  interface IOptionProps {
@@ -5,6 +5,7 @@ export const StyledSelect = styled(Select)<{
5
5
  isDisabled: boolean | undefined;
6
6
  error: boolean | undefined;
7
7
  alignRight: boolean | undefined;
8
+ maxWidth?: number;
8
9
  }>`
9
10
  ${(p) => p.theme.textStyle?.fieldContent};
10
11
  color: ${(p) => p.theme.color?.textHighEmphasis};
@@ -94,7 +95,7 @@ export const StyledSelect = styled(Select)<{
94
95
  }
95
96
 
96
97
  &.inline {
97
- ${(p) => p.theme.textStyle?.uiS};
98
+ ${(p) => p.theme.textStyle.uiS};
98
99
  text-transform: capitalize;
99
100
 
100
101
  .react-select__control {
@@ -109,15 +110,20 @@ export const StyledSelect = styled(Select)<{
109
110
  .react-select__single-value {
110
111
  position: relative;
111
112
  transform: none;
112
- color: ${(p) => p.theme.color?.interactive01};
113
- overflow: visible;
113
+ color: ${(p) => (p.error ? p.theme.color.error : p.theme.color.interactive01)};
114
+ white-space: nowrap;
115
+ text-overflow: ellipsis;
116
+ max-width: ${(p) => (p.maxWidth ? `${p.maxWidth}px` : `calc(${p.theme.spacing.xl} * 4)`)};
117
+ display: block;
118
+ overflow: hidden;
114
119
  }
115
120
  }
116
121
  .react-select__indicator {
122
+ color: ${(p) => (p.error ? p.theme.color.error : p.theme.color.interactive01)};
117
123
  padding: 0;
118
124
  svg {
119
- width: ${(p) => p.theme.spacing?.s};
120
- height: ${(p) => p.theme.spacing?.s};
125
+ width: ${(p) => p.theme.spacing.s};
126
+ height: ${(p) => p.theme.spacing.s};
121
127
  }
122
128
  }
123
129
  .react-select__input {
@@ -130,13 +136,13 @@ export const StyledSelect = styled(Select)<{
130
136
  .react-select__control--is-disabled {
131
137
  .react-select__value-container {
132
138
  .react-select__single-value {
133
- color: ${(p) => p.theme.color?.interactiveDisabled};
139
+ color: ${(p) => p.theme.color.interactiveDisabled};
134
140
  }
135
141
  }
136
142
  }
137
143
 
138
144
  .react-select__menu {
139
- ${(p) => p.theme.textStyle?.fieldContent};
145
+ ${(p) => p.theme.textStyle.fieldContent};
140
146
  }
141
147
  }
142
148
 
@@ -38,6 +38,7 @@ const TimeField = (props: IProps) => {
38
38
  onChange={handleSelectChange}
39
39
  type="inline"
40
40
  disabled={disabled}
41
+ mandatory={true}
41
42
  />
42
43
  </S.SelectWrapper>
43
44
  <S.IconWrapper>
@@ -2,7 +2,7 @@ import React from "react";
2
2
  import { CheckField } from "@ax/components";
3
3
 
4
4
  const UniqueCheck = (props: IProps) => {
5
- const { name, value, options, onChange, disabled, inversed = false } = props;
5
+ const { name, value, options, onChange, disabled, inversed = false, className } = props;
6
6
  const uniqueOption = options[0];
7
7
 
8
8
  const handleChange = (changeEvt: ICheckEvent) => {
@@ -19,6 +19,7 @@ const UniqueCheck = (props: IProps) => {
19
19
  onChange={handleChange}
20
20
  disabled={disabled}
21
21
  inversed={inversed}
22
+ className={className}
22
23
  />
23
24
  );
24
25
  };
@@ -35,6 +36,7 @@ interface IProps {
35
36
  onChange: any;
36
37
  disabled?: boolean;
37
38
  inversed?: boolean;
39
+ className?: string;
38
40
  }
39
41
 
40
42
  interface ICheck {
@@ -218,7 +218,9 @@ const UrlField = (props: IUrlFieldProps): JSX.Element => {
218
218
  handlePanel={handlePanel}
219
219
  secondary={inFloatingPanel}
220
220
  >
221
- <PageFinder onClick={handleSetPage} isOpen={isOpen} />
221
+ <S.Wrapper>
222
+ <PageFinder onClick={handleSetPage} isOpen={isOpen} />
223
+ </S.Wrapper>
222
224
  </FloatingPanel>
223
225
  </S.UrlFieldWrapper>
224
226
  );
@@ -54,4 +54,9 @@ const AnchorWrapper = styled.div`
54
54
  margin-top: ${(p) => p.theme.spacing.s};
55
55
  `;
56
56
 
57
- export { PageSelectedWrapper, PageField, IconWrapper, AdvancedWrapper, AnchorWrapper, UrlFieldWrapper };
57
+ const Wrapper = styled.div`
58
+ padding: ${(p) => p.theme.spacing.m};
59
+ height: 100%;
60
+ `;
61
+
62
+ export { PageSelectedWrapper, PageField, IconWrapper, AdvancedWrapper, AnchorWrapper, UrlFieldWrapper, Wrapper };
@@ -46,7 +46,6 @@ export const Wrapper = styled.section<{
46
46
  `;
47
47
 
48
48
  export const Content = styled.div`
49
- padding: ${(p) => p.theme.spacing.m};
50
49
  height: 100%;
51
50
  `;
52
51
 
@@ -5,7 +5,7 @@ import { IContentType, IGlobalLanguage, IPage, IRootState, ISite } from "@ax/typ
5
5
  import { useDebounce } from "@ax/hooks";
6
6
  import { getStructuredDataTitle, isReqOk } from "@ax/helpers";
7
7
  import { sites, structuredData } from "@ax/api";
8
- import { Loader, Pagination, TextField, Select, Button } from "@ax/components";
8
+ import { Loader, Pagination, TextField, Select, Button, AsyncSelect } from "@ax/components";
9
9
  import SelectionListItem from "./SelectionListItem";
10
10
 
11
11
  import * as S from "./style";
@@ -13,11 +13,10 @@ import * as S from "./style";
13
13
  const PageFinder = (props: IPageFinderProps): JSX.Element => {
14
14
  const { onClick, currentSiteID, isOpen, allSites, lang, globalLangs, multiple, hideSites, pages } = props;
15
15
 
16
- const siteOptions = allSites.map((site) => ({ label: site.name, value: site.id.toString() }));
17
16
  const langOptions = globalLangs.map((lang) => ({ label: lang.label, value: lang.id.toString() }));
18
17
 
19
18
  const initialState = {
20
- site: currentSiteID || Number(siteOptions[0].value),
19
+ site: currentSiteID || allSites[0].id,
21
20
  lang: lang.id,
22
21
  type: "all",
23
22
  query: "",
@@ -44,7 +43,7 @@ const PageFinder = (props: IPageFinderProps): JSX.Element => {
44
43
 
45
44
  const resetQuery = () => setState((state) => ({ ...state, query: "" }));
46
45
 
47
- const changeState = (key: string, value: string | number) => setState((state) => ({ ...state, [key]: value }));
46
+ const changeState = (key: string, value: string | number | null) => setState((state) => ({ ...state, [key]: value }));
48
47
 
49
48
  useEffect(() => {
50
49
  if (!isOpen) resetQuery();
@@ -187,14 +186,16 @@ const PageFinder = (props: IPageFinderProps): JSX.Element => {
187
186
  onChange={(value) => changeState("lang", value)}
188
187
  value={state.lang.toString()}
189
188
  type="inline"
189
+ mandatory={true}
190
190
  />
191
191
  {!hideSites && (
192
- <Select
192
+ <AsyncSelect
193
193
  name="select"
194
- options={siteOptions}
194
+ entity="sites"
195
195
  onChange={(value) => changeState("site", value)}
196
- value={state.site.toString()}
196
+ value={state.site}
197
197
  type="inline"
198
+ mandatory={true}
198
199
  />
199
200
  )}
200
201
  {selectedPages.length > 0 && (
@@ -20,8 +20,7 @@ const SearchField = (props: ISearchFieldProps): JSX.Element => {
20
20
 
21
21
  const [isOpen, setIsOpen] = useState(false);
22
22
  const [inputValue, setInputValue] = useState("");
23
- const initState = searchFilters && searchFilters[0] ? searchFilters[0].value : "";
24
- const [selectValue, setSelectValue] = useState<string>(initState);
23
+ const [selectValue, setSelectValue] = useState<string>("");
25
24
 
26
25
  const toggleField = () => setIsOpen(!isOpen);
27
26
 
@@ -36,7 +35,7 @@ const SearchField = (props: ISearchFieldProps): JSX.Element => {
36
35
  const handleClear = () => {
37
36
  setInputValue("");
38
37
  onChange("");
39
- setSelectValue(initState);
38
+ setSelectValue("");
40
39
  };
41
40
 
42
41
  const handleClose = () => {
@@ -1,9 +1,9 @@
1
1
  const isEmptyArray = (arr: any[]) => arr && arr.length === 0;
2
2
 
3
- const moveArrayElement = (element: unknown, arr: unknown[], newIndex: number): Array<unknown> => {
3
+ const moveArrayElement = (element: any, arr: any[], newIndex: number): Array<any> => {
4
4
  const arrCopy = [...arr];
5
5
  if (arrCopy.length <= 1) return arrCopy;
6
- const elementIndex = arrCopy.findIndex((el: unknown) => el === element);
6
+ const elementIndex = arrCopy.findIndex((el: any) => el === element);
7
7
  const el = arrCopy[elementIndex];
8
8
  arrCopy.splice(elementIndex, 1);
9
9
  arrCopy.splice(newIndex, 0, el);
@@ -80,52 +80,54 @@ const DimensionPanel = (props: IProps): JSX.Element => {
80
80
 
81
81
  return (
82
82
  <FloatingPanel title={title} toggleModal={toggleModal} isOpen={isOpen}>
83
- <S.ContentWrapper>
84
- <FieldsBehavior
85
- name="removeItemChildren"
86
- fieldType="RadioGroup"
87
- title="Dimension type"
88
- value={type}
89
- options={typeOptions}
90
- onChange={setType}
91
- mandatory
92
- />
93
- <S.NoteWrapper>
94
- <NoteField value={{ text: noteText, title: noteTitle }} />
95
- </S.NoteWrapper>
96
- <FieldsBehavior
97
- title="Dimension"
98
- name="name"
99
- fieldType="TextField"
100
- value={name}
101
- onChange={setName}
102
- mandatory
103
- validators={{ mandatory: true }}
104
- error={errors.name}
105
- placeholder="Type a Dimension Name"
106
- />
107
- {type === "dimensionsAndValues" ? (
83
+ <S.Wrapper>
84
+ <S.ContentWrapper>
108
85
  <FieldsBehavior
109
- title="Values"
110
- name="values"
111
- fieldType="TextArea"
112
- value={values}
113
- onChange={setValues}
86
+ name="removeItemChildren"
87
+ fieldType="RadioGroup"
88
+ title="Dimension type"
89
+ value={type}
90
+ options={typeOptions}
91
+ onChange={setType}
92
+ mandatory
93
+ />
94
+ <S.NoteWrapper>
95
+ <NoteField value={{ text: noteText, title: noteTitle }} />
96
+ </S.NoteWrapper>
97
+ <FieldsBehavior
98
+ title="Dimension"
99
+ name="name"
100
+ fieldType="TextField"
101
+ value={name}
102
+ onChange={setName}
114
103
  mandatory
115
104
  validators={{ mandatory: true }}
116
- error={errors.values}
117
- placeholder="Type any value that you need. &#10;Separate them with ;&#10;&#19;&#10;Example: English; Spanish; German; French"
118
- rows={4}
105
+ error={errors.name}
106
+ placeholder="Type a Dimension Name"
119
107
  />
120
- ) : (
121
- <></>
122
- )}
123
- </S.ContentWrapper>
124
- <S.Footer>
125
- <Button className="button" type="button" onClick={editButton.action}>
126
- {editButton.label}
127
- </Button>
128
- </S.Footer>
108
+ {type === "dimensionsAndValues" ? (
109
+ <FieldsBehavior
110
+ title="Values"
111
+ name="values"
112
+ fieldType="TextArea"
113
+ value={values}
114
+ onChange={setValues}
115
+ mandatory
116
+ validators={{ mandatory: true }}
117
+ error={errors.values}
118
+ placeholder="Type any value that you need. &#10;Separate them with ;&#10;&#19;&#10;Example: English; Spanish; German; French"
119
+ rows={4}
120
+ />
121
+ ) : (
122
+ <></>
123
+ )}
124
+ </S.ContentWrapper>
125
+ <S.Footer>
126
+ <Button className="button" type="button" onClick={editButton.action}>
127
+ {editButton.label}
128
+ </Button>
129
+ </S.Footer>
130
+ </S.Wrapper>
129
131
  </FloatingPanel>
130
132
  );
131
133
  };
@@ -1,5 +1,10 @@
1
1
  import styled from "styled-components";
2
2
 
3
+ const Wrapper = styled.div`
4
+ padding: ${(p) => p.theme.spacing.m};
5
+ height: 100%;
6
+ `;
7
+
3
8
  const Footer = styled.div`
4
9
  position: absolute;
5
10
  bottom: ${(p) => p.theme.spacing.m};
@@ -20,4 +25,4 @@ const ContentWrapper = styled.div`
20
25
  padding: 0 ${(p) => p.theme.spacing.m} ${(p) => p.theme.spacing.s} ${(p) => p.theme.spacing.m};
21
26
  `;
22
27
 
23
- export { Footer, NoteWrapper, ContentWrapper };
28
+ export { Wrapper, Footer, NoteWrapper, ContentWrapper };
@@ -24,9 +24,7 @@ const GroupPanel = (props: IProps): JSX.Element => {
24
24
  const dimensionOptions = [];
25
25
  const dimensionsArr = splitAndTrim(item?.dimensions, ";");
26
26
  const isAllDimensions = dimensionsArr.length === dimensions.length;
27
- (!item || isAllDimensions)
28
- ? dimensionOptions.push("all")
29
- : dimensionOptions.push(...dimensionsArr);
27
+ !item || isAllDimensions ? dimensionOptions.push("all") : dimensionOptions.push(...dimensionsArr);
30
28
  setSelectedDimensions(dimensionOptions);
31
29
 
32
30
  const templateOptions = [];
@@ -37,7 +35,7 @@ const GroupPanel = (props: IProps): JSX.Element => {
37
35
 
38
36
  const hasTemplate = !!templateOptions.length && !templateOptions.includes("null");
39
37
  setHasTemplate(hasTemplate);
40
- }
38
+ };
41
39
 
42
40
  useEffect(() => {
43
41
  isOpen && resetState();
@@ -55,7 +53,7 @@ const GroupPanel = (props: IProps): JSX.Element => {
55
53
  ...item,
56
54
  name,
57
55
  dimensions: dimensionsStr,
58
- templates: templatesStr
56
+ templates: templatesStr,
59
57
  };
60
58
  setGroupItem(value);
61
59
 
@@ -65,11 +63,11 @@ const GroupPanel = (props: IProps): JSX.Element => {
65
63
  const validateFields = () => {
66
64
  const errorFields = {
67
65
  name: !name.length,
68
- }
66
+ };
69
67
  setErrors(errorFields);
70
68
  const isFieldsValid = Object.values(errorFields).every((error) => !error);
71
69
  isFieldsValid && editItemAction();
72
- }
70
+ };
73
71
 
74
72
  const title = item ? "Update Dimensions Group" : "Create Dimensions Group";
75
73
 
@@ -97,15 +95,13 @@ const GroupPanel = (props: IProps): JSX.Element => {
97
95
  const setDimensions = (selection: any) => {
98
96
  if (!selection.length) selection = ["all"];
99
97
  setSelectedDimensions([...selection]);
100
- }
98
+ };
101
99
 
102
100
  const setTemplates = (selection: any) => {
103
101
  setSelectedTemplates([...selection]);
104
- }
102
+ };
105
103
 
106
- const selectedDimensionsN = selectedDimensions.includes("all")
107
- ? dimensions?.length
108
- : selectedDimensions.length;
104
+ const selectedDimensionsN = selectedDimensions.includes("all") ? dimensions?.length : selectedDimensions.length;
109
105
 
110
106
  const hasTemplateOpts = [
111
107
  {
@@ -123,63 +119,60 @@ const GroupPanel = (props: IProps): JSX.Element => {
123
119
  const hasTemplate = value === "yes";
124
120
  setHasTemplate(hasTemplate);
125
121
  !hasTemplate && setSelectedTemplates([]);
126
-
127
- }
122
+ };
128
123
 
129
124
  return (
130
125
  <FloatingPanel title={title} toggleModal={toggleModal} isOpen={isOpen}>
131
- <S.ContentWrapper>
132
- <FieldsBehavior
133
- title="Name"
134
- name="name"
135
- fieldType="TextField"
136
- value={name}
137
- onChange={setName}
138
- mandatory
139
- validators={{ mandatory: true }}
140
- error={errors.name}
141
- />
142
- <S.Divider />
143
- <S.Heading>
144
- <S.HeadingText>Dimensions</S.HeadingText>
145
- <S.HeadingCounter>{selectedDimensionsN}/{dimensions?.length}</S.HeadingCounter>
146
- </S.Heading>
147
- <S.Description>Select the dimensions to this content.</S.Description>
148
- <CheckGroup
149
- options={dimensionOptions}
150
- value={selectedDimensions}
151
- onChange={setDimensions}
152
- selectAllOption="all"
153
- />
154
- <S.Divider />
155
- <S.Heading $spaceBetween>
156
- <S.HeadingText>Associated to a template</S.HeadingText>
157
- <S.RadioTemplate>
158
- <RadioGroup
159
- name="hasTemplate"
160
- value={hasTemplate ? "yes" : "no"}
161
- options={hasTemplateOpts}
162
- onChange={handleChangeHasTemplate}
163
- inline
164
- />
165
- </S.RadioTemplate>
166
- </S.Heading>
167
- <S.Description>If you create a page of this template, it will appear with these dimensions by default.</S.Description>
168
- {hasTemplate ? (
126
+ <S.Wrapper>
127
+ <S.ContentWrapper>
128
+ <FieldsBehavior
129
+ title="Name"
130
+ name="name"
131
+ fieldType="TextField"
132
+ value={name}
133
+ onChange={setName}
134
+ mandatory
135
+ validators={{ mandatory: true }}
136
+ error={errors.name}
137
+ />
138
+ <S.Divider />
139
+ <S.Heading>
140
+ <S.HeadingText>Dimensions</S.HeadingText>
141
+ <S.HeadingCounter>
142
+ {selectedDimensionsN}/{dimensions?.length}
143
+ </S.HeadingCounter>
144
+ </S.Heading>
145
+ <S.Description>Select the dimensions to this content.</S.Description>
169
146
  <CheckGroup
170
- options={templates}
171
- value={selectedTemplates}
172
- onChange={setTemplates}
147
+ options={dimensionOptions}
148
+ value={selectedDimensions}
149
+ onChange={setDimensions}
150
+ selectAllOption="all"
173
151
  />
174
- ) : (
175
- <></>
176
- )}
177
- </S.ContentWrapper>
178
- <S.Footer>
179
- <Button className="button" type="button" onClick={editButton.action}>
180
- {editButton.label}
181
- </Button>
182
- </S.Footer>
152
+ <S.Divider />
153
+ <S.Heading $spaceBetween>
154
+ <S.HeadingText>Associated to a template</S.HeadingText>
155
+ <S.RadioTemplate>
156
+ <RadioGroup
157
+ name="hasTemplate"
158
+ value={hasTemplate ? "yes" : "no"}
159
+ options={hasTemplateOpts}
160
+ onChange={handleChangeHasTemplate}
161
+ inline
162
+ />
163
+ </S.RadioTemplate>
164
+ </S.Heading>
165
+ <S.Description>
166
+ If you create a page of this template, it will appear with these dimensions by default.
167
+ </S.Description>
168
+ {hasTemplate ? <CheckGroup options={templates} value={selectedTemplates} onChange={setTemplates} /> : <></>}
169
+ </S.ContentWrapper>
170
+ <S.Footer>
171
+ <Button className="button" type="button" onClick={editButton.action}>
172
+ {editButton.label}
173
+ </Button>
174
+ </S.Footer>
175
+ </S.Wrapper>
183
176
  </FloatingPanel>
184
177
  );
185
178
  };
@@ -1,5 +1,10 @@
1
1
  import styled from "styled-components";
2
2
 
3
+ const Wrapper = styled.div`
4
+ padding: ${(p) => p.theme.spacing.m};
5
+ height: 100%;
6
+ `;
7
+
3
8
  const Footer = styled.div`
4
9
  position: absolute;
5
10
  bottom: ${(p) => p.theme.spacing.m};
@@ -56,6 +61,7 @@ const ContentWrapper = styled.div`
56
61
  `;
57
62
 
58
63
  export {
64
+ Wrapper,
59
65
  Footer,
60
66
  Divider,
61
67
  Heading,
@@ -90,19 +90,21 @@ const CategoryPanel = (props: IProps): JSX.Element => {
90
90
 
91
91
  return (
92
92
  <FloatingPanel title={title} toggleModal={toggleModal} isOpen={isOpen}>
93
- <div>{flag}</div>
94
- <Form edit={!category.isNew} />
95
- <S.Footer>
96
- {!category.isNew ? (
97
- <Button className="button" type="button" onClick={editButton.action} disabled={editButton.disabled}>
98
- {editButton.label}
99
- </Button>
100
- ) : (
101
- <Button className="button" type="button" onClick={addButton.action} disabled={addButton.disabled}>
102
- {addButton.label}
103
- </Button>
104
- )}
105
- </S.Footer>
93
+ <S.Wrapper>
94
+ <div>{flag}</div>
95
+ <Form edit={!category.isNew} />
96
+ <S.Footer>
97
+ {!category.isNew ? (
98
+ <Button className="button" type="button" onClick={editButton.action} disabled={editButton.disabled}>
99
+ {editButton.label}
100
+ </Button>
101
+ ) : (
102
+ <Button className="button" type="button" onClick={addButton.action} disabled={addButton.disabled}>
103
+ {addButton.label}
104
+ </Button>
105
+ )}
106
+ </S.Footer>
107
+ </S.Wrapper>
106
108
  </FloatingPanel>
107
109
  );
108
110
  };
@@ -1,24 +1,31 @@
1
1
  import styled from "styled-components";
2
2
 
3
- export const Footer = styled.div`
3
+ const Wrapper = styled.div`
4
+ padding: ${(p) => p.theme.spacing.m};
5
+ height: 100%;
6
+ `;
7
+
8
+ const Footer = styled.div`
4
9
  position: absolute;
5
10
  bottom: ${(p) => p.theme.spacing.m};
6
11
  right: ${(p) => p.theme.spacing.m};
7
12
  `;
8
13
 
9
- export const FlagWrapper = styled.div`
14
+ const FlagWrapper = styled.div`
10
15
  display: flex;
11
16
  margin-bottom: ${(p) => p.theme.spacing.xs};
12
17
  `;
13
18
 
14
- export const TranslationText = styled.div`
19
+ const TranslationText = styled.div`
15
20
  ${(p) => p.theme.textStyle.headingXXS};
16
21
  color: ${(p) => p.theme.color.textMediumEmphasis};
17
22
  margin-left: ${(p) => p.theme.spacing.xs};
18
23
  `;
19
24
 
20
- export const Translation = styled.div`
25
+ const Translation = styled.div`
21
26
  ${(p) => p.theme.textStyle.uiL};
22
27
  color: ${(p) => p.theme.color.textHighEmphasis};
23
28
  margin-bottom: ${(p) => p.theme.spacing.s};
24
29
  `;
30
+
31
+ export { Wrapper, Footer, FlagWrapper, TranslationText, Translation }