Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tweak categories in support of new categories within the Gutenberg plugin #1535

Merged
merged 3 commits into from
Jun 22, 2020
Merged
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
2 changes: 1 addition & 1 deletion src/blocks/gallery-carousel/block.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coblocks/gallery-carousel",
"category": "coblocks-galleries",
"category": "media",
"attributes": {
"gutter": {
"type": "number",
Expand Down
2 changes: 2 additions & 0 deletions src/blocks/gallery-carousel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import metadata from './block.json';
import save from './save';
import transforms from './transforms';
import { GalleryAttributes } from '../../components/block-gallery/shared';
import { hasFormattingCategory } from '../../utils/block-helpers';

/**
* WordPress dependencies
Expand All @@ -29,6 +30,7 @@ const settings = {
title: __( 'Carousel', 'coblocks' ),
/* translators: block description */
description: __( 'Display multiple images in a beautiful carousel gallery.', 'coblocks' ),
category: hasFormattingCategory ? 'coblocks-galleries' : 'media',
attributes,
icon,
keywords: [
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/gallery-collage/block.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coblocks/gallery-collage",
"category": "coblocks-galleries",
"category": "media",
"attributes": {
"images": {
"type": "array",
Expand Down
2 changes: 2 additions & 0 deletions src/blocks/gallery-collage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import metadata from './block.json';
import save from './save';
import transforms from './transforms';
import { GalleryAttributes } from '../../components/block-gallery/shared';
import { hasFormattingCategory } from '../../utils/block-helpers';

/**
* WordPress dependencies.
Expand All @@ -29,6 +30,7 @@ const settings = {
title: __( 'Collage', 'coblocks' ),
/* translators: block description */
description: __( 'Assemble images into a beautiful collage gallery.', 'coblocks' ),
category: hasFormattingCategory ? 'coblocks-galleries' : 'media',
icon,
keywords: [
'coblocks',
Expand Down
20 changes: 10 additions & 10 deletions src/blocks/gallery-masonry/block.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "coblocks/gallery-masonry",
"category": "coblocks-galleries",
"attributes": {
"gridSize": {
"type": "string",
"default": "xlrg"
}
}
}
{
"name": "coblocks/gallery-masonry",
"category": "media",
"attributes": {
"gridSize": {
"type": "string",
"default": "xlrg"
}
}
}
2 changes: 2 additions & 0 deletions src/blocks/gallery-masonry/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import metadata from './block.json';
import save from './save';
import transforms from './transforms';
import { GalleryAttributes } from '../../components/block-gallery/shared';
import { hasFormattingCategory } from '../../utils/block-helpers';

/**
* WordPress dependencies
Expand All @@ -29,6 +30,7 @@ const settings = {
title: __( 'Masonry', 'coblocks' ),
/* translators: block description */
description: __( 'Display multiple images in an organized masonry gallery.', 'coblocks' ),
category: hasFormattingCategory ? 'coblocks-galleries' : 'media',
icon,
keywords: [
'coblocks',
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/gallery-offset/block.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coblocks/gallery-offset",
"category": "coblocks-galleries",
"category": "media",
"attributes": {
"gridSize": {
"type": "string",
Expand Down
2 changes: 2 additions & 0 deletions src/blocks/gallery-offset/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import icon from './icon';
import transforms from './transforms';
import metadata from './block.json';
import { GalleryAttributes } from '../../components/block-gallery/shared';
import { hasFormattingCategory } from '../../utils/block-helpers';

/**
* WordPress dependencies
Expand All @@ -29,6 +30,7 @@ const settings = {
title: __( 'Offset', 'coblocks' ),
/* translators: block description */
description: __( 'Display images in an offset brick pattern gallery.', 'coblocks' ),
category: hasFormattingCategory ? 'coblocks-galleries' : 'media',
icon,
keywords: [
'coblocks',
Expand Down
50 changes: 25 additions & 25 deletions src/blocks/gallery-stacked/block.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
{
"name": "coblocks/gallery-stacked",
"category": "coblocks-galleries",
"attributes": {
"align": {
"type": "string",
"default": "full"
},
"captionStyle": {
"type": "string"
},
"fullwidth": {
"type": "boolean",
"default": true
},
"gutter": {
"type": "number",
"default": 0
},
"gutterMobile": {
"type": "number",
"default": 0
}
}
}
{
"name": "coblocks/gallery-stacked",
"category": "media",
"attributes": {
"align": {
"type": "string",
"default": "full"
},
"captionStyle": {
"type": "string"
},
"fullwidth": {
"type": "boolean",
"default": true
},
"gutter": {
"type": "number",
"default": 0
},
"gutterMobile": {
"type": "number",
"default": 0
}
}
}
2 changes: 2 additions & 0 deletions src/blocks/gallery-stacked/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import metadata from './block.json';
import save from './save';
import transforms from './transforms';
import { GalleryAttributes } from '../../components/block-gallery/shared';
import { hasFormattingCategory } from '../../utils/block-helpers';

/**
* WordPress dependencies
Expand All @@ -29,6 +30,7 @@ const settings = {
title: __( 'Stacked', 'coblocks' ),
/* translators: block description */
description: __( 'Display multiple images in a single column stacked gallery.', 'coblocks' ),
category: hasFormattingCategory ? 'coblocks-galleries' : 'media',
icon,
keywords: [
'coblocks',
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/gif/block.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coblocks/gif",
"category": "common",
"category": "media",
"attributes": {
"url": {
"attribute": "src",
Expand Down
2 changes: 2 additions & 0 deletions src/blocks/gif/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import edit from './edit';
import icon from './icon';
import metadata from './block.json';
import save from './save';
import { hasFormattingCategory } from '../../utils/block-helpers';

/**
* WordPress dependencies
Expand All @@ -21,6 +22,7 @@ const settings = {
title: __( 'Gif', 'coblocks' ),
/* translators: block description */
description: __( 'Pick a gif, any gif.', 'coblocks' ),
category: hasFormattingCategory ? 'common' : 'media',
icon,
keywords: [
'coblocks',
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/gist/block.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coblocks/gist",
"category": "formatting",
"category": "embed",
"attributes": {
"url": {
"type": "string"
Expand Down
2 changes: 2 additions & 0 deletions src/blocks/gist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import icon from './icon';
import metadata from './block.json';
import save from './save';
import transforms from './transforms';
import { hasFormattingCategory } from '../../utils/block-helpers';

/**
* WordPress dependencies
Expand All @@ -23,6 +24,7 @@ const settings = {
title: __( 'Gist', 'coblocks' ),
/* translators: block description */
description: __( 'Embed GitHub gists by adding a gist link.', 'coblocks' ),
category: hasFormattingCategory ? 'common' : 'embed',
icon,
keywords: [
'coblocks',
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/icon/block.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coblocks/icon",
"category": "common",
"category": "design",
"attributes": {
"icon": {
"type": "string",
Expand Down
5 changes: 4 additions & 1 deletion src/blocks/icon/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/**
* Internal dependencies
*/
import edit from './edit';
import deprecated from './deprecated';
import edit from './edit';
import icon from './icon';
import metadata from './block.json';
import save from './save';
import { hasFormattingCategory } from '../../utils/block-helpers';

/**
* WordPress dependencies
Expand All @@ -17,6 +18,7 @@ import { __ } from '@wordpress/i18n';
*/
export const DEFAULT_ICON_SIZE = 60;


/**
* Block constants
*/
Expand All @@ -27,6 +29,7 @@ const settings = {
title: __( 'Icon', 'coblocks' ),
/* translators: block description */
description: __( 'Add a stylized graphic symbol to communicate something more.', 'coblocks' ),
category: hasFormattingCategory ? 'common' : 'design',
icon,
keywords: [
'coblocks',
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/share/block.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coblocks/social",
"category": "common",
"category": "widgets",
"attributes": {
"align": {
"type": "string",
Expand Down
2 changes: 2 additions & 0 deletions src/blocks/share/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import edit from './edit';
import icon from './icon';
import metadata from './block.json';
import { hasFormattingCategory } from '../../utils/block-helpers';

/**
* WordPress dependencies
Expand All @@ -20,6 +21,7 @@ const settings = {
title: __( 'Share', 'coblocks' ),
/* translators: block description */
description: __( 'Add social sharing links to help you get likes and shares.', 'coblocks' ),
category: hasFormattingCategory ? 'common' : 'widgets',
icon,
keywords: [
'coblocks',
Expand Down
2 changes: 1 addition & 1 deletion src/blocks/social-profiles/block.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "coblocks/social-profiles",
"category": "common",
"category": "widgets",
"attributes": {
"align": {
"type": "string",
Expand Down
2 changes: 2 additions & 0 deletions src/blocks/social-profiles/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import edit from './edit';
import icon from './icon';
import metadata from './block.json';
import { transforms } from './transforms';
import { hasFormattingCategory } from '../../utils/block-helpers';

/**
* WordPress dependencies
Expand All @@ -21,6 +22,7 @@ const settings = {
title: __( 'Social Profiles', 'coblocks' ),
/* translators: block description */
description: __( 'Grow your audience with links to social media profiles.', 'coblocks' ),
category: hasFormattingCategory ? 'common' : 'widgets',
icon,
keywords: [
'coblocks',
Expand Down
8 changes: 8 additions & 0 deletions src/utils/block-helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,3 +41,11 @@ export const supportsCollections = () => {
return false;
};

/**
* Check for which category to assign.
*
* @return {boolean} Value to indicate function support.
*/
export const hasFormattingCategory = wp.blocks.getCategories().some( function( category ) {
return category.slug === 'formatting';
} );