Skip to content

Commit

Permalink
refactoring list item template (#9188)
Browse files Browse the repository at this point in the history
Co-authored-by: OlgaLarina <[email protected]>
  • Loading branch information
OlgaLarina and OlgaLarina authored Dec 19, 2024
1 parent ea06e07 commit 2604383
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions packages/survey-react-ui/src/components/list/list-item-content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,34 +22,26 @@ export class ListItemContent extends SurveyElementBase<IListItemProps, any> {
render(): React.JSX.Element | null {
if (!this.item) return null;

const content: Array<React.JSX.Element> = [];
const text = this.renderLocString(this.item.locTitle, undefined, "locString");
if (this.item.iconName) {
const icon = <SvgIcon
key={"icon"}
const icon = (this.item.iconName) ?
<SvgIcon
className={this.model.cssClasses.itemIcon}
iconName={this.item.iconName}
size={this.item.iconSize}
aria-label={this.item.title}
></SvgIcon>;
content.push(icon);
content.push(<span key={"text"}>{text}</span>);
} else {
content.push(text);
}
></SvgIcon> : null;

if (this.item.markerIconName) {
const icon = <SvgIcon
key={"marker"}
const markerIcon = (this.item.markerIconName) ?
<SvgIcon
className={this.item.cssClasses.itemMarkerIcon}
iconName={this.item.markerIconName}
size={"auto"}
></SvgIcon>;
content.push(icon);
}
></SvgIcon> : null;

return <>
{content}
{icon}
{text}
{markerIcon}
</>;
}
}
Expand Down

0 comments on commit 2604383

Please sign in to comment.