Automattic / Picard

A prototype theme that uses React and WP-API
629 stars 110 forks source link

Identify components to componentize #15

Open MichaelArestad opened 9 years ago

MichaelArestad commented 9 years ago

Let's figure out some components! CC @kwight

Initial ideas that come to mind that follow the standardish class structure pretty nicely:

|- masthead
|-- site-title

|- navigation

|- hentry // for post and pages?
|--- entry-title
|--- entry-meta // and maybe components for the stuff that lives here
|--- entry-content

|- comment-box
|--- comment-form
|--- comments
|----- comment
|------- author ingo/meta stuff?
|------- comment-content
|------- comment-actions // reply/favorite/etc

|- widget
karmatosed commented 9 years ago

A big +1 for components. If we're doing this it would be good to think about maximising the structure and getting it right to align with the Sass. I'd really like to be part of that.

karmatosed commented 9 years ago

Additions:

jacklenox commented 9 years ago

I'm very excited about this.

As far as I understand React, we will need some sort of container component for instances of multiple hentry components. site-main mayhaps?

Further, I don't believe either WP-API or the WordPress.com REST API currently allow you to retrieve widgets. My thought on this at the moment is a tad hackish, but would involve output buffering the sidebar into a custom endpoint created by Picard. So we wouldn't have direct interaction with widget components as such.

Of course, this is just a "right now" solution to the issue.

kwight commented 9 years ago

I've got a component structure going in the SPA I'm working on; give me today to get it updated on GH so you can see how I've component-ized (good word @MichaelArestad !) the _s markup.

Further, I don't believe either WP-API or the WordPress.com REST API currently allow you to retrieve widgets. My thought on this at the moment is a tad hackish, but would involve output buffering the sidebar into a custom endpoint created by Picard.

I think the right approach is for us to write the proper endpoints for wpcom, rather than hacking OB and endpoints in a theme. Starting a separate issue.

jacklenox commented 9 years ago

I think the right approach is for us to write the proper endpoints for wpcom, rather than hacking OB and endpoints in a theme. Starting a separate issue.

I disagree. We're not using the wpcom API at all right now and the method for extending WP-API is almost certainly closer to the ultimate core implementation than how it's done in the wpcom API.

jacklenox commented 9 years ago

But this is happening. So ultimately we can use this anyway.

MichaelArestad commented 9 years ago

As far as I understand React, we will need some sort of container component for instances of multiple hentry components. site-main mayhaps?

site-main makes sense as a main column container, but maybe something a bit more reusable for a multiple hentry container. hentries maybe?

Further, I don't believe either WP-API or the WordPress.com REST API currently allow you to retrieve widgets.

No tears will be shed by me if we don't have widgets.

karmatosed commented 9 years ago

Maybe widgets is something to achieve later? I don't want to get out the punt-o-matic machine, but to me I think having it work without widgets is an amazing version one with option to later bake in.

MichaelArestad commented 9 years ago

Maybe widgets is something to achieve later? I don't want to get out the punt-o-matic machine, but to me I think having it work without widgets is an amazing version one with option to later bake in.

Yep. Minimum viable epic theme is a good start.

karmatosed commented 9 years ago

"Minimum viable epic theme" Sub-title waiting to happen there.

kwight commented 9 years ago

Just noting how I've broken up components based on Underscores in my Calypso-y, theme-y thing: https://github.com/Automattic/calypso-theme

kwight commented 9 years ago

Cool, of course widgets are already on the WP-API radar. And yes, I agree, I didn't see widgets necessarily for a Picard MVP. Just sticking a pin in it, and suggesting that adding something to wpcom is a possible reality in the shorter term if we need it.