From 5b5e7cf0fb311e0a02e5758f40a2f58e90bf6233 Mon Sep 17 00:00:00 2001 From: Bogdan Preda Date: Tue, 6 Feb 2024 14:31:35 +0200 Subject: [PATCH 1/3] feat: added scroll to top cta Codeinwp/neve-pro-addon#2734 --- assets/customizer/css/upsells.css | 14 + inc/customizer/controls/simple_upsell.php | 23 +- .../upsells/scroll_to_top_control.php | 500 ++++++++++++++++++ inc/customizer/options/main.php | 1 + inc/customizer/options/upsells.php | 42 ++ 5 files changed, 578 insertions(+), 2 deletions(-) create mode 100644 inc/customizer/controls/upsells/scroll_to_top_control.php diff --git a/assets/customizer/css/upsells.css b/assets/customizer/css/upsells.css index 6ee8971ede..e5a8c91072 100644 --- a/assets/customizer/css/upsells.css +++ b/assets/customizer/css/upsells.css @@ -80,6 +80,20 @@ padding-top: 10px; align-items: center; } +.nv-simple-upsell.column-layout { + flex-direction: column; + align-items: start; + gap: 16px; + border-bottom: 1px solid #ccc; + border-top: none; + padding-bottom: 12px; +} + +.nv-simple-upsell.column-layout p { + font-size: 13px; + font-weight: normal; +} + .nv-simple-upsell p { margin: 0 10px 0 0; font-weight: 600; diff --git a/inc/customizer/controls/simple_upsell.php b/inc/customizer/controls/simple_upsell.php index 17b3a8ac6d..5a8a2e3f7c 100644 --- a/inc/customizer/controls/simple_upsell.php +++ b/inc/customizer/controls/simple_upsell.php @@ -47,19 +47,38 @@ class Simple_Upsell extends \WP_Customize_Control { */ public $text = ''; + /** + * Additional CSS class. + * + * @since 3.8.0 + * @var string + */ + public $class = ''; + + /** + * Use primary button class. + * + * @since 3.8.0 + * @var string + */ + public $use_primary = ''; + /** * Render Method * * @return void */ public function render_content() { + $base_class = 'nv-simple-upsell'; + $class = ( ! empty( $this->class ) ) ? $base_class . ' ' . $this->class : $base_class; + $button_class = ( ! empty( $this->use_primary ) ) ? 'button-primary' : 'button-secondary'; ?> -
+
text ) ) { ?>

text ); ?>

link ) && ! empty( $this->button_text ) ) { ?> - + button_text ); ?> diff --git a/inc/customizer/controls/upsells/scroll_to_top_control.php b/inc/customizer/controls/upsells/scroll_to_top_control.php new file mode 100644 index 0000000000..145a350813 --- /dev/null +++ b/inc/customizer/controls/upsells/scroll_to_top_control.php @@ -0,0 +1,500 @@ + + + +SVG; + ?> + +
+
+
+
+ + +
+
+
+
+
+
+ General + +
+
+
+ + +
+
+ + +
+
+ Scroll to Top Icon +
+ + + + + + + + + + + + + + + +
+
+
+ + +
+ +
+
+ Offset (px) +
+
+
+
+
+
+ + + + + +
+
+
+
+
+ + +
+
+
+
+ + +
+
+
+
+
+
+
+ +
+
+
+
+ + +
+
+
+
+ +
+
+ Style + +
+
+
+
+ Padding +
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+ + +
+
+ + +
+
+ + +
+ + +
+
+
+
+
Icon Size +
+
+
+ + + +
+
+
+
+ + + +
+
+
+
+
+
+
+ + + + + +
+
+
+
+
+ +
+
+
+
+ + + +
+
+
+
+
+
+
+ Border Radius +
+
+
+
+
+
+ + + + + +
+
+
+
+
+ +
+
+
+
+ + + +
+
+
+
+
+
+
+ +
+
+ Colors + +
+ +
+
+
+ Color +
+ +
+
+ +
+
+
+
+
+ Hover Color +
+ +
+
+ +
+
+
+
+
+ Background Color +
+ +
+
+ +
+
+
+
+
+ Background Hover Color +
+ +
+
+ +
+
+
+
+
+ register_type( 'Neve\Customizer\Controls\Heading', 'control' ); $this->register_type( 'Neve\Customizer\Controls\Checkbox', 'control' ); $this->register_type( 'Neve\Customizer\Controls\Upsell_Control', 'control' ); + $this->register_type( 'Neve\Customizer\Controls\Upsells\Scroll_To_Top_Control', 'control' ); } /** diff --git a/inc/customizer/options/upsells.php b/inc/customizer/options/upsells.php index 2b5aaa31c5..29b97e2883 100644 --- a/inc/customizer/options/upsells.php +++ b/inc/customizer/options/upsells.php @@ -417,6 +417,17 @@ private function section_upsells() { 'Neve\Customizer\Controls\React\Upsell_Section' ) ); + + $this->add_section( + new Section( + 'neve_scroll_to_top_upsell', + array( + 'priority' => 80, + 'title' => esc_html__( 'Scroll To Top', 'neve' ), + 'panel' => 'neve_layout', + ) + ) + ); } /** @@ -438,6 +449,37 @@ private function control_upsells() { ) ); + + $this->add_control( + new Control( + 'neve_scroll_to_top_cta_control', + [ 'sanitize_callback' => 'sanitize_text_field' ], + [ + /* translators: Module name for the upsell. */ + 'text' => sprintf( __( 'Unlock %s with the Pro version.', 'neve' ), __( 'Scroll To Top', 'neve' ) ), + 'button_text' => esc_html__( 'Get the PRO version!', 'neve' ), + 'section' => 'neve_scroll_to_top_upsell', + 'priority' => PHP_INT_MIN, + 'link' => $this->upsell_url, + 'class' => 'column-layout', + 'use_primary' => 'true', + ], + 'Neve\Customizer\Controls\Simple_Upsell' + ) + ); + + $this->add_control( + new Control( + 'neve_scroll_to_top_upsell_control', + [ 'sanitize_callback' => 'sanitize_text_field' ], + [ + 'section' => 'neve_scroll_to_top_upsell', + 'priority' => 2, + ], + 'Neve\Customizer\Controls\Upsells\Scroll_To_Top_Control' + ) + ); + $upsells = []; $upsells_banners = []; From bd22c9622780bab8e2b5e4b3b30e0dbd8ad9b39b Mon Sep 17 00:00:00 2001 From: "Soare Robert Daniel (Mac 2023)" Date: Wed, 31 Jan 2024 16:27:59 +0200 Subject: [PATCH 2/3] chore: update post content order (cherry picked from commit 4ed190239f5d4756fb6272a852a5ce31273a9120) --- .../specs/customizer/layout/blog-archive-settings.spec.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/e2e-tests/specs/customizer/layout/blog-archive-settings.spec.ts b/e2e-tests/specs/customizer/layout/blog-archive-settings.spec.ts index cd2cb4dd59..207c9526dc 100755 --- a/e2e-tests/specs/customizer/layout/blog-archive-settings.spec.ts +++ b/e2e-tests/specs/customizer/layout/blog-archive-settings.spec.ts @@ -23,7 +23,13 @@ test.describe('Blog/Archive 1 / Default Layout', () => { } }); - test('Post Content Order', async ({ page }) => { + test('Post Content Order', async ({ page, request, baseURL }) => { + // Make sure the default layout is set. + await setCustomizeSettings('defaultLayout', data.archive1, { + request, + baseURL, + }); + await page.goto('/?test_name=defaultLayout'); const posts = await page.locator('article.post'); From f307dbbb1d9f15fc48ba465123b0dd7a20cc6bb4 Mon Sep 17 00:00:00 2001 From: Bogdan Preda Date: Thu, 8 Feb 2024 09:20:49 +0200 Subject: [PATCH 3/3] chore: typo in css --- inc/customizer/controls/upsells/scroll_to_top_control.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/inc/customizer/controls/upsells/scroll_to_top_control.php b/inc/customizer/controls/upsells/scroll_to_top_control.php index 145a350813..44fbe176dc 100644 --- a/inc/customizer/controls/upsells/scroll_to_top_control.php +++ b/inc/customizer/controls/upsells/scroll_to_top_control.php @@ -82,7 +82,7 @@ public function content_template() { min-height: 30px; gap: 16px; } - .customize-control-neve-scroll-to-top-upselll .components-range-control__wrapper { + .customize-control-neve-scroll-to-top-upsell .components-range-control__wrapper { display: block; flex: 1 1 0%; position: relative;