Skip to content

Commit dd2130e

Browse files
committed
chore(platform): add subtitle to list
1 parent 98c8dec commit dd2130e

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

packages/platform/src/app/components/list/List.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ export interface AppListProps extends Omit<React.HTMLAttributes<HTMLUListElement
77
aList: {
88
avatar?: React.ReactNode;
99
title?: React.ReactNode;
10+
subtitle?: React.ReactNode;
1011
description?: React.ReactNode;
1112
props?: React.HTMLAttributes<HTMLLIElement>;
1213
}[];
@@ -23,12 +24,13 @@ export function AppList(props: AppListProps): JSX.Element | null {
2324

2425
return (
2526
<ul {...restProps} className={getClassName(restProps.className, 'app-list')}>
26-
{aList.map(({ avatar, title, description, props }, index) => (
27+
{aList.map(({ avatar, title, subtitle, description, props }, index) => (
2728
<React.Fragment key={index}>
2829
<li {...props} className={getClassName(props?.className, 'app-list__item')}>
2930
{checkNodeExist(avatar) && <div className="app-list__avatar">{avatar}</div>}
3031
<div className="app-list__content">
3132
{checkNodeExist(title) && <div className="app-list__title">{title}</div>}
33+
{checkNodeExist(subtitle) && <div className="app-list__subtitle">{subtitle}</div>}
3234
{checkNodeExist(description) && <div className="app-list__description">{description}</div>}
3335
</div>
3436
</li>

packages/platform/src/app/routes/layout/header/notification/Notification.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,10 @@ export function AppNotification(props: React.ButtonHTMLAttributes<HTMLButtonElem
4646
title: notify.title,
4747
panel: (
4848
<AppList
49-
aList={notify.list.map((item) => ({
49+
aList={notify.list.map((item, index) => ({
5050
avatar: <DAvatar dImg={{ src: '/assets/imgs/avatar.png', alt: 'avatar' }}></DAvatar>,
5151
title: 'name',
52+
subtitle: index === 0 && new Date().toLocaleString(),
5253
description: item.message,
5354
props: {
5455
className: getClassName(styles['app-notification__item'], {

packages/platform/src/styles/components/list.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,16 @@
1919

2020
@include e(title) {
2121
font-weight: 500;
22+
}
2223

23-
& + .app-list__description {
24-
margin-top: 4px;
25-
}
24+
@include e(subtitle) {
25+
/* stylelint-disable-next-line declaration-property-value-allowed-list */
26+
font-size: 10px;
27+
color: var(--#{$rd-prefix}text-color-sub);
2628
}
2729

2830
@include e(description) {
31+
margin-top: 4px;
2932
color: var(--#{$rd-prefix}text-color-sub);
3033
}
3134
}

0 commit comments

Comments
 (0)