Skip to content
This repository has been archived by the owner on Oct 16, 2024. It is now read-only.

Add pattern title to the Pattern Block sidebar panel heading #197

Merged
merged 1 commit into from
Jun 15, 2023

Conversation

dreamwhisper
Copy link
Contributor

Tasks

Summary of changes

Adds the pattern title to the Pattern Block sidebar panel.

Related Issues

Fixes https://wpengine.atlassian.net/browse/GF-3805

How to test

  1. Add a Pattern Block in the pattern editor.
  2. View the information presented in the sidebar. It should show Pattern when no pattern is selected yet. Once a pattern is selected, it will display the pattern title.

Notes & Screenshots

Before:

Screenshot 2023-06-15 at 12 09 13 PM

After:

Screenshot 2023-06-15 at 11 41 02 AM

Conditionally shows the pattern title as heading in the sidebar once a pattern is selected.
@kienstra
Copy link
Contributor

Good idea, reviewing this now.

Copy link
Contributor

@kienstra kienstra left a comment

Choose a reason for hiding this comment

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

Hi @dreamwhisper,
Really elegant way to show the title:

Screenshot 2023-06-15 at 12 05 54 PM

title={
pattern
? pattern.title
: __( 'Pattern', 'pattern-manager' )
Copy link
Contributor

Choose a reason for hiding this comment

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

This isn't better, but here's another way to do this:

title={ pattern?.title ?? __( 'Pattern', 'pattern-manager' ) }

Don't change this.

I just thought I'd share it, as I'm learning about the ?? operator.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks @kienstra!

Appreciate the info too!

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks!

@dreamwhisper dreamwhisper merged commit 9bd2fad into main Jun 15, 2023
@dreamwhisper dreamwhisper deleted the add/pattern-block-pattern-title branch June 15, 2023 18:15
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants