This commit is contained in:
Albert Juhé Lluveras 2023-06-22 16:09:37 +02:00 committed by GitHub
parent aff69cda89
commit 9283b6c48b
6 changed files with 69 additions and 27 deletions

View File

@ -0,0 +1,23 @@
/**
* External dependencies
*/
import { renderFrontend } from '@woocommerce/base-utils';
/**
* Internal dependencies
*/
import Block from './block';
import { parseAttributes } from './utils';
const getProps = ( el: HTMLElement ) => {
return {
isEditor: false,
attributes: parseAttributes( el.dataset ),
};
};
renderFrontend( {
selector: '.wp-block-woocommerce-attribute-filter',
Block,
getProps,
} );

View File

@ -0,0 +1,23 @@
/**
* External dependencies
*/
import { renderFrontend } from '@woocommerce/base-utils';
/**
* Internal dependencies
*/
import Block from './block';
import { parseAttributes } from './utils';
const getProps = ( el: HTMLElement ) => {
return {
attributes: parseAttributes( el.dataset ),
isEditor: false,
};
};
renderFrontend( {
selector: '.wp-block-woocommerce-price-filter',
Block,
getProps,
} );

View File

@ -0,0 +1,23 @@
/**
* External dependencies
*/
import { renderFrontend } from '@woocommerce/base-utils';
/**
* Internal dependencies
*/
import Block from './block';
import { parseAttributes } from './utils';
const getProps = ( el: HTMLElement ) => {
return {
attributes: parseAttributes( el.dataset ),
isEditor: false,
};
};
renderFrontend( {
selector: '.wp-block-woocommerce-stock-filter',
Block,
getProps,
} );

View File

@ -25,13 +25,4 @@ class AttributeFilter extends AbstractBlock {
parent::enqueue_data( $attributes );
$this->asset_data_registry->add( 'attributes', array_values( wc_get_attribute_taxonomies() ), true );
}
/**
* Get the frontend script handle for this block type.
*
* @param string $key Data to get, or default to everything.
*/
protected function get_block_type_script( $key = null ) {
return null;
}
}

View File

@ -14,13 +14,4 @@ class PriceFilter extends AbstractBlock {
protected $block_name = 'price-filter';
const MIN_PRICE_QUERY_VAR = 'min_price';
const MAX_PRICE_QUERY_VAR = 'max_price';
/**
* Get the frontend script handle for this block type.
*
* @param string $key Data to get, or default to everything.
*/
protected function get_block_type_script( $key = null ) {
return null;
}
}

View File

@ -33,13 +33,4 @@ class StockFilter extends AbstractBlock {
public static function get_stock_status_query_var_values() {
return array_keys( wc_get_product_stock_status_options() );
}
/**
* Get the frontend script handle for this block type.
*
* @param string $key Data to get, or default to everything.
*/
protected function get_block_type_script( $key = null ) {
return null;
}
}