Skip to content

Commit af90b12

Browse files
feat: add HFB Pro components in Inserter (#4454)
This PR adds all the available Header/Footer elements to appear in the pro-upsell and search to for better discoverability of the elements.
1 parent a5fd9b1 commit af90b12

3 files changed

Lines changed: 54 additions & 3 deletions

File tree

assets/apps/customizer-controls/src/builder/components/ComponentsPopover.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ const ComponentsPopover: React.FC<Props> = ({
8080
});
8181
};
8282

83+
const getFilteredUpsells = () => {
84+
if (!searchQuery) {
85+
return upsells;
86+
}
87+
88+
return upsells.filter(({ name }) => {
89+
return name.toLowerCase().includes(searchQuery);
90+
});
91+
};
92+
8393
const renderItem = (item: ItemInterface, idx: number) => {
8494
if (!item.id) {
8595
return null;
@@ -113,10 +123,15 @@ const ComponentsPopover: React.FC<Props> = ({
113123
const renderItems = () => {
114124
const themeItems = getSidebarItems();
115125
const boosterItems = getSidebarItems(true);
126+
const filteredUpsells = getFilteredUpsells();
116127

117128
let noComponents = null;
118129

119-
if (themeItems.length === 0 && boosterItems.length === 0) {
130+
if (
131+
themeItems.length === 0 &&
132+
boosterItems.length === 0 &&
133+
filteredUpsells.length === 0
134+
) {
120135
noComponents = (
121136
<div className="no-components">
122137
<span>
@@ -156,13 +171,13 @@ const ComponentsPopover: React.FC<Props> = ({
156171
)}
157172
</>
158173
)}
159-
{boosterItems.length < 1 && upsells.length > 0 && (
174+
{boosterItems.length < 1 && filteredUpsells.length > 0 && (
160175
<>
161176
<h4>
162177
{__('PRO', 'neve')} {__('Components', 'neve')}
163178
</h4>
164179
<div className="items-popover-list upsell-list">
165-
{upsells.map(({ name, icon }, idx) => {
180+
{filteredUpsells.map(({ name, icon }, idx) => {
166181
return renderUpsell(idx, icon, name);
167182
})}
168183
</div>

header-footer-grid/Core/Builder/Footer.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -318,6 +318,18 @@ protected function get_upsell_components() {
318318
'icon' => 'images-alt',
319319
'name' => __( 'Payment icons', 'neve' ),
320320
],
321+
[
322+
'icon' => 'nametag',
323+
'name' => __( 'Copyright', 'neve' ),
324+
],
325+
[
326+
'icon' => 'embed-generic',
327+
'name' => __( 'Custom Layouts', 'neve' ),
328+
],
329+
[
330+
'icon' => 'welcome-widgets-menus',
331+
'name' => __( 'Widget Area', 'neve' ),
332+
],
321333
[
322334
'icon' => 'share',
323335
'name' => __( 'Social Icons', 'neve' ),

header-footer-grid/Core/Builder/Header.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -548,6 +548,14 @@ protected function get_upsell_components() {
548548
}
549549

550550
return [
551+
[
552+
'icon' => 'code-standards',
553+
'name' => __( 'Search Form', 'neve' ),
554+
],
555+
[
556+
'icon' => 'email',
557+
'name' => __( 'Contact', 'neve' ),
558+
],
551559
[
552560
'icon' => 'welcome-write-blog',
553561
'name' => __( 'HTML', 'neve' ) . ' 2',
@@ -556,10 +564,26 @@ protected function get_upsell_components() {
556564
'icon' => 'embed-generic',
557565
'name' => __( 'Custom Layouts', 'neve' ),
558566
],
567+
[
568+
'icon' => 'minus',
569+
'name' => __( 'Divider element', 'neve' ),
570+
],
559571
[
560572
'icon' => 'share',
561573
'name' => __( 'Social Icons', 'neve' ),
562574
],
575+
[
576+
'icon' => 'menu',
577+
'name' => __( 'Primary Menu', 'neve' ),
578+
],
579+
[
580+
'icon' => 'admin-links',
581+
'name' => __( 'Button', 'neve' ),
582+
],
583+
[
584+
'icon' => 'welcome-widgets-menus',
585+
'name' => __( 'Widget Area', 'neve' ),
586+
],
563587
];
564588
}
565589

0 commit comments

Comments
 (0)