@secretstache/wordpress-gutenberg 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- package/build/index.js +3 -3
- package/build/index.js.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useDataQuery.js +3 -0
- package/src/utils/attributes.js +26 -12
package/package.json
CHANGED
@@ -37,9 +37,12 @@ export const useDataQuery = (props) => {
|
|
37
37
|
const isResolving = select('core/data').isResolving('core', 'getEntityRecords', ['postType', postType, queryArgs]);
|
38
38
|
const isLoading = isResolving || postsToShow === undefined;
|
39
39
|
|
40
|
+
const isEmpty = postsToShow !== null && postsToShow?.length === 0;
|
41
|
+
|
40
42
|
return {
|
41
43
|
postsToShow,
|
42
44
|
isLoading,
|
45
|
+
isEmpty,
|
43
46
|
};
|
44
47
|
}, dependencies);
|
45
48
|
}
|
package/src/utils/attributes.js
CHANGED
@@ -135,21 +135,38 @@ export const getDataQueryAttributes = (
|
|
135
135
|
/**
|
136
136
|
* Returns the base background attribute object with configurable default background color and media type.
|
137
137
|
*
|
138
|
-
* @param {
|
139
|
-
* @param {
|
140
|
-
* @param {
|
141
|
-
* @param {string} defaultBackgroundColor.
|
138
|
+
* @param {Object} options - The options for configuring the background attributes.
|
139
|
+
* @param {string} [options.defaultBackgroundMediaType=''] - The default background media type.
|
140
|
+
* @param {Object} options.defaultBackgroundColor - The background color configuration.
|
141
|
+
* @param {string} options.defaultBackgroundColor.value - The hex value of the background color.
|
142
|
+
* @param {string} options.defaultBackgroundColor.slug - The slug of the background color.
|
143
|
+
* @param {boolean} [options.hasIncludeBackgroundMediaAttribute=false] - Whether to include the background media attribute.
|
144
|
+
* @param {boolean} [options.hasIncludeOverlayAttribute=false] - Whether to include the overlay attribute.
|
142
145
|
* @returns {Object} The base background attribute object.
|
143
146
|
*/
|
144
|
-
export const getBaseBackgroundAttributes = (
|
147
|
+
export const getBaseBackgroundAttributes = ({
|
145
148
|
defaultBackgroundMediaType = '',
|
146
149
|
defaultBackgroundColor = { value: '', slug: '' },
|
147
|
-
|
148
|
-
|
150
|
+
hasIncludeBackgroundMediaAttribute = false,
|
151
|
+
hasIncludeOverlayAttribute = false,
|
152
|
+
} = {}) => {
|
153
|
+
const isIncludeOverlayAttribute = {
|
154
|
+
isIncludeOverlay: {
|
155
|
+
type: 'boolean',
|
156
|
+
default: false,
|
157
|
+
}
|
158
|
+
};
|
159
|
+
|
160
|
+
const isIncludeBackgroundMediaAttribute = {
|
149
161
|
isIncludeBackgroundMedia: {
|
150
162
|
type: 'boolean',
|
151
163
|
default: false,
|
152
|
-
}
|
164
|
+
}
|
165
|
+
};
|
166
|
+
|
167
|
+
return {
|
168
|
+
...(hasIncludeBackgroundMediaAttribute ? isIncludeBackgroundMediaAttribute : {}),
|
169
|
+
|
153
170
|
backgroundMediaType: {
|
154
171
|
type: 'string',
|
155
172
|
default: defaultBackgroundMediaType,
|
@@ -161,10 +178,7 @@ export const getBaseBackgroundAttributes = (
|
|
161
178
|
|
162
179
|
...mediaAttribute,
|
163
180
|
|
164
|
-
|
165
|
-
type: 'boolean',
|
166
|
-
default: false,
|
167
|
-
},
|
181
|
+
...(hasIncludeOverlayAttribute ? isIncludeOverlayAttribute : {}),
|
168
182
|
};
|
169
183
|
};
|
170
184
|
|