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

refactoring react list item template #9188

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading