Skip to content

Commit

Permalink
Merge pull request #4193 from Codeinwp/new/next
Browse files Browse the repository at this point in the history
New/next
  • Loading branch information
preda-bogdan authored Jan 25, 2024
2 parents ce331a0 + 37404ab commit 78e581f
Show file tree
Hide file tree
Showing 17 changed files with 113 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
SelectControl,
TextControl,
ToggleControl,
TextareaControl,
} from '@wordpress/components';
import IconSelector from './IconSelector';
import { getIcons, ColorControl } from '@neve-wp/components';
Expand Down Expand Up @@ -74,6 +75,15 @@ const RepeaterItemContent = ({
key={key + index}
/>
);
case 'textarea':
return (
<TextareaControl
label={currentField.label}
value={value[index][key] || currentField.default}
onChange={(newData) => changeContent(key, newData)}
key={key + index}
/>
);
case 'icon':
return (
<IconSelector
Expand Down
2 changes: 1 addition & 1 deletion bin/envs/woo-sample/start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ wp --allow-root import ./themeunittestdata.wordpress.xml --authors=skip --skip=

#Setup content for woo
curl -O https://raw.githubusercontent.com/woocommerce/woocommerce/master/sample-data/sample_products.xml
wp --allow-root import ./sample_products.xml --authors=skip --skip=image_resize
wp --allow-root import ./sample_products.xml --authors=skip --skip=image_resize
6 changes: 4 additions & 2 deletions e2e-tests/specs/visual-regression/starter-sites.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ test.describe('Starter sites check', () => {
for (const [name, urls] of Object.entries(starterSites)) {
await test.step(`Check ${name} starter site.`, async () => {
for (const url of urls) {
await page.goto(url + '?optml_off=true');
await page.goto(url + '?optml_off=true&onboarding=true');
await page.keyboard.press('End');
await page.evaluate(() => window.scrollTo(0, 0));
await page.waitForTimeout(500);
await expect(page).toHaveScreenshot({
maxDiffPixelRatio: 0.15,
maxDiffPixelRatio: 0.18,
fullPage: true,
});
}
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
21 changes: 14 additions & 7 deletions globals/utilities.php
Original file line number Diff line number Diff line change
Expand Up @@ -281,9 +281,13 @@ function neve_get_svg_allowed_tags() {
'type' => true,
),
'g' => array(
'fill' => true,
'transform' => true,
'style' => true,
'fill' => true,
'transform' => true,
'style' => true,
'stroke' => true,
'stroke-linecap' => true,
'stroke-linejoin' => true,
'stroke-width' => true,
),
'circle' => array(
'cx' => true,
Expand All @@ -302,15 +306,18 @@ function neve_get_svg_allowed_tags() {
'style' => true,
'class' => true,
'transform' => true,
'stroke' => true,
'stroke-linecap' => true,
'stroke-linejoin' => true,
'stroke-width' => true,
),
'polyline' => array(
'fill' => true,
'stroke' => true,
'stroke-width' => true,
'points' => true,
'fill' => true,
'stroke' => true,
'stroke-linecap' => true,
'stroke-linejoin' => true,
'stroke-width' => true,
'points' => true,
),
'polygon' => array(
'class' => true,
Expand Down
54 changes: 52 additions & 2 deletions header-footer-grid/Core/Components/MenuIcon.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ class MenuIcon extends Abstract_Component {
const QUICK_LINKS_ID = 'quick-links';
const LABEL_MARGIN_ID = 'label_margin';
const MENU_ICON = 'menu_icon';
const SIZE_ID = 'icon_size';
const MENU_SVG = 'svg_menu_icon';

/**
* Padding settings default values.
Expand Down Expand Up @@ -205,7 +207,7 @@ public function toggle_style() {
*/
private function get_menu_style( $menu_icon ) {
// We don't add any css for the default option.
if ( ! in_array( $menu_icon, [ 'arrow', 'donner', 'dots', 'minus', 'vortex', 'squeeze' ] ) ) {
if ( ! in_array( $menu_icon, [ 'arrow', 'donner', 'dots', 'minus', 'vortex', 'squeeze', 'svg' ] ) ) {
return '';
}

Expand Down Expand Up @@ -406,7 +408,18 @@ private function get_menu_style( $menu_icon ) {
}
CSS;
}

// SVG style
if ( $menu_icon === 'svg' ) {
$menu_icon_size = Mods::get( $this->get_id() . '_' . self::SIZE_ID, '15' ) . 'px';
$css .= <<<CSS
.hamburger-box.icon-svg {
width: 100%;
height: var(--menuiconsize, $menu_icon_size);
display:flex;
justify-content:center;
}
CSS;
}
// Squeeze style
if ( $menu_icon === 'squeeze' ) {
$css .= <<<CSS
Expand Down Expand Up @@ -547,6 +560,43 @@ public function add_settings() {
]
);

SettingsManager::get_instance()->add(
[
'id' => self::SIZE_ID,
'group' => $this->get_id(),
'tab' => SettingsManager::TAB_STYLE,
'transport' => 'postMessage',
'sanitize_callback' => 'absint',
'default' => 15,
'label' => __( 'Icon Size', 'neve' ),
'type' => 'Neve\Customizer\Controls\React\Range',
'options' => [
'active_callback' => function () {
return Mods::get( $this->get_id() . '_' . self::MENU_ICON, 'default' ) === 'svg';

},
'priority' => 11,
'input_attrs' => [
'min' => 10,
'max' => 100,
'defaultVal' => 15,
],
],
'live_refresh_selector' => $this->default_selector . ' span.icon-svg',
'live_refresh_css_prop' => [
'cssVar' => [
'vars' => '--menuiconsize',
'selector' => '.builder-item--' . $this->get_id(),
'suffix' => 'px',
],
'type' => 'svg-icon-size',
'default' => 15,
],
'section' => $this->section,
'conditional_header' => true,
]
);

$mod_key = self::BUTTON_APPEARANCE;
$default = [
'type' => 'outline',
Expand Down
17 changes: 14 additions & 3 deletions header-footer-grid/templates/components/component-menu-icon.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,10 @@
$item_attributes = apply_filters( 'neve_nav_toggle_data_attrs', '' );
$label = component_setting( MenuIcon::TEXT_ID );
$menu_icon = component_setting( MenuIcon::MENU_ICON );

$menu_svg = component_setting( MenuIcon::MENU_SVG );
if ( $menu_icon === 'svg' && empty( $menu_svg ) ) {
$menu_icon = 'default';
}
$class = '';
if ( $menu_icon !== 'default' ) {
$class = apply_filters( 'neve_menu_icon_classes', 'hamburger ', $menu_icon );
Expand Down Expand Up @@ -43,8 +46,16 @@
<?php
} else {
?>
<span class="hamburger-box">
<span class="hamburger-inner"></span>
<span class="hamburger-box <?php echo esc_attr( 'icon-' . $menu_icon ); ?>">
<?php
if ( $menu_icon === 'svg' ) {
echo neve_kses_svg( $menu_svg ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
?>
<span class="hamburger-inner"></span>
<?php
}
?>
</span>
<?php
}
Expand Down
18 changes: 16 additions & 2 deletions header-footer-grid/templates/row-wrapper-mobile.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@
$close_classes = 'close-sidebar-panel navbar-toggle-wrapper' . ( $close_contained ? ' container' : '' );
$submenu_style = row_setting( 'layout', 'slide_left' );
$menu_icon_class = apply_filters( 'neve_menu_icon_classes', 'hamburger is-active ' );

$menu_icon = component_setting( MenuIcon::MENU_ICON );
$menu_svg = component_setting( MenuIcon::MENU_SVG );
if ( $menu_icon === 'svg' && empty( $menu_svg ) ) {
$menu_icon = 'default';
}
?>
<div
id="header-menu-sidebar" class="<?php echo esc_attr( join( ' ', $classes ) ); ?>"
Expand All @@ -47,9 +53,17 @@
<?php
} else {
?>
<span class="hamburger-box">
<span class="hamburger-box <?php echo esc_attr( 'icon-' . $menu_icon ); ?>">
<?php
if ( $menu_icon === 'svg' ) {
echo neve_kses_svg( $menu_svg ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
} else {
?>
<span class="hamburger-inner"></span>
</span>
<?php
}
?>
</span>
<?php
}
?>
Expand Down
2 changes: 2 additions & 0 deletions start.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ function neve_run() {
'hfg_d_search_iconbutton' => true, // Dynamic icon selection or a button for search components
'restrict_content' => true,
'theme_dedicated_menu' => true, // Theme uses the new menu location for settings and sub-pages.
'menu_icon_svg' => true,
'custom_payment_icons' => true,
]
);
$vendor_file = trailingslashit( get_template_directory() ) . 'vendor/autoload.php';
Expand Down

0 comments on commit 78e581f

Please sign in to comment.