Skip to content

Commit

Permalink
Remove active category title
Browse files Browse the repository at this point in the history
  • Loading branch information
zlateska committed Jul 23, 2024
1 parent e19f55e commit 40531b3
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 128 deletions.
2 changes: 1 addition & 1 deletion build/2.1.0/wonder-blocks.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-primitives', 'wp-url'), 'version' => 'bcc3d7d38da9cdb8b305');
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-dom-ready', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-notices', 'wp-plugins', 'wp-primitives', 'wp-url'), 'version' => 'b4ea59da18494685718e');
88 changes: 13 additions & 75 deletions build/2.1.0/wonder-blocks.js
Original file line number Diff line number Diff line change
Expand Up @@ -3413,22 +3413,21 @@ __webpack_require__.r(__webpack_exports__);
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var react_intersection_observer__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! react-intersection-observer */ "./node_modules/react-intersection-observer/index.mjs");
/* harmony import */ var react_intersection_observer__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! react-intersection-observer */ "./node_modules/react-intersection-observer/index.mjs");
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/data */ "@wordpress/data");
/* harmony import */ var _wordpress_data__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_data__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _helpers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../helpers */ "./src/helpers/index.js");
/* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../../hooks */ "./src/hooks/index.js");
/* harmony import */ var _store__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../../store */ "./src/store/index.js");
/* harmony import */ var _ContentTitle__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./ContentTitle */ "./src/components/Modal/Content/ContentTitle.jsx");
/* harmony import */ var _DesignList_DesignList__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./DesignList/DesignList */ "./src/components/Modal/Content/DesignList/DesignList.jsx");
/* harmony import */ var _DesignList_Error__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./DesignList/Error */ "./src/components/Modal/Content/DesignList/Error.jsx");
/* harmony import */ var _DesignList_NoResults__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./DesignList/NoResults */ "./src/components/Modal/Content/DesignList/NoResults.jsx");
/* harmony import */ var _LoadingSpinner__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./LoadingSpinner */ "./src/components/Modal/Content/LoadingSpinner.jsx");
/* harmony import */ var _Skeleton__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Skeleton */ "./src/components/Modal/Content/Skeleton.jsx");
/* harmony import */ var _Spinner__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./Spinner */ "./src/components/Modal/Content/Spinner.jsx");
/* harmony import */ var _UpdateNotice__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./UpdateNotice */ "./src/components/Modal/Content/UpdateNotice.jsx");
/* harmony import */ var _DesignList_DesignList__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./DesignList/DesignList */ "./src/components/Modal/Content/DesignList/DesignList.jsx");
/* harmony import */ var _DesignList_Error__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./DesignList/Error */ "./src/components/Modal/Content/DesignList/Error.jsx");
/* harmony import */ var _DesignList_NoResults__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./DesignList/NoResults */ "./src/components/Modal/Content/DesignList/NoResults.jsx");
/* harmony import */ var _LoadingSpinner__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./LoadingSpinner */ "./src/components/Modal/Content/LoadingSpinner.jsx");
/* harmony import */ var _Skeleton__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./Skeleton */ "./src/components/Modal/Content/Skeleton.jsx");
/* harmony import */ var _Spinner__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./Spinner */ "./src/components/Modal/Content/Spinner.jsx");
/* harmony import */ var _UpdateNotice__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./UpdateNotice */ "./src/components/Modal/Content/UpdateNotice.jsx");

/**
* External dependencies
Expand All @@ -3454,10 +3453,9 @@ __webpack_require__.r(__webpack_exports__);




const Content = () => {
const [ready, setReady] = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_2__.useState)(false);
const [loadMoreRef, inView] = (0,react_intersection_observer__WEBPACK_IMPORTED_MODULE_14__.useInView)({
const [loadMoreRef, inView] = (0,react_intersection_observer__WEBPACK_IMPORTED_MODULE_13__.useInView)({
threshold: 0
});
const {
Expand Down Expand Up @@ -3537,83 +3535,23 @@ const Content = () => {
className: "nfd-wba-flex nfd-wba-grow nfd-wba-flex-col sm:nfd-wba-overflow-y-auto md:nfd-wba-min-w-[400px]"
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
className: "nfd-wba-relative nfd-wba-flex nfd-wba-min-h-[50vh] nfd-wba-grow nfd-wba-flex-col nfd-wba-gap-y-10"
}, isSidebarLoading && !isError && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_LoadingSpinner__WEBPACK_IMPORTED_MODULE_10__["default"], null), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
}, isSidebarLoading && !isError && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_LoadingSpinner__WEBPACK_IMPORTED_MODULE_9__["default"], null), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
className: "nfd-wba-inset-0 nfd-wba-flex nfd-wba-grow nfd-wba-flex-col nfd-wba-px-4 nfd-wba-py-8 sm:nfd-wba-px-6"
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_UpdateNotice__WEBPACK_IMPORTED_MODULE_13__["default"], null), (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_ContentTitle__WEBPACK_IMPORTED_MODULE_6__["default"], {
activeTab: activeTab,
title: keywordsFilter,
currentCategory: activeTab === "patterns" ? activePatternsCategory : activeTemplatesCategory
}), !isSidebarLoading && isContentLoading && !isError || !ready && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_Skeleton__WEBPACK_IMPORTED_MODULE_11__["default"], null), isError && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_DesignList_Error__WEBPACK_IMPORTED_MODULE_8__["default"], null), data?.length === 0 && !isError && !isValidating && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_DesignList_NoResults__WEBPACK_IMPORTED_MODULE_9__["default"], {
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_UpdateNotice__WEBPACK_IMPORTED_MODULE_12__["default"], null), !isSidebarLoading && isContentLoading && !isError || !ready && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_Skeleton__WEBPACK_IMPORTED_MODULE_10__["default"], null), isError && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_DesignList_Error__WEBPACK_IMPORTED_MODULE_7__["default"], null), data?.length === 0 && !isError && !isValidating && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_DesignList_NoResults__WEBPACK_IMPORTED_MODULE_8__["default"], {
isFavorites: isFavorites
}), ready && data && data?.length > 0 && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_DesignList_DesignList__WEBPACK_IMPORTED_MODULE_7__["default"], {
}), ready && data && data?.length > 0 && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(react__WEBPACK_IMPORTED_MODULE_0__.Fragment, null, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_DesignList_DesignList__WEBPACK_IMPORTED_MODULE_6__["default"], {
data: data
}), hasMore && (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("div", {
className: "nfd-wba-z-[2] nfd-wba-flex nfd-wba-flex-col nfd-wba-items-center nfd-wba-justify-center nfd-wba-gap-y-6 nfd-wba-bg-white nfd-wba-px-6 nfd-wba-pt-6",
ref: loadMoreRef
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_Spinner__WEBPACK_IMPORTED_MODULE_12__["default"], {
}, (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)(_Spinner__WEBPACK_IMPORTED_MODULE_11__["default"], {
size: 40
}))))));
};
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Content);

/***/ }),

/***/ "./src/components/Modal/Content/ContentTitle.jsx":
/*!*******************************************************!*\
!*** ./src/components/Modal/Content/ContentTitle.jsx ***!
\*******************************************************/
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {

"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ "react");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/element */ "@wordpress/element");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @wordpress/i18n */ "@wordpress/i18n");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _hooks__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../hooks */ "./src/hooks/index.js");

/**
* WordPress dependencies
*/



/**
* Internal dependencies
*/

const ContentTitle = ({
activeTab,
currentCategory,
title
}) => {
// Fetch data.
const {
data,
error
} = (0,_hooks__WEBPACK_IMPORTED_MODULE_3__.useCategories)(activeTab);
const activeCategory = (0,_wordpress_element__WEBPACK_IMPORTED_MODULE_1__.useMemo)(() => data?.find(cat => cat.title === currentCategory), [data, currentCategory]);
if (error || !data) {
return null;
}
if (!activeCategory?.label && !title && currentCategory !== "favorites") {
return null;
}
return (0,react__WEBPACK_IMPORTED_MODULE_0__.createElement)("h1", {
className: "nfd-wba-my-0 nfd-wba-mb-8 nfd-wba-text-[26px] nfd-wba-font-light nfd-wba-text-dark"
}, !title && currentCategory === "favorites" && (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)("Favorites", "nfd-wonder-blocks"), title && (0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.sprintf)(
// translators: %s: search keywords.
(0,_wordpress_i18n__WEBPACK_IMPORTED_MODULE_2__.__)("Results for %s", "nfd-wonder-blocks"), title), !title && activeCategory?.label);
};
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ContentTitle);

/***/ }),

/***/ "./src/components/Modal/Content/DesignList/DesignItem.jsx":
/*!****************************************************************!*\
!*** ./src/components/Modal/Content/DesignList/DesignItem.jsx ***!
Expand Down
2 changes: 1 addition & 1 deletion build/2.1.0/wonder-blocks.js.map

Large diffs are not rendered by default.

8 changes: 0 additions & 8 deletions src/components/Modal/Content/Content.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import { trackHiiveEvent } from "../../../helpers";
import { usePatterns } from "../../../hooks";
import { store as nfdPatternsStore } from "../../../store";

import ContentTitle from "./ContentTitle";
import DesignList from "./DesignList/DesignList";
import Error from "./DesignList/Error";
import NoResults from "./DesignList/NoResults";
Expand Down Expand Up @@ -107,13 +106,6 @@ const Content = () => {

<div className="nfd-wba-inset-0 nfd-wba-flex nfd-wba-grow nfd-wba-flex-col nfd-wba-px-4 nfd-wba-py-8 sm:nfd-wba-px-6">
<UpdateNotice />
<ContentTitle
activeTab={activeTab}
title={keywordsFilter}
currentCategory={
activeTab === "patterns" ? activePatternsCategory : activeTemplatesCategory
}
/>

{(!isSidebarLoading && isContentLoading && !isError) || (!ready && <Skeleton />)}

Expand Down
43 changes: 0 additions & 43 deletions src/components/Modal/Content/ContentTitle.jsx

This file was deleted.

0 comments on commit 40531b3

Please sign in to comment.