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

Add Cards component to style guide #35

Merged
merged 9 commits into from
Oct 28, 2024
Merged

Add Cards component to style guide #35

merged 9 commits into from
Oct 28, 2024

Conversation

shannonwells
Copy link
Collaborator

@shannonwells shannonwells commented Oct 25, 2024

Goal

The purpose of this PR is to add a Card component according to the UX designs.

The Card takes as props

  • an icon Svelte component which assumes it's an SVG,
  • a background color
  • title
  • title color
  • content (as slot)
  • content color
  • class (used as extras)

When I changed the bgcolor it seemed odd not to let you change the text color. Since the title text color was different from the card text color, it also seemed you should be able to specify that color as well. The defaults match what is in the design.

Closes #9

  • Add Card component with props
  • Add a Story that illustrates how to use the component

Steps to Verify:

  1. npm run storybook
  2. navigate to Features-->Card and verify that the view looks like the screenshot and also matches up with the Figma designs from the Issue

Screenshots (optional):

Screenshot 2024-10-25 at 8 56 04 AM

@@ -23,5 +23,6 @@
<div class="w-f192 bg-teal">f192 - 192px</div>
<div class="w-f224 bg-teal">f224 - 224px</div>
<div class="w-f256 bg-teal">f256 - 256px</div>
<div class="w-f320 bg-teal">f320 - 320px</div>
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This was a width specified in the Figma design so I added it.

export let icon = UserFilled;
</script>

<div class="p-6 card-shadow rounded-xl bg-{bgColor} {$$restProps.class}">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
<div class="p-6 card-shadow rounded-xl bg-{bgColor} {$$restProps.class}">
<div class="p-6 card-shadow rounded-xl bg-cream {$$restProps.class}">

Thinking we degault to cream, then when a user wants to change the color, they can just set the class to the new color that they want and it can override the cream through the restProps.class.

Copy link
Collaborator Author

@shannonwells shannonwells Oct 25, 2024

Choose a reason for hiding this comment

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

I did it this way because the background color as a prop was part of the Issue specification. It does already default to cream, however, I think it's not the best practice to have two background color classes end up in the class list.

Copy link
Collaborator

@claireclark1 claireclark1 left a comment

Choose a reason for hiding this comment

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

A couple of suggestions, but overall looking good!

Copy link
Contributor

@JoeCap08055 JoeCap08055 left a comment

Choose a reason for hiding this comment

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

  • Pulled branch, ran storybook
  • Test drove new Card component

Looks great!
:shipit:

Copy link
Collaborator

@claireclark1 claireclark1 left a comment

Choose a reason for hiding this comment

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

👍🏼

@shannonwells shannonwells merged commit 7c62ed4 into main Oct 28, 2024
4 checks passed
@shannonwells shannonwells deleted the feat/cards-#9 branch October 28, 2024 20:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Cards
3 participants