@griddo/ax 1.75.154 → 1.75.155
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/config/jest/componentsMock.js +5 -0
- package/package.json +2 -2
- package/src/__tests__/components/ConfigPanel/GlobalPageForm/GlobalPageForm.test.tsx +2 -2
- package/src/components/ConfigPanel/GlobalPageForm/index.tsx +82 -11
- package/src/components/Fields/ConditionalField/index.tsx +6 -3
- package/src/components/Fields/RadioGroup/index.tsx +1 -1
- package/src/modules/PageEditor/Editor/index.tsx +3 -2
- package/src/schemas/pages/Page.tsx +58 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@griddo/ax",
|
|
3
3
|
"description": "Griddo Author Experience",
|
|
4
|
-
"version": "1.75.
|
|
4
|
+
"version": "1.75.155",
|
|
5
5
|
"authors": [
|
|
6
6
|
"Álvaro Sánchez' <alvaro.sanches@secuoyas.com>",
|
|
7
7
|
"Carlos Torres <carlos.torres@secuoyas.com>",
|
|
@@ -230,5 +230,5 @@
|
|
|
230
230
|
"publishConfig": {
|
|
231
231
|
"access": "public"
|
|
232
232
|
},
|
|
233
|
-
"gitHead": "
|
|
233
|
+
"gitHead": "b2f238f478cf72c67b50375619d668e0dc149e7e"
|
|
234
234
|
}
|
|
@@ -125,8 +125,8 @@ describe("GlobalPageForm component rendering", () => {
|
|
|
125
125
|
{ store }
|
|
126
126
|
);
|
|
127
127
|
|
|
128
|
-
const
|
|
129
|
-
expect(
|
|
128
|
+
const fieldGroupWrapper = screen.getByTestId("field-group-wrapper");
|
|
129
|
+
expect(fieldGroupWrapper).toBeTruthy();
|
|
130
130
|
});
|
|
131
131
|
});
|
|
132
132
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { themes } from "components";
|
|
2
3
|
|
|
3
4
|
import { Icon, NoteField, Tabs } from "@ax/components";
|
|
4
5
|
import { ISchema } from "@ax/types";
|
|
@@ -32,6 +33,57 @@ const GlobalPageForm = (props: IGlobalPageFormProps): JSX.Element => {
|
|
|
32
33
|
options: { excludeDetailPages: true },
|
|
33
34
|
};
|
|
34
35
|
|
|
36
|
+
const themeField = {
|
|
37
|
+
title: "Page Options",
|
|
38
|
+
type: "FieldGroup",
|
|
39
|
+
key: "pageOptions",
|
|
40
|
+
collapsed: false,
|
|
41
|
+
fields: [
|
|
42
|
+
{
|
|
43
|
+
title: "Theme",
|
|
44
|
+
type: "Select",
|
|
45
|
+
key: "theme",
|
|
46
|
+
options: themes,
|
|
47
|
+
helptext: "It affects the whole page: Header, Content, and footer.",
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
title: "Customize header and footer themes",
|
|
51
|
+
type: "ConditionalField",
|
|
52
|
+
key: "customizeThemes",
|
|
53
|
+
defaultValue: false,
|
|
54
|
+
mandatory: true,
|
|
55
|
+
options: [
|
|
56
|
+
{
|
|
57
|
+
value: true,
|
|
58
|
+
title: "Yes",
|
|
59
|
+
name: "Yes",
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
value: false,
|
|
63
|
+
title: "No",
|
|
64
|
+
name: "No",
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
fields: [
|
|
68
|
+
{
|
|
69
|
+
title: "Header Theme",
|
|
70
|
+
type: "Select",
|
|
71
|
+
key: "headerTheme",
|
|
72
|
+
options: themes,
|
|
73
|
+
condition: true,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
title: "Footer Theme",
|
|
77
|
+
type: "Select",
|
|
78
|
+
key: "footerTheme",
|
|
79
|
+
options: themes,
|
|
80
|
+
condition: true,
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
|
+
};
|
|
86
|
+
|
|
35
87
|
const handleRestoreHeader = () =>
|
|
36
88
|
actions.restorePageNavigationAction && actions.restorePageNavigationAction("header");
|
|
37
89
|
|
|
@@ -46,12 +98,20 @@ const GlobalPageForm = (props: IGlobalPageFormProps): JSX.Element => {
|
|
|
46
98
|
</S.NoteWrapper>
|
|
47
99
|
{selectedTab === "content" && header === 0 && (
|
|
48
100
|
<S.FieldWrapper>
|
|
49
|
-
This page doesn't have a header. Click
|
|
101
|
+
This page doesn't have a header. Click{" "}
|
|
102
|
+
<S.Link data-testid="header-link" onClick={handleRestoreHeader}>
|
|
103
|
+
here
|
|
104
|
+
</S.Link>{" "}
|
|
105
|
+
to restore it.
|
|
50
106
|
</S.FieldWrapper>
|
|
51
107
|
)}
|
|
52
108
|
{selectedTab === "content" && footer === 0 && (
|
|
53
109
|
<S.FieldWrapper>
|
|
54
|
-
This page doesn't have a footer. Click
|
|
110
|
+
This page doesn't have a footer. Click{" "}
|
|
111
|
+
<S.Link data-testid="footer-link" onClick={handleRestoreFooter}>
|
|
112
|
+
here
|
|
113
|
+
</S.Link>{" "}
|
|
114
|
+
to restore it.
|
|
55
115
|
</S.FieldWrapper>
|
|
56
116
|
)}
|
|
57
117
|
{selectedTab === "content" && (
|
|
@@ -66,15 +126,26 @@ const GlobalPageForm = (props: IGlobalPageFormProps): JSX.Element => {
|
|
|
66
126
|
</S.DataWrapper>
|
|
67
127
|
)}
|
|
68
128
|
{selectedTab === "config" && (
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
129
|
+
<>
|
|
130
|
+
<ConnectedField
|
|
131
|
+
selectedTab={selectedTab}
|
|
132
|
+
key="parent"
|
|
133
|
+
objKey="parent"
|
|
134
|
+
field={field}
|
|
135
|
+
componentType={schema.schemaType}
|
|
136
|
+
isPage={true}
|
|
137
|
+
isGlobal={true}
|
|
138
|
+
/>
|
|
139
|
+
<ConnectedField
|
|
140
|
+
selectedTab={selectedTab}
|
|
141
|
+
key="pageOptions"
|
|
142
|
+
objKey="pageOptions"
|
|
143
|
+
field={themeField}
|
|
144
|
+
componentType={schema.schemaType}
|
|
145
|
+
isPage={true}
|
|
146
|
+
isGlobal={true}
|
|
147
|
+
/>
|
|
148
|
+
</>
|
|
78
149
|
)}
|
|
79
150
|
</section>
|
|
80
151
|
);
|
|
@@ -4,13 +4,15 @@ import { RadioGroup } from "@ax/components";
|
|
|
4
4
|
import * as S from "./style";
|
|
5
5
|
|
|
6
6
|
const ConditionalField = (props: IConditionalFieldProps) => {
|
|
7
|
-
const { value, options, innerFields, onChange } = props;
|
|
7
|
+
const { value, options, innerFields, onChange, defaultValue } = props;
|
|
8
|
+
|
|
9
|
+
const safeValue = value === undefined ? defaultValue : value;
|
|
8
10
|
|
|
9
11
|
const handleChange = (newValue: any) => onChange(newValue);
|
|
10
12
|
|
|
11
13
|
return (
|
|
12
14
|
<S.Wrapper>
|
|
13
|
-
<RadioGroup name="radio" value={
|
|
15
|
+
<RadioGroup name="radio" value={safeValue} options={options} onChange={handleChange} />
|
|
14
16
|
<S.Content data-testid="conditionalFieldContent">
|
|
15
17
|
{innerFields &&
|
|
16
18
|
innerFields.map((item: any) => {
|
|
@@ -24,8 +26,9 @@ const ConditionalField = (props: IConditionalFieldProps) => {
|
|
|
24
26
|
export default ConditionalField;
|
|
25
27
|
|
|
26
28
|
interface IConditionalFieldProps {
|
|
27
|
-
value
|
|
29
|
+
value?: string | boolean;
|
|
28
30
|
options: any[];
|
|
29
31
|
innerFields: any;
|
|
30
32
|
onChange: (value: any) => void;
|
|
33
|
+
defaultValue?: string | boolean;
|
|
31
34
|
}
|
|
@@ -43,7 +43,7 @@ const RadioGroup = (props: IRadioGroupProps): JSX.Element => {
|
|
|
43
43
|
|
|
44
44
|
interface IRadioGroupProps {
|
|
45
45
|
name: string;
|
|
46
|
-
value
|
|
46
|
+
value?: string | boolean;
|
|
47
47
|
options: IRadioFieldProps[];
|
|
48
48
|
error?: boolean;
|
|
49
49
|
onChange: (value: string | boolean) => void;
|
|
@@ -44,7 +44,8 @@ const Editor = (props: IProps) => {
|
|
|
44
44
|
content,
|
|
45
45
|
} = props;
|
|
46
46
|
|
|
47
|
-
const { header, footer } = content;
|
|
47
|
+
const { header, footer, theme: pageTheme } = content;
|
|
48
|
+
const { theme: siteTheme } = site;
|
|
48
49
|
|
|
49
50
|
const actions = {
|
|
50
51
|
deleteModuleAction: deleteModule,
|
|
@@ -85,7 +86,7 @@ const Editor = (props: IProps) => {
|
|
|
85
86
|
setHistoryPush={setHistoryPush}
|
|
86
87
|
isReadOnly={isReadOnly}
|
|
87
88
|
userEditing={userEditing}
|
|
88
|
-
theme={
|
|
89
|
+
theme={pageTheme ? pageTheme : siteTheme}
|
|
89
90
|
lastElementAddedId={lastElementAddedId}
|
|
90
91
|
header={header}
|
|
91
92
|
footer={footer}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { themes } from "components";
|
|
2
|
+
|
|
1
3
|
export default {
|
|
2
4
|
schemaType: "page",
|
|
3
5
|
displayName: "Page",
|
|
@@ -48,6 +50,56 @@ export default {
|
|
|
48
50
|
key: "template",
|
|
49
51
|
type: "template",
|
|
50
52
|
},
|
|
53
|
+
{
|
|
54
|
+
title: "Page Options",
|
|
55
|
+
type: "FieldGroup",
|
|
56
|
+
key: "pageOptions",
|
|
57
|
+
collapsed: false,
|
|
58
|
+
fields: [
|
|
59
|
+
{
|
|
60
|
+
title: "Theme",
|
|
61
|
+
type: "Select",
|
|
62
|
+
key: "theme",
|
|
63
|
+
options: themes,
|
|
64
|
+
helptext: "It affects the whole page: Header, Content, and footer.",
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
title: "Customize header and footer themes",
|
|
68
|
+
type: "ConditionalField",
|
|
69
|
+
key: "customizeThemes",
|
|
70
|
+
mandatory: true,
|
|
71
|
+
defaultValue: false,
|
|
72
|
+
options: [
|
|
73
|
+
{
|
|
74
|
+
value: true,
|
|
75
|
+
title: "Yes",
|
|
76
|
+
name: "Yes",
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
value: false,
|
|
80
|
+
title: "No",
|
|
81
|
+
name: "No",
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
fields: [
|
|
85
|
+
{
|
|
86
|
+
title: "Header Theme",
|
|
87
|
+
type: "Select",
|
|
88
|
+
key: "headerTheme",
|
|
89
|
+
options: themes,
|
|
90
|
+
condition: true,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
title: "Footer Theme",
|
|
94
|
+
type: "Select",
|
|
95
|
+
key: "footerTheme",
|
|
96
|
+
options: themes,
|
|
97
|
+
condition: true,
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
},
|
|
51
103
|
],
|
|
52
104
|
},
|
|
53
105
|
{
|
|
@@ -152,8 +204,8 @@ export default {
|
|
|
152
204
|
type: "AnalyticsField",
|
|
153
205
|
key: "dimensions",
|
|
154
206
|
collapsed: true,
|
|
155
|
-
}
|
|
156
|
-
]
|
|
207
|
+
},
|
|
208
|
+
],
|
|
157
209
|
},
|
|
158
210
|
{
|
|
159
211
|
title: "Social Media",
|
|
@@ -200,5 +252,9 @@ export default {
|
|
|
200
252
|
socialDescription: "",
|
|
201
253
|
socialImage: {},
|
|
202
254
|
dimensions: {},
|
|
255
|
+
theme: null,
|
|
256
|
+
customizeThemes: false,
|
|
257
|
+
headerTheme: null,
|
|
258
|
+
footerTheme: null,
|
|
203
259
|
},
|
|
204
260
|
};
|