material-web icon indicating copy to clipboard operation
material-web copied to clipboard

Implement MDC Card components

Open zoofadoofa opened this issue 5 years ago • 15 comments

mwc-card

  • raised ? guidelines show cards changing from default elevation of 1dp / 0dp to 8dp
    • there is no 8dp elevation mixin in mdc-card at the moment.
  • outlined

mwc-card-primary-action or instead a slot to card primary-action mwc-media

  • square
  • 16-9
  • slot content. ex: "media-content"

mwc-card-actions

  • full-bleed
  • slot buttons
  • slot icons ? apply '.mdc-card__action, .mdc-card__action--button, .mdc-card__action--icon' to slot assign nodes

update @material/card to 0.44.1

implement in typescript

Creating a Fork with intent to PR

zoofadoofa avatar Feb 20 '19 21:02 zoofadoofa

The Fork is almost ready for PR. There is a bug with (.mdc-card__primary-action)'s ripple styles in @material/card:0.44.0. The bug gets resolved in 1.0.0 but requires upgrading Foundation and Adapter patterns in 1.0.0.

So I am looking to see where the Update to mdc 1.0 PR ends up. As this would solve that problem.

Right now I could wrap this up with 0.44.0 and .mdc-card__primary-action will not ripple properly unless I manually include @material/ripple/mdc-ripple.scss or upgrade to 1.0.0 and wait for the other PR to merge.

zoofadoofa avatar Mar 20 '19 19:03 zoofadoofa

Using 0.44.0 for now until mdc is upgraded to 1.0.0 Created Pull Request #254

zoofadoofa avatar Mar 21 '19 16:03 zoofadoofa

Any update on when this might be added?

jrgleason avatar Mar 21 '20 14:03 jrgleason

nm see https://github.com/material-components/material-components-web-components/issues/442

jrgleason avatar Mar 21 '20 14:03 jrgleason

Work will continue work on this very soon as we are finishing up our landing of mwc-select, menu, and list & list-item

e111077 avatar Mar 23 '20 20:03 e111077

Updated status on this? What are the challenges of card? Should it have other features besides UI styles?

yinonov avatar Dec 04 '20 12:12 yinonov

The challenges of card are designing it for maintainability while at the same time providing all the use cases of card. From our years of component development and maintaining a google-wide component set in a monorepo we found that providing someone with a point in which they can insert any dom they want is a recipe for maintenance disaster. Users put the darndest things in them that you'd never expect the component to be used. Because of the monorepo and google's tradition of screenshot testing, any small change would break hundreds to thousands of screenshot tests that we must manually go through and fix (this is where you find the most bewildering abuse of your work).

Though if you restrict it too much (especially something as basic as a card) then you run into issues of endless feature requests and then eventually feature bloat. All the guard rails and safety equipment starts to weigh down the boat and then nobody wants to use it.

This is a huge developer experience design problem that requires a lot of an engineer's time to sit down with a designer and figure out how to provide all the supported use cases of card as well as keeping it maintainable and at the same time usable. And whenever someone embarks on this long journey, we often get pulled over to more-important tasks and projects. This is also generally lower priority because it's essentially some borders with padding and eventually elevation that can already be provided by mdc's card implementation.

e111077 avatar Dec 04 '20 19:12 e111077

Understood. Guessing same went to drawer/dialog etc'... I would have guessed the card would be close in layout to dialog 🤔

Is this already in progress?

yinonov avatar Dec 05 '20 11:12 yinonov

Drawer is actively being worked on because we are sticking more to a more-constrained spec similar to that of gmail. Dialog is one of these elements where we are already running into these issues. Card is still not in progress. In the meantime, you can use MDC card's distributed styles in their npm dist folder or unpkg

https://unpkg.com/browse/@material/card/dist/

e111077 avatar Dec 07 '20 20:12 e111077

Will do!

yinonov avatar Dec 08 '20 16:12 yinonov

Since card is currently not being developed, the readme should be updated so it doesn't mention that work on <mwc-card> starts in "Q4-2020", especially considering that we are almost at the end of Q4 and there's no work being done.

ranile avatar Dec 09 '20 11:12 ranile

For those who want to use the material card while this component is not (yet?) finished, this could be a solution meanwhile: https://materializecss.com/cards.html

Keuter avatar Oct 19 '21 10:10 Keuter

@Keuter instead of using MaterializeCSS, which doesn't follow the latest MD specs, you should use the official components (not Web Components): https://github.com/material-components/material-components-web/tree/master/packages/mdc-card (or from the official website: https://material.io/components/cards/web#using-cards)

maicol07 avatar Oct 19 '21 10:10 maicol07

@Keuter instead of using MaterializeCSS, which doesn't follow the latest MD specs, you should use the official components (not Web Components): https://github.com/material-components/material-components-web/tree/master/packages/mdc-card (or from the official website: https://material.io/components/cards/web#using-cards)

Thank you @maicol07, I'll check it out!

Keuter avatar Oct 19 '21 13:10 Keuter

In the meantime I've realized a component that wraps MDC Card: https://github.com/maicol07/material-web-additions/blob/master/packages/card/README.md

Since I'm a newbie with WebComponents creation, it might have some issues. :sweat_smile:

However, I'm looking forward to the official component when it will be ready (I hope soon!)

P.S.: To anyone who will try my component, please send me your feedback!

maicol07 avatar Nov 16 '21 14:11 maicol07

Filled, outlined, and elevated cards are now implemented in the labs folder. Closing this since the initial implementation is complete. Once it has been reviewed, it'll move out of labs as a feature for the next release.

import '@material/web/labs/card/filled-card.js';

html`
  <md-filled-card>
    Any dynamic content
  </md-filled-card>
`;

asyncLiz avatar Oct 25 '23 22:10 asyncLiz