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

USWDS-Next - Alpha: Create usa-card component #13

Open
wants to merge 39 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
c4f8c72
Add identifier component
amyleadem May 24, 2024
3d348a9
Add scaffolding to elements
amyleadem May 28, 2024
dae3bb9
Add attribute-based identifier
amyleadem May 29, 2024
eb8c394
Replace inline classes with slot names
amyleadem May 29, 2024
78ff480
Clean up code
amyleadem May 30, 2024
0bb3b3a
Check for existence of slot elements before manipulating
amyleadem May 30, 2024
f346baf
Generate logo wrapper; clean up code and comments
amyleadem May 30, 2024
d732d9d
Add examples of diff logo counts
amyleadem May 30, 2024
cb1fcb7
Create card component
mahoneycm Jun 4, 2024
2bf476c
Remove identifier to isolate component
mahoneycm Jun 4, 2024
80b74a5
Switch to slot approach
mahoneycm Jun 4, 2024
16ffebb
Add component markup
mahoneycm Jun 4, 2024
e588cd8
Add usa-card group component
mahoneycm Jun 7, 2024
8b88b43
Add flag variant
mahoneycm Jun 7, 2024
d0b9832
Remove console.log
mahoneycm Jun 7, 2024
698f559
Add all variant classes
mahoneycm Jun 7, 2024
104f0a3
Add all variants to index.html
mahoneycm Jun 7, 2024
fb9d0f8
Update properties to use reactive props syntax
mahoneycm Jun 11, 2024
e264fed
Co-authored-by: James Mejia <[email protected]>
mahoneycm Jun 11, 2024
f977c70
Add card variants to storybook
mahoneycm Jun 12, 2024
833036a
Remove unused variants
mahoneycm Jun 12, 2024
0dc2b0a
testing conditional image
mahoneycm Jun 12, 2024
ed9e4eb
Add conditional header first logic
mahoneycm Jun 14, 2024
873193d
Remove unused setClasses function
mahoneycm Jun 14, 2024
f89956b
Revise variant approach
mahoneycm Jun 14, 2024
80b53fd
Use new variant attributes
mahoneycm Jun 14, 2024
51f8461
Fix exdent check
mahoneycm Jun 14, 2024
cb347f6
Fix indent example in index.html
mahoneycm Jun 14, 2024
ef16691
Update storybook controls
mahoneycm Jun 14, 2024
97b3626
Remove unused functions, update attributes to kebab case
mahoneycm Jun 26, 2024
1c6fb6c
Normalize storybook controls, add card group example
mahoneycm Jun 27, 2024
bfe9ccc
Add flag variants to card group
mahoneycm Jun 27, 2024
008dc99
Add expanded control panel to display descriptions
mahoneycm Jun 27, 2024
42393e6
Set heading styles via card-heading slot
mahoneycm Jul 2, 2024
1e190c9
Abstract styles to usa-card.scss.js
mahoneycm Jul 2, 2024
ff84c5f
Merge branch 'develop' of github.com:uswds/uswds-next into cm/lit-card
mahoneycm Jul 3, 2024
434007d
Move components to src/components
mahoneycm Jul 3, 2024
8808009
Fix card group html display
mahoneycm Jul 3, 2024
93a482a
Add story description for flag media right
mahoneycm Jul 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .storybook/preview.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const preview = {
color: /(background|color)$/i,
date: /Date$/i,
},
expanded: true,
},
docs: {
toc: true, // Autogenerate table of contents.
Expand Down
24 changes: 24 additions & 0 deletions src/components/usa-card-group/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { LitElement, html, unsafeCSS } from "lit";
import usaCardStyle from "@uswds/uswds/scss/usa-card?inline";

Copy link
Collaborator

Choose a reason for hiding this comment

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

suggestion: Could you please add some JSDoc comments to explain the props/attributes for this component? If you end up adding any style hooks, add those in too. Take a look at the supported metadata for custom element manifests to see what's available.

export class UsaCardGroup extends LitElement {
static styles = [
unsafeCSS(usaCardStyle),
]

constructor() {
super();

this.cards = [...this.children];
}

render() {
return html`
<ul class="usa-card-group">
${this.cards.map((card) => html`<li>${card}</li>`)}
</ul>
`
}
}

window.customElements.define("usa-card-group", UsaCardGroup);
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
window.customElements.define("usa-card-group", UsaCardGroup);
customElements.define("usa-card-group", UsaCardGroup);

Loading