Skip to content

Conversation

@swissspidy
Copy link
Member

This is something that came up in #1440, #1467, and #1545.

The component is actually quite simple and could be added to the inspector like this:

<InspectorControls key="inspector">
	<BlockDescription>
		<p>{ __( 'Hello World' ) }</p>
	</BlockDescription>
</InspectorControls>

Now, when there are other components after it, it looks like this:

block-description-not-last

As you can see, there's a thin border being added. If it's the only component, it looks like this:

block-description-last

Perhaps the border should be added manually using an attribute or a <hr />, not sure what's the best approach.

Feedback welcome.

</div>
);
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I like it but this could be a functional component, no need for a class.

@@ -0,0 +1,21 @@
/**
Copy link
Contributor

Choose a reason for hiding this comment

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

I guess this component should be moved to the blocks module next to the BlockControls, InspectorControls, ...

Copy link
Member Author

Choose a reason for hiding this comment

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

I actually tested it as a functional component in that folder at first but wasn't sure if it's correct / the best approach. Happy to move it.

@swissspidy swissspidy requested review from aduth and youknowriad June 28, 2017 21:32
@swissspidy
Copy link
Member Author

@youknowriad It's now a functional component just like you suggested.

@ahmadawais
Copy link
Contributor

This is a great idea, looking forward to it being merged!

Copy link
Contributor

@youknowriad youknowriad left a comment

Choose a reason for hiding this comment

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

Nice 👍

@swissspidy swissspidy merged commit 90ed19b into master Jun 30, 2017
@swissspidy swissspidy deleted the add/block-description branch June 30, 2017 07:02
@mtias
Copy link
Member

mtias commented Jun 30, 2017

Thanks!

@aduth
Copy link
Member

aduth commented Jul 3, 2017

Is there a reason this is a component and not just a localized property string of the block settings, similar to its title?

@swissspidy
Copy link
Member Author

IIRC we discussed that a plain-text property string could be used for something else instead, like short descriptions somewhere à la register_post_type().

@StaggerLeee
Copy link

Those descriptions are of course of great help for Users at the beginning. But after Users see them few times they have to live with them in years to come.

Why not put a blue question icon somewhere, and set all descriptions there ?

@swissspidy
Copy link
Member Author

@StaggerLeee That sounds like something that could be applied to other areas as well. Would you mind creating a new issue for this? Thanks!

@StaggerLeee
Copy link

Hi @swissspidy, it is here:
#2242

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants