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

Add CustomBlockAppender. #8

Merged
merged 4 commits into from
Mar 10, 2021
Merged

Add CustomBlockAppender. #8

merged 4 commits into from
Mar 10, 2021

Conversation

ryanwelcher
Copy link
Contributor

Add the CustomBlockAppender component.

CustomBlockInserter

This component is passed to an InnerBlocks instance to as it's renderAppender to provide a customized button that opens the Block Inserter.

Usage

import { CustomBlockAppender } from '@10up/block-components';
const MyComponent = ({clientId}) => {
	<InnerBlocks
		renderAppender={() => (
			<CustomBlockAppender
				className="accordion-item-appender"
				rootClientId={clientId}
				icon=
				isTertiary
				showTooltip
				label={__('Insert Accordion content', '10up-block-library')}
			/>
		)}
	/>
}

Props

Name Type Default Description
rootClientId string '' Client it of the block
buttonText string '' Text to display in the button
icon string 'plus' Icon to display.
..buttonProps object null' Any other props passed are spread onto the internal Button component.

Copy link
Member

@fabiankaegy fabiankaegy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left two minor comments but I'm excited about this one and the code looks good to me 👍

README.md Outdated Show resolved Hide resolved
README.md Outdated
<InnerBlocks
renderAppender={() => (
<CustomBlockAppender
className="accordion-item-appender"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we namescope our classes so they don't interfere with anything?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabiankaegy that's probably a good idea

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@fabiankaegy @tlovett1 I have updated.

Co-authored-by: Fabian Kägy <[email protected]>
@tlovett1
Copy link
Member

@ryanwelcher were you able to address the feedback?

@ryanwelcher ryanwelcher requested a review from fabiankaegy March 10, 2021 13:51
@tlovett1 tlovett1 merged commit e3f5ede into trunk Mar 10, 2021
@tlovett1 tlovett1 deleted the feature/custom-appenders branch March 10, 2021 18:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants