Skip to content

Commit 2e245cf

Browse files
author
matthew.hardern
committed
feat(pie-list): improve list item styling and add new stories
Update list item component to enhance typography and layout: - Use p.font-size() for better font size control - Add line-height to primary text for improved readability - Change compact variant padding for better vertical alignment - Convert secondary text div to p element for semantic markup - Adjust meta text font size using p.font-size() - Remove margin from secondary text Add new stories for list items with secondary text and icons/thumbnails
1 parent b752c0c commit 2e245cf

3 files changed

Lines changed: 43 additions & 5 deletions

File tree

apps/pie-storybook/stories/pie-list.stories.ts

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,42 @@ export const CheckboxLeadingListItem: Story = {
192192
`,
193193
};
194194

195+
export const IconLeadingListItemSecondaryText: Story = {
196+
name: 'List Item - Icon Leading - Secondary Text',
197+
parameters: {
198+
backgrounds: {
199+
default: 'background-subtle',
200+
},
201+
},
202+
render: () => html`
203+
<div style="width: 350px">
204+
<pie-list>
205+
<pie-list-item leadingType="icon" primaryText="Next payment" secondaryText="4 May 2025, £1.99 per month">
206+
<icon-plus-circle size="m" slot="leading"></icon-plus-circle>
207+
</pie-list-item>
208+
</pie-list>
209+
</div>
210+
`,
211+
};
212+
213+
export const ThumbnailLeadingListItemSecondaryText: Story = {
214+
name: 'List Item - Thumbnail Leading - Secondary Text',
215+
parameters: {
216+
backgrounds: {
217+
default: 'background-subtle',
218+
},
219+
},
220+
render: () => html`
221+
<div style="width: 350px">
222+
<pie-list>
223+
<pie-list-item leadingType="thumbnail" primaryText="Next payment" secondaryText="4 May 2025, £1.99 per month">
224+
<img slot="leading" src="https://placehold.co/32x24" alt="placeholder">
225+
</pie-list-item>
226+
</pie-list>
227+
</div>
228+
`,
229+
};
230+
195231
//----------------------------------------------------------------------
196232
// 2. INTERACTIVITY (INTERACTIVE/NON-INTERACTIVE)
197233
//----------------------------------------------------------------------

packages/components/pie-list/src/pie-list-item/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -488,7 +488,7 @@ export class PieListItem extends RtlMixin(PieElement) implements ListItemProps {
488488
489489
<!-- Secondary text -->
490490
${this.secondaryText ? html`
491-
<div class="c-list-item__secondary">${this.secondaryText}</div>
491+
<p class="c-list-item__secondary">${this.secondaryText}</p>
492492
` : html`
493493
<slot name="secondary"></slot>
494494
`}

packages/components/pie-list/src/pie-list-item/list-item.scss

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@
3535
// Primary text styles
3636
.c-list-item__primary {
3737
color: var(--dt-color-content-default);
38-
font-size: var(--dt-font-body-l-size);
38+
font-size: #{p.font-size(--dt-font-body-l-size)};
3939
font-weight: var(--dt-font-weight-regular);
40+
line-height: #{p.line-height(--dt-font-body-l-line-height)};
4041
overflow: hidden;
4142
text-overflow: ellipsis;
4243
white-space: nowrap;
@@ -45,10 +46,11 @@
4546
// Secondary text styles
4647
.c-list-item__secondary {
4748
color: var(--dt-color-content-subdued);
48-
font-size: var(--dt-font-body-s-size);
49+
font-size: #{p.font-size(--dt-font-body-s-size)};
4950
overflow: hidden;
5051
text-overflow: ellipsis;
5152
white-space: nowrap;
53+
margin: 0;
5254
}
5355

5456
// Leading content container - using logical properties for RTL support
@@ -72,15 +74,15 @@
7274
// Meta text styles
7375
.c-list-item__meta {
7476
color: var(--dt-color-content-subdued);
75-
font-size: var(--dt-font-body-s-size);
77+
font-size: #{p.font-size(--dt-font-body-s-size)};
7678
white-space: nowrap;
7779
overflow: hidden;
7880
text-overflow: ellipsis;
7981
}
8082

8183
// Compact variation
8284
.c-list-item--compact {
83-
padding-block: var(--dt-spacing-b);
85+
padding-block: var(--dt-spacing-c);
8486
padding-inline: var(--dt-spacing-d);
8587
min-height: 40px;
8688
}

0 commit comments

Comments
 (0)