change: sort task labels based on label color position

This commit is contained in:
Jordan Knott 2020-07-16 20:27:48 -05:00
parent 559fcbc0e4
commit a90ace7a06

View File

@ -166,20 +166,23 @@ const Card = React.forwardRef(
}}
>
{labels &&
labels.map(label => (
<ListCardLabel
onAnimationEnd={() => {
if (setToggleLabels) {
setToggleLabels(false);
}
}}
variant={labelVariant ?? 'large'}
color={label.labelColor.colorHex}
key={label.id}
>
<ListCardLabelText>{label.name}</ListCardLabelText>
</ListCardLabel>
))}
labels
.slice()
.sort((a, b) => a.labelColor.position - b.labelColor.position)
.map(label => (
<ListCardLabel
onAnimationEnd={() => {
if (setToggleLabels) {
setToggleLabels(false);
}
}}
variant={labelVariant ?? 'large'}
color={label.labelColor.colorHex}
key={label.id}
>
<ListCardLabelText>{label.name}</ListCardLabelText>
</ListCardLabel>
))}
</ListCardLabels>
{editable ? (
<EditorContent>