Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions wp-content/themes/core/blocks/core/button/Button.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,4 @@ public function get_block_name(): string {
return 'core/button';
}

public function get_block_styles(): array {
return [
'primary' => esc_html__( 'Primary', 'tribe' ),
'secondary' => esc_html__( 'Secondary', 'tribe' ),
'ghost' => esc_html__( 'Ghost', 'tribe' ),
];
}

}
40 changes: 39 additions & 1 deletion wp-content/themes/core/blocks/core/button/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,47 @@
*/

import { ready } from 'utils/events.js';
import { unregisterBlockStyle } from '@wordpress/blocks';
import {
registerBlockVariation,
unregisterBlockStyle,
} from '@wordpress/blocks';
import { __ } from '@wordpress/i18n';

ready( () => {
unregisterBlockStyle( 'core/button', 'default' );
unregisterBlockStyle( 'core/button', 'fill' );
unregisterBlockStyle( 'core/button', 'outline' );

registerBlockVariation( 'core/button', {
name: 'primary-button',
title: __( 'Primary', 'tribe' ),
scope: [ 'block', 'inserter', 'transform' ],
attributes: {
className: 'is-style-primary',
},
icon: 'button',
isDefault: true,
} );

registerBlockVariation( 'core/button', {
name: 'secondary-button',
title: __( 'Secondary', 'tribe' ),
scope: [ 'block', 'inserter', 'transform' ],
attributes: {
className: 'is-style-secondary',
},
icon: 'button',
isDefault: false,
} );

registerBlockVariation( 'core/button', {
name: 'ghost-button',
title: __( 'Ghost', 'tribe' ),
scope: [ 'block', 'inserter', 'transform' ],
attributes: {
className: 'is-style-ghost',
},
icon: 'button',
isDefault: false,
} );
} );
12 changes: 4 additions & 8 deletions wp-content/themes/core/patterns/styleguide.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,20 +61,16 @@
<!-- /wp:separator -->

<!-- wp:buttons -->
<div class="wp-block-buttons"><!-- wp:button -->
<div class="wp-block-button"><a class="wp-block-button__link wp-element-button">Default Button</a></div>
<!-- /wp:button -->

<!-- wp:button {"className":"is-style-primary"} -->
<div class="wp-block-button is-style-primary"><a class="wp-block-button__link wp-element-button">Primary Button</a></div>
<div class="wp-block-buttons"><!-- wp:button {"className":"is-style-primary"} -->
<div class="wp-block-button is-style-primary"><a class="wp-block-button__link wp-element-button">Button Text</a></div>
<!-- /wp:button -->

<!-- wp:button {"className":"is-style-secondary"} -->
<div class="wp-block-button is-style-secondary"><a class="wp-block-button__link wp-element-button">Secondary Button</a></div>
<div class="wp-block-button is-style-secondary"><a class="wp-block-button__link wp-element-button">Button Text</a></div>
<!-- /wp:button -->

<!-- wp:button {"className":"is-style-ghost"} -->
<div class="wp-block-button is-style-ghost"><a class="wp-block-button__link wp-element-button">Ghost Button</a></div>
<div class="wp-block-button is-style-ghost"><a class="wp-block-button__link wp-element-button">Button Text</a></div>
<!-- /wp:button --></div>
<!-- /wp:buttons -->

Expand Down