Skip to content

Commit

Permalink
Add support for secondary list item text
Browse files Browse the repository at this point in the history
  • Loading branch information
Studio384 committed Aug 19, 2022
1 parent 97565e2 commit 98eefa2
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
14 changes: 7 additions & 7 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"vite-plugin-dts": "1.4.1"
},
"peerDependencies": {
"@sippy-platform/mellow-css": ">=0.11.0",
"@sippy-platform/mellow-css": ">=0.14.0",
"@sippy-platform/valkyrie": ">=0.15.0",
"react": "^17.0.0 || ^18.0.0",
"react-dom": "^17.0.0 || ^18.0.0"
Expand Down
6 changes: 6 additions & 0 deletions src/components/ListItem/ListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ export type ListItemProps<T extends ElementType> = {
* Show a label around the list
*/
primary: string;
/**
* Show a label around the list
*/
secondary?: string;
/**
* Show the list item as active
*/
Expand Down Expand Up @@ -67,6 +71,7 @@ export type ListItemProps<T extends ElementType> = {
export function ListItem<T extends ElementType>({
active,
primary,
secondary,
className,
href,
onClick,
Expand Down Expand Up @@ -103,6 +108,7 @@ export function ListItem<T extends ElementType>({
{startAction && <span className="list-item-action-s">{startAction}</span>}
{startIcon && <span className="list-item-icon-s">{startIcon}</span>}
{primary && <span className={clsx('list-item-label', { 'text-truncate': truncate })}>{primary}</span>}
{secondary && <span className={clsx('list-item-description', { 'text-truncate': truncate })}>{secondary}</span>}
{endIcon && <span className="list-item-icon-e">{endIcon}</span>}
{endAction && <span className="list-item-action-e">{endAction}</span>}
</Component>
Expand Down
1 change: 1 addition & 0 deletions src/docs/pages/Components/ListDemo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export default function ListDemo() {
/>
<ListItem
primary="This is also list item"
secondary="This is a list item description"
endAction={<Radio value="second" />}
/>
<ListItemDivider
Expand Down

0 comments on commit 98eefa2

Please sign in to comment.