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(components): create post-list component #3812

Open
wants to merge 44 commits into
base: main
Choose a base branch
from

Conversation

myrta2302
Copy link
Contributor

No description provided.

@myrta2302 myrta2302 requested review from a team as code owners October 24, 2024 06:07
@myrta2302 myrta2302 linked an issue Oct 24, 2024 that may be closed by this pull request
Copy link

changeset-bot bot commented Oct 24, 2024

🦋 Changeset detected

Latest commit: 00f1c2e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 16 packages
Name Type
@swisspost/design-system-documentation Minor
@swisspost/design-system-components Minor
@swisspost/design-system-components-angular-workspace Patch
@swisspost/design-system-components-react Minor
@swisspost/design-system-components-angular Minor
@swisspost/design-system-nextjs-integration Patch
@swisspost/design-system-styles Minor
@swisspost/design-system-tokens Minor
@swisspost/design-system-intranet-header Minor
@swisspost/design-system-icons Minor
@swisspost/design-system-migrations Minor
@swisspost/design-system-styles-primeng Minor
@swisspost/internet-header Patch
@swisspost/design-system-intranet-header-workspace Patch
@swisspost/design-system-styles-primeng-workspace Patch
@swisspost/design-system-intranet-header-showcase Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@swisspost-bot
Copy link
Contributor

swisspost-bot commented Oct 24, 2024

Related Previews

@myrta2302 myrta2302 changed the title 3544 component post-list /post-list-item feat(components): create post-list component Oct 24, 2024
@alizedebray alizedebray added this to the PPNL Components milestone Oct 29, 2024
Copy link

sonarcloud bot commented Nov 4, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
2 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Comment on lines +18 to +19
## `<post-list>`

Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
## `<post-list>`

Comment on lines +41 to +53
render: args =>
html`<post-list
title-hidden="${args.titleHidden ? args.titleHidden : nothing}"
horizontal="${args.horizontal ? args.horizontal : nothing}"
style="${args.listTitleGap !== null
? `--post-list-title-gap: ${args.listTitleGap}rem;`
: ''}${args.listItemGap !== null ? ` --post-list-item-gap: ${args.listItemGap}rem` : ''}"
>
<h3>Title</h3>
<post-list-item>List Item 1</post-list-item>
<post-list-item>List Item 2</post-list-item>
<post-list-item>List Item 3</post-list-item>
</post-list> `,
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
render: args =>
html`<post-list
title-hidden="${args.titleHidden ? args.titleHidden : nothing}"
horizontal="${args.horizontal ? args.horizontal : nothing}"
style="${args.listTitleGap !== null
? `--post-list-title-gap: ${args.listTitleGap}rem;`
: ''}${args.listItemGap !== null ? ` --post-list-item-gap: ${args.listItemGap}rem` : ''}"
>
<h3>Title</h3>
<post-list-item>List Item 1</post-list-item>
<post-list-item>List Item 2</post-list-item>
<post-list-item>List Item 3</post-list-item>
</post-list> `,
render: args => {
let styles;
if (args.listTitleGap) styles += `--post-list-title-gap: ${args.listTitleGap};`;
if (args.listItemGap) styles += `--post-list-item-gap: ${args.listItemGap};`;
return html`<post-list
title-hidden="${args.titleHidden ? args.titleHidden : nothing}"
horizontal="${args.horizontal ? args.horizontal : nothing}"
style="${styles ? styles : nothing}"
>
<h3>Title</h3>
<post-list-item>List Item 1</post-list-item>
<post-list-item>List Item 2</post-list-item>
<post-list-item>List Item 3</post-list-item>
</post-list> `;
},

listItemGap: {
name: '--post-list-item-gap',
description: 'Defines the gap between list items.',
control: { type: 'number', min: 0, max: 10, step: 1 },
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
control: { type: 'number', min: 0, max: 10, step: 1 },
control: { type: 'text' },

listTitleGap: {
name: '--post-list-title-gap',
description: 'Defines the gap between the title and the list items.',
control: { type: 'number', min: 0, max: 10, step: 1 },
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
control: { type: 'number', min: 0, max: 10, step: 1 },
control: { type: 'text' },

/**
* The unique title of the list that is also referenced in the labelledby
*/
@State() uuid: string;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
@State() uuid: string;
@State() titleId: string;

/**
* Get the id set on the host element or use a random id by default
*/
this.uuid = `list-${crypto.randomUUID()}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
this.uuid = `list-${crypto.randomUUID()}`;
this.titleId= `list-title-${crypto.randomUUID()}`;

<Host data-version={version}>
<div
ref={el => (this.titleEl = el)}
id={this.uuid}
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
id={this.uuid}
id={this.titleId}

>
<slot></slot>
</div>
<div role="list" aria-labelledby={this.uuid}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
<div role="list" aria-labelledby={this.uuid}>
<div role="list" aria-labelledby={this.titleId}>

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.

[component]: List
4 participants