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

🔪Kitchen Sink Examples #130

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

braginteractive
Copy link

Here is the start of the Kitchen Sink example. Let me know what you think/suggestions.

screen shot 2018-12-25 at 6 46 49 pm

Copy link
Owner

@ahmadawais ahmadawais left a comment

Choose a reason for hiding this comment

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

Thanks for all the effort you put in this block @braginteractive — I have reviewed it and left comments. Let's improve these sections before merging.

Kudos! 👍

add_action( 'enqueue_block_editor_assets', 'kitchen_sink_cgb_editor_assets' );


// Add custom block category
Copy link
Owner

Choose a reason for hiding this comment

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

Add a period . at the end of comments.


![WHAT ICON](https://on.ahmda.ws/oy8W/c)

### What/How?
Copy link
Owner

Choose a reason for hiding this comment

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

  1. This README.md file has a lot of irrelevant info about the a11y example remove that.
  2. Explain what features you have added + docs links

const { registerBlockType } = wp.blocks; // Import registerBlockType() from wp.blocks
const { Fragment } = wp.element; // Import Fragment from wp.elements

// Register editor components
Copy link
Owner

Choose a reason for hiding this comment

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

Document addition of each new module. Don't be afraid of commenting about everything. This example is meant to teach people.

};

/**
* Register: aa Gutenberg Block.
Copy link
Owner

Choose a reason for hiding this comment

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

aa Gutenberg Block. Maybe rename that aa here. Docs should be up to date. :)

__("create-guten-block")
],
supports: {
// Adds block supports: https://wordpress.org/gutenberg/handbook/designers-developers/developers/block-api/block-registration/#supports-optional
Copy link
Owner

Choose a reason for hiding this comment

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

Add Multiline comments explaining everything and then at the end of the comment give docs links. Adds block supports doesn't help anyone. Explain the What/Why/How.

exampleImageURL,
exampleImageAlt
},
attributes,
Copy link
Owner

Choose a reason for hiding this comment

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

attributes is already there? Why including it again?

{ value: "option_2", label: __("Option 2") }
];

return [
Copy link
Owner

Choose a reason for hiding this comment

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

Explain in details how the JSX going to be for the block. The real HTML and the Wrappers. Without this explanation example is not going to be helpful.

{/* Toggle Switch */}
<ToggleControl
label={__("Example Toggle")}
checked={!!exampleToggle}
Copy link
Owner

Choose a reason for hiding this comment

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

Explain !! — remember WordPress community is new to JS. :)

* @link https://wordpress.org/gutenberg/handbook/block-api/block-edit-save/
*/
save: function(props) {
// Attributes for the frontend
Copy link
Owner

Choose a reason for hiding this comment

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

Same as above. Detailed docs would be awesome! 💯

exampleImageURL,
exampleImageAlt
},
attributes,
Copy link
Owner

Choose a reason for hiding this comment

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

Again repetition of attributes is wrong — JS objects should have unique keys.

@ahmadawais
Copy link
Owner

One more thing, @braginteractive — kindly use Emoji-log for writing git commits.

@braginteractive
Copy link
Author

@ahmadawais I am learning some of this myself. Any examples and improvements that you can provide would help!

@ahmadawais
Copy link
Owner

@braginteractive Trust yourself. You're making really good progress. Let's document and ship this Kitchen Sink Example next year.

@ahmadawais
Copy link
Owner

Also go through the changes requested and resolve all of these 👍

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants