Skip to content

Commit

Permalink
refactor: remove array for drawn region labels (#542)
Browse files Browse the repository at this point in the history
  • Loading branch information
stew-ro authored Sep 4, 2020
1 parent 87b6909 commit 343ea16
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/react/components/common/tagInput/tagInputItemLabel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,10 @@ export interface ITagInputItemLabelState {}

export default class TagInputItemLabel extends React.Component<ITagInputItemLabelProps, ITagInputItemLabelState> {
public render() {
const drawnRegions = [];
const texts = [];
let hasEmptyTextValue = false;
this.props.label.value.forEach((formRegion: IFormRegion, idx) => {
if (formRegion.text === "" && !hasEmptyTextValue) {
drawnRegions.push(<FontIcon className="pr-1 pl-1" iconName="RectangleShape" key={idx}/>)
if (formRegion.text === "") {
hasEmptyTextValue = true;
} else {
texts.push(formRegion.text);
Expand All @@ -35,7 +33,9 @@ export default class TagInputItemLabel extends React.Component<ITagInputItemLabe
>
<div className="flex-center">
{text}
{drawnRegions}
{hasEmptyTextValue &&
<FontIcon className="pr-1 pl-1" iconName="RectangleShape"/>
}
</div>
</div>
);
Expand Down

0 comments on commit 343ea16

Please sign in to comment.