forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Style Book: Add color tab (WordPress#65692)"
This reverts commit 5437114.
- Loading branch information
1 parent
519f7b7
commit 4184b4b
Showing
10 changed files
with
85 additions
and
455 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 0 additions & 44 deletions
44
packages/edit-site/src/components/style-book/color-examples.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 0 additions & 53 deletions
53
packages/edit-site/src/components/style-book/duotone-examples.tsx
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { __, sprintf } from '@wordpress/i18n'; | ||
import { | ||
getBlockType, | ||
getBlockTypes, | ||
getBlockFromExample, | ||
createBlock, | ||
} from '@wordpress/blocks'; | ||
|
||
/** | ||
* Internal dependencies | ||
*/ | ||
import type { BlockExample } from './types'; | ||
|
||
/** | ||
* Returns a list of examples for registered block types. | ||
* | ||
* @return {BlockExample[]} An array of block examples. | ||
*/ | ||
export function getExamples(): BlockExample[] { | ||
const nonHeadingBlockExamples = getBlockTypes() | ||
.filter( ( blockType ) => { | ||
const { name, example, supports } = blockType; | ||
return ( | ||
name !== 'core/heading' && | ||
!! example && | ||
supports.inserter !== false | ||
); | ||
} ) | ||
.map( ( blockType ) => ( { | ||
name: blockType.name, | ||
title: blockType.title, | ||
category: blockType.category, | ||
blocks: getBlockFromExample( blockType.name, blockType.example ), | ||
} ) ); | ||
const isHeadingBlockRegistered = !! getBlockType( 'core/heading' ); | ||
|
||
if ( ! isHeadingBlockRegistered ) { | ||
return nonHeadingBlockExamples; | ||
} | ||
|
||
// Use our own example for the Heading block so that we can show multiple | ||
// heading levels. | ||
const headingsExample = { | ||
name: 'core/heading', | ||
title: __( 'Headings' ), | ||
category: 'text', | ||
blocks: [ 1, 2, 3, 4, 5, 6 ].map( ( level ) => { | ||
return createBlock( 'core/heading', { | ||
content: sprintf( | ||
// translators: %d: heading level e.g: "1", "2", "3" | ||
__( 'Heading %d' ), | ||
level | ||
), | ||
level, | ||
} ); | ||
} ), | ||
}; | ||
|
||
return [ headingsExample, ...nonHeadingBlockExamples ]; | ||
} |
Oops, something went wrong.