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

feat: add Card component #28

Merged
merged 9 commits into from
May 8, 2023
Merged

feat: add Card component #28

merged 9 commits into from
May 8, 2023

Conversation

jaredcwhite
Copy link
Collaborator

@jaredcwhite jaredcwhite commented Apr 18, 2023

This PR addresses #22

Description

Adds a Card component to the Seeds design system.

How Can This Be Tested/Reviewed?

Review the Card component in Storybook: https://deploy-preview-28--storybook-ui-seeds.netlify.app/?path=/story/blocks-card--text-content

Checklist:

  • I have added QA notes to the issue with applicable URLs
  • I have performed a self-review of my own code
  • I have reviewed the changes in a desktop view
  • I have reviewed the changes in a mobile view
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • I have exported any new components
  • My commit message(s) and PR title are polished in the conventional commit format, and any breaking changes are indicated in the message and are well-described

@netlify
Copy link

netlify bot commented Apr 18, 2023

Deploy Preview for storybook-ui-seeds ready!

Name Link
🔨 Latest commit 99e643d
🔍 Latest deploy log https://app.netlify.com/sites/storybook-ui-seeds/deploys/645968dda1bf87000809136d
😎 Deploy Preview https://deploy-preview-28--storybook-ui-seeds.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@jaredcwhite
Copy link
Collaborator Author

jaredcwhite commented Apr 18, 2023

@slowbot Just want to run a couple things by you regarding the props…so I ended up creating a dividers prop with the option of either flush or inset…in the Figma design specs there's only an example what I call the flush style…the inset style would look more like the existing Card implementation as used in the search form for Detroit. Let me know if you think that works, or if we should only have the flush style (in which case I can change dividers to just be a boolean).

I also decided to try out t-shirt sizing for the spacing prop: sm, base (default), md, lg as that felt natural and comparable with other stuff like icon sizes. Let me know your thoughts! cc @emilyjablonski

@slowbot
Copy link
Collaborator

slowbot commented Apr 21, 2023

@jaredcwhite
Dividers are cool, is this possible to do on a section-by-section basis rather than for the whole card? I say this based on the current implementations.

The spacing looks great. Is there an option to have "none"

Is there a reason that the card header doesn't consume "heading" or "heading group" as a subcomponent?

@jaredcwhite
Copy link
Collaborator Author

@slowbot

  1. So we'd take off having dividers set on the card as a whole, and instead have a divider prop on each section? Sure, I think we could do that.
  2. What would "none" spacing do? Not have any gap between the card border and elements?
  3. The Heading/HeadingGroup components are still in a separate PR. Once that's merged in, I can circle back and use them here in the Card.

@slowbot
Copy link
Collaborator

slowbot commented Apr 21, 2023

  1. Yeah that was the thought
  2. Yeah if we nested a subcomponent that has its own spacing. We do this in Figma but may avoid it on the coded side.
  3. Cool

return (
<header id={props.id} className={classNames.join(" ")} data-divider={props.divider} data-flex-children={!!props.suffix}>
{props.children}
{props.suffix}
Copy link
Contributor

Choose a reason for hiding this comment

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

This suffix feature is kind of weird to me. It could just be a personal preference, but I'd prefer all of the content to be in the children. In fact with your current setup when I do the following it looks the same as if I put it in the suffix.

      <Card.Header divider="flush" className="test-card-header">
        <>
          <h3>Wildflower</h3>
          <div>Second part of it</div>
        </>
      </Card.Header>

That's because when you have no suffix prop passed it outputs as data-flex-children="false" so the css is applied.

I'll lean on the rest of the team on what syntax people prefer, but at minimum we should probably fix the issue where the css is only getting applied when we want it to.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, I believe that was a holdover from a past attempt to work on the idea of adding an icon or close button or something else to the opposite end of the header, but we might just instead want a flex/grid child to get added rather than bake it in the Header. I'm fine with just taking that prop out.

--card-header-padding-inline: var(--card-header-padding-inline-desktop);
--card-content-padding-inline: var(--card-content-padding-inline-desktop);

@media (max-width: 640px) { /* small screen */
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we / could we potentially have 640 as a var somewhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yeah, we do have screen values as tokens in the CSS, but unfortunately media queries are one area where native CSS variables aren't supposed, so we'll have to fallback to something like Sass variables (which is what happens in ui-components, but it's not currently in ui-seeds). I'll file a separate ticket to investigate a good solution.

Copy link
Contributor

@emilyjablonski emilyjablonski left a comment

Choose a reason for hiding this comment

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

Love the stories ❤️

Copy link
Contributor

@ludtkemorgan ludtkemorgan left a comment

Choose a reason for hiding this comment

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

📇

@jaredcwhite jaredcwhite merged commit 0fe438f into main May 8, 2023
@github-actions
Copy link

github-actions bot commented May 8, 2023

🎉 This PR is included in version 1.5.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

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

Successfully merging this pull request may close these issues.

4 participants