Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a Card component #15921

Closed
iandunn opened this issue May 30, 2019 · 6 comments
Closed

Provide a Card component #15921

iandunn opened this issue May 30, 2019 · 6 comments
Labels
[Feature] UI Components Impacts or related to the UI component system [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.

Comments

@iandunn
Copy link
Member

iandunn commented May 30, 2019

Cards are a common UI pattern across the web, seen for example in Material, Calypso, Jetpack, WooCommerce Admin, etc.

Screen Shot 2019-05-30 at 10 02 46 AM

wp-admin itself also has several isolated, inconsistent uses of cards: Dashboard, Apperance > Themes, Tools > Site Health, etc.

It would be helpful for Gutenberg to provide a standard/consistent base component for wp-admin and plugins to use and build on top of.

Modal comes pretty close, but currently it doesn't seem like it's possible/practical to reuse it for this purpose, since the inner components like ModalFrame and ModalHeader aren't extractable from the undesirable container UI/functionality.

It seems like it could probably be abstracted to provide generic functionality, though.

@iandunn iandunn added [Type] Enhancement A suggestion for improvement. Needs Design Feedback Needs general design feedback. [Feature] UI Components Impacts or related to the UI component system [Package] Components /packages/components labels May 30, 2019
@sarahmonster
Copy link
Member

Yes! This seems like it warrants its own component since the use case for one really isn't the same as a Modal (used to focus attention on one thing). Cards are generally used for discrete pieces of information arranged in a logical way, and they're often arranged in a grid of other, equal cards.

Let's start by taking inventory of where and how cards are currently used in wp-admin, and then we can see about writing some guidelines and creating a new UI component.

@sarahmonster
Copy link
Member

The design team discussed this during a triage session in Slack today (Note: You may need a Slack account to log in.)

We touched a bit on current usage: whilst Cards are used outside of the editor context, they don't really exist, per se, right now within the current editor/Gutenberg context. So first we needed to take a step back and ask:

Should the @wordpress/components package allow for UI components that are used in wp-admin, but may not be immediately called for in the Gutenberg/post editor context as it exists today?

Our overall consensus seemed to be leaning toward "yes", especially as Gutenberg is slowly expanding outside of the post editor context and its boundaries become blurred and amorphous. These components are available for use outside of Gutenberg (and indeed, WordPress itself) and may prove useful in other contexts if designed well for reusability.

That said, we didn't come to a clear consensus during triage. This may warrant a bit more discussion before we dive into documentation, design, & development:

  1. Should WordPress components be built if they aren't directly needed by the Gutenberg plugin immediately?
  2. Are there use cases where we could see a Card component being helpful for Gutenberg itself? (The Block Directory work @melchoyce has been shepherding comes to mind...)

@melchoyce
Copy link
Contributor

Here's the card from the latest Block Directory project mocks:

image

@karmatosed karmatosed removed the Needs Design Feedback Needs general design feedback. label Aug 31, 2019
@ItsJonQ
Copy link

ItsJonQ commented Oct 11, 2019

👋 Hai there!!

I started working on this! Will create a draft pull request when it's ready.

For fun + collaboration, I live streamed the designing + coding process:
https://youtu.be/oAPuOB9oYCw

😊

@iandunn
Copy link
Member Author

iandunn commented Nov 14, 2019

Great work on #17963! 🎉

It looks like that was merged; should this be closed now, or are there some more things left to do?

@ItsJonQ
Copy link

ItsJonQ commented Nov 21, 2019

@iandunn Thanks!! I think we can close this one up now :). The next steps would be to refactor some of the other components (like Panel) with Card

@ItsJonQ ItsJonQ closed this as completed Nov 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] UI Components Impacts or related to the UI component system [Package] Components /packages/components [Type] Enhancement A suggestion for improvement.
Projects
None yet
Development

No branches or pull requests

5 participants