Skip to content

Commit

Permalink
Support global elevation directly
Browse files Browse the repository at this point in the history
  • Loading branch information
PatelUtkarsh committed May 3, 2022
1 parent 1811ada commit 858056f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,23 +19,22 @@
*/
import { RadioControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { applyFilters } from '@wordpress/hooks';

const ElevationStyleControl = ( { onChange, selected } ) => {
const options = applyFilters(
'material.elevation.styleControl.options',
[
{
label: __( 'Elevated', 'material-design' ),
value: 'elevated',
},
{
label: __( 'Outlined', 'material-design' ),
value: 'outlined',
},
],
'fse'
);
const options = [
{
label: __( 'Elevated', 'material-design' ),
value: 'elevated',
},
{
label: __( 'Outlined', 'material-design' ),
value: 'outlined',
},
{
label: __( 'Inherit from Global Settings', 'material-design' ),
value: 'global',
},
];
return (
<RadioControl
label={ __( 'Elevation style', 'material-design' ) }
Expand Down
4 changes: 3 additions & 1 deletion plugin/php/template-parts/blocks/card-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
*
* @package MaterialDesign
*/
global $material_design_plugin;

$block = isset( $args['block'] ) ? $args['block'] : [];
$attributes = isset( $args['attributes'] ) ? $args['attributes'] : [];
$content = isset( $args['content'] ) ? $args['content'] : [];
Expand All @@ -35,7 +37,7 @@
$show_post_title = $attributes['showTitle'];
$card_style = $attributes['cardStyle'];
$content_length = isset( $attributes['postContentLength'] ) ? $attributes['postContentLength'] : 20;
$global_card_style = apply_filters( 'material_design_global_card_style', '', $card_style );
$global_card_style = $material_design_plugin->block_types->get_global_styles( 'card_style' );
$classes = $card_style === 'outlined'
||
( $card_style === 'global' && $global_card_style === 'outlined' ) ? 'mdc-card--outlined' : '';
Expand Down

0 comments on commit 858056f

Please sign in to comment.