-
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.
Change Details -------------- Adds an icon block to the iconography package
- Loading branch information
Showing
11 changed files
with
144 additions
and
124 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import type { WPFormat } from '@wordpress/rich-text/build-types/register-format-type'; | ||
|
||
export type Attributes = Partial< { | ||
className: WPFormat[ 'className' ]; | ||
tagName: WPFormat[ 'tagName' ]; | ||
iconClass: WPFormat[ 'className' ]; | ||
iconTag: WPFormat[ 'tagName' ]; | ||
iconContent: string; | ||
} >; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,19 @@ | ||
import React from 'react'; | ||
|
||
/* WordPress Dependencies */ | ||
import { useBlockProps } from '@wordpress/block-editor'; | ||
|
||
/* Types */ | ||
import type { Attributes } from './Attributes.type'; | ||
import type { BlockSaveProps } from '@wordpress/blocks'; | ||
|
||
export const Save = ( { attributes }: BlockSaveProps< Attributes > ) => { | ||
const { className, tagName, iconContent } = attributes; | ||
const TagName = ( tagName as keyof HTMLElementTagNameMap ) ?? 'span'; | ||
const { iconClass, iconTag, iconContent } = attributes; | ||
const TagName = ( iconTag as keyof HTMLElementTagNameMap ) ?? 'span'; | ||
|
||
return ( | ||
<div { ...useBlockProps.save() }> | ||
<TagName className={ className ?? '' }>{ iconContent }</TagName> | ||
<TagName className={ iconClass ?? '' }>{ iconContent }</TagName> | ||
</div> | ||
); | ||
}; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/* WordPress Dependencies */ | ||
import { registerBlockType } from '@wordpress/blocks'; | ||
|
||
/* Internal deps */ | ||
import metadata from './block.json'; | ||
import { Edit } from './Edit'; | ||
import { Save } from './Save'; | ||
import { ReactComponent as AddReactionOutlined } from '../AddReactionOutlined.svg'; | ||
|
||
registerBlockType( metadata, { | ||
icon: AddReactionOutlined, | ||
edit: Edit, | ||
save: Save, | ||
} ); |
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,3 @@ | ||
.wp-block-boxuk-icon { | ||
text-align: center; | ||
} |
Oops, something went wrong.