measuredco / puck

The visual editor for React
https://puckeditor.com
MIT License
5.31k stars 326 forks source link

Consider renaming `components` to `blocks` #21

Closed chrisvxd closed 1 year ago

chrisvxd commented 1 year ago

In the puck config

chrisvxd commented 1 year ago

@JPrisk @Danm72 @Merino noticed you all upvoted this. Do you have any comments? Are you supportive of an API change or are you actually more concerned with what is shown to users in the Puck UI?

Related: #37 introduces dropzones, which allow you to nest components within other components. This means that the components are no longer just "block" level, and therefore the block naming convention might be less appropriate.

Danm72 commented 1 year ago

To me a Hero is a block, Text, button, and other primitives are components.

A hero is made up of components.

So, I think it depends if you want to go down the route of block & component or just components

Merino commented 1 year ago

For me it's more a DX and naming thing. We're trying to make a email builder with it.

My react project structure looks like:

So I think if you design a layout you are more using the "blocks" than "components" group: I did not have the time to review #37

JPrisk commented 1 year ago

I'm interested in the semantics used in content management systems and agree with @Danm72's comment above.

Lots of prior art and different names used for essentially the same thing:

I looked at #37 but am not sure that I understood the full context of the proposal, was the idea that "components" can have sub "components" now, and you are questioning the rename to blocks? personally I don't think this should affect the naming

In summary:

JakeSidSmith commented 1 year ago

I personally would stick with "components", as existing design systems use the term "block" to refer to a specific type of component (e.g. in BEM/ABEM), whereas in React everything is a component regardless of depth/purpose - a block is still a component.

I think changing to block may artificially restrict what people want/will put in there. Allowing a user to compose atomic components/elements is equally as valid as allowing blocks.

I don't generally use the atom/element/etc naming scheme and just throw all my components in a components directory (where suitable), but it's not uncommon to see components split into distinct groups:

/components
  /atoms
  /elements
  /molecules
  /blocks
  /etc

References:

chrisvxd commented 1 year ago

37 has been merged for some time now, which introduces nested components. I think that closes the "components" vs "blocks" question in my mind, because I consider "blocks" to be sectional (i.e. page width).

These are documented here: https://puckeditor.com/docs/integrating-puck/multi-column-layouts

I'm going to close this for now, but happy to reopen discussions if anyone feels strongly.