{# @description The size of a move and which way it went, as a small badge: an arrow, a spoken direction and the amount. Every trend stat uses it, and it stands alone beside any figure. #} {# @prop change:text | description:"The size of the move, already formatted: 12%, 4, €1.2k" #} {# @prop direction:select['up', 'down', 'flat'] | default:"up" | description:"Which way the figure moved" #} {# @prop inverse:boolean | default:False | description:"Set where a fall is the good news: lead time, failures, cost. It swaps which direction is coloured as good." #} {# @prop class:text | description:"Extra classes on the badge" #} {% comment %} Built on daisy-cotton's badge. The arrow and a spoken direction carry the move, so the colour only repeats it. Whether a move is good is the caller's to say, which is what `inverse` is for. {% endcomment %} {% load i18n %} {% if direction == 'flat' %}{% translate "No change" %}{% elif direction == 'down' %}{% translate "Down" %}{% else %}{% translate "Up" %}{% endif %} {{ change }}