From 365ccf159e51f85dbe81c85e8c9adaed7149159c Mon Sep 17 00:00:00 2001 From: Phin Wolkwitz Date: Fri, 9 Feb 2024 13:29:40 +0100 Subject: [PATCH] Widget: Change text when expanding variations (Z#23141075) (#3852) * Add text change to variation toggle * Add svg caret * Fix svg and css * update caret-svg, add fill-link-color and animation * Use computed property for link text * Rename variable according to code review * Improve texts --------- Co-authored-by: Richard Schreiber --- src/pretix/static/pretixpresale/js/widget/widget.js | 8 ++++++-- src/pretix/static/pretixpresale/scss/widget.scss | 12 ++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/pretix/static/pretixpresale/js/widget/widget.js b/src/pretix/static/pretixpresale/js/widget/widget.js index 14a7e0124..1b32fbc15 100644 --- a/src/pretix/static/pretixpresale/js/widget/widget.js +++ b/src/pretix/static/pretixpresale/js/widget/widget.js @@ -53,7 +53,8 @@ var strings = { 'voucher_code': django.pgettext('widget', 'Voucher code'), 'close': django.pgettext('widget', 'Close'), 'continue': django.pgettext('widget', 'Continue'), - 'variations': django.pgettext('widget', 'See variations'), + 'variations': django.pgettext('widget', 'Show variants'), + 'hide_variations': django.pgettext('widget', 'Hide variants'), 'back_to_list': django.pgettext('widget', 'Choose a different event'), 'back_to_dates': django.pgettext('widget', 'Choose a different date'), 'back': django.pgettext('widget', 'Back'), @@ -503,7 +504,7 @@ Vue.component('item', { // Availability + '
' + ''+ strings.variations + '' + + ' v-bind:aria-expanded="expanded ? \'true\': \'false\'" v-bind:aria-controls="item.id + \'-variants\'">{{ variationsToggleLabel }}' + '' + '
' @@ -600,6 +601,9 @@ Vue.component('item', { return this.$root.currency + " " + floatformat(this.item.min_price, 2); } }, + variationsToggleLabel: function () { + return this.expanded ? strings.hide_variations : strings.variations; + }, } }); Vue.component('category', { diff --git a/src/pretix/static/pretixpresale/scss/widget.scss b/src/pretix/static/pretixpresale/scss/widget.scss index 589929559..fccad8253 100644 --- a/src/pretix/static/pretixpresale/scss/widget.scss +++ b/src/pretix/static/pretixpresale/scss/widget.scss @@ -429,6 +429,18 @@ .pretix-widget-item-availability-col { text-align: center; + + a::before { + content: ""; + display: inline-block; + width: $font-size-base; + height: $font-size-base; + background: url("data:image/svg+xml,%3Csvg viewBox='0 0 14 14' xmlns='http://www.w3.org/2000/svg' xml:space='preserve'%3E%3Cpath fill='#{url-friendly-colour($link-color)}' d='M6.395 4.151a.268.268 0 0 0-.177.077l-.386.386a.259.259 0 0 0-.077.177c.002.067.029.13.077.179l3.033 3.031-3.033 3.032a.255.255 0 0 0-.077.177.253.253 0 0 0 .077.178l.386.385a.268.268 0 0 0 .177.077.27.27 0 0 0 .178-.077l3.595-3.595a.259.259 0 0 0 .077-.177.255.255 0 0 0-.077-.176L6.573 4.228a.257.257 0 0 0-.178-.077Z'/%3E%3C/svg%3E"); + transition: transform .5s; + } + a[aria-expanded=true]::before { + transform: rotate(90deg); + } } .pretix-widget-availability-gone {