hr-design-system-handlebars 0.123.7 → 0.124.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +26 -0
- package/build/handlebars/helpers/handlebar-helpers.js +12 -0
- package/dist/assets/brand/_default/conf/locatags.json +11 -1
- package/dist/assets/brand/hessenschau/conf/locatags.json +1 -0
- package/dist/assets/brand/hr/conf/locatags.json +1 -0
- package/dist/assets/brand/hr-bigband/conf/locatags.json +1 -0
- package/dist/assets/brand/hr-fernsehen/conf/locatags.json +1 -0
- package/dist/assets/brand/hr-inforadio/conf/locatags.json +1 -0
- package/dist/assets/brand/hr-rundfunkrat/conf/locatags.json +1 -0
- package/dist/assets/brand/hr-sinfonieorchester/conf/locatags.json +1 -0
- package/dist/assets/brand/hr-werbung/conf/locatags.json +1 -0
- package/dist/assets/brand/hr1/conf/locatags.json +1 -0
- package/dist/assets/brand/hr2/conf/locatags.json +1 -0
- package/dist/assets/brand/hr3/conf/locatags.json +1 -0
- package/dist/assets/brand/hr4/conf/locatags.json +1 -0
- package/dist/assets/brand/you-fm/conf/locatags.json +1 -0
- package/dist/assets/index.css +423 -62
- package/dist/assets/js/components/event/filtererDs.feature.js +298 -0
- package/dist/assets/js/components/event/nativeScrollDs.feature.js +110 -0
- package/dist/assets/js/components/modal/modal.feature.js +38 -0
- package/dist/views/components/base/image/responsive_image.hbs +1 -0
- package/dist/views/components/base/link.hbs +3 -15
- package/dist/views/components/base/link_open.hbs +13 -0
- package/dist/views/components/button/button_pseudo_v2.hbs +12 -0
- package/dist/views/components/button/button_v2.hbs +7 -0
- package/dist/views/components/button/components/button_icon.hbs +1 -0
- package/dist/views/components/button/components/button_label.hbs +1 -0
- package/dist/views/components/button/components/button_pseudo_link.hbs +3 -0
- package/dist/views/components/event/artist.hbs +1 -0
- package/dist/views/components/event/calendar/event_calendar.hbs +3 -0
- package/dist/views/components/event/calendar/event_calendar_content.hbs +18 -0
- package/dist/views/components/event/calendar/event_calendar_event_teaser.hbs +60 -0
- package/dist/views/components/event/calendar/event_calendar_footer.hbs +8 -0
- package/dist/views/components/event/calendar/event_calendar_heading.hbs +3 -0
- package/dist/views/components/event/calendar/event_calendar_inline.hbs +3 -0
- package/dist/views/components/event/calendar/event_calendar_nav.hbs +27 -0
- package/dist/views/components/event/calendar/event_calendar_nav_item.hbs +7 -0
- package/dist/views/components/event/concert_info.hbs +66 -0
- package/dist/views/components/event/event_details.hbs +20 -0
- package/dist/views/components/event/event_status.hbs +1 -0
- package/dist/views/components/event/event_tag.hbs +3 -0
- package/dist/views/components/event/event_tags.hbs +11 -0
- package/dist/views/components/event/event_ticket_button.hbs +30 -0
- package/dist/views/components/label/label_byline.hbs +7 -0
- package/dist/views/components/label/label_group.hbs +3 -0
- package/dist/views/components/label/label_test.hbs +11 -0
- package/dist/views/components/modal/modal.hbs +7 -0
- package/dist/views/components/teaser/components/teaser_header.hbs +3 -0
- package/dist/views/components/teaser/components/teaser_heading.hbs +3 -1
- package/dist/views/components/teaser/components/teaser_headline.hbs +3 -0
- package/dist/views/components/teaser/components/teaser_title_classes.hbs +3 -0
- package/dist/views/components/teaser/components/teaser_title_test.hbs +3 -0
- package/dist/views/components/teaser/components/teaser_topline.hbs +1 -5
- package/dist/views/components/teaser/teaser_event_calendar.hbs +8 -0
- package/gulpfile.js +5 -1
- package/package.json +4 -2
- package/src/assets/brand/_default/conf/locatags.json +11 -1
- package/src/assets/brand/hessenschau/conf/locatags.json +1 -0
- package/src/assets/brand/hessenschau/conf/locatags.merged.json +10 -0
- package/src/assets/brand/hr/conf/locatags.json +1 -0
- package/src/assets/brand/hr/conf/locatags.merged.json +10 -0
- package/src/assets/brand/hr-bigband/conf/locatags.json +1 -0
- package/src/assets/brand/hr-bigband/conf/locatags.merged.json +10 -0
- package/src/assets/brand/hr-fernsehen/conf/locatags.json +1 -0
- package/src/assets/brand/hr-fernsehen/conf/locatags.merged.json +10 -0
- package/src/assets/brand/hr-inforadio/conf/locatags.json +1 -0
- package/src/assets/brand/hr-inforadio/conf/locatags.merged.json +10 -0
- package/src/assets/brand/hr-rundfunkrat/conf/locatags.json +1 -0
- package/src/assets/brand/hr-rundfunkrat/conf/locatags.merged.json +10 -0
- package/src/assets/brand/hr-sinfonieorchester/conf/locatags.json +1 -0
- package/src/assets/brand/hr-sinfonieorchester/conf/locatags.merged.json +10 -0
- package/src/assets/brand/hr-werbung/conf/locatags.json +1 -0
- package/src/assets/brand/hr-werbung/conf/locatags.merged.json +10 -0
- package/src/assets/brand/hr1/conf/locatags.json +1 -0
- package/src/assets/brand/hr1/conf/locatags.merged.json +10 -0
- package/src/assets/brand/hr2/conf/locatags.json +1 -0
- package/src/assets/brand/hr2/conf/locatags.merged.json +10 -0
- package/src/assets/brand/hr3/conf/locatags.json +1 -0
- package/src/assets/brand/hr3/conf/locatags.merged.json +10 -0
- package/src/assets/brand/hr4/conf/locatags.json +1 -0
- package/src/assets/brand/hr4/conf/locatags.merged.json +10 -0
- package/src/assets/brand/you-fm/conf/locatags.json +1 -0
- package/src/assets/brand/you-fm/conf/locatags.merged.json +10 -0
- package/src/assets/css/custom-components.css +8 -0
- package/src/assets/css/custom-utilities.css +36 -0
- package/src/assets/fixtures/event/calendar/event_calendar.inc.json +10 -0
- package/src/assets/fixtures/event/calendar/event_calendar_event_teaser.inc.json +89 -0
- package/src/assets/fixtures/event/calendar/event_calendar_event_teaser.json +4 -0
- package/src/assets/fixtures/event/calendar/event_calendar_footer.json +14 -0
- package/src/assets/fixtures/event/calendar/event_calendar_months.inc.json +1295 -0
- package/src/assets/fixtures/teaser/teaser_event_calendar_100_no_future_events.json +24 -0
- package/src/assets/fixtures/teaser/teaser_event_calendar_100_serif.json +21 -0
- package/src/assets/fixtures/teaser/teaser_images.inc.json +21 -0
- package/src/assets/fixtures/teaser/teaser_labels.inc.json +12 -0
- package/src/assets/fixtures/teaser/teasers.inc.json +31 -0
- package/src/assets/tailwind.css +43 -5
- package/src/stories/views/components/base/image/responsive_image.hbs +1 -0
- package/src/stories/views/components/base/link.hbs +3 -15
- package/src/stories/views/components/base/link_open.hbs +13 -0
- package/src/stories/views/components/button/button_pseudo_v2.hbs +12 -0
- package/src/stories/views/components/button/button_v2.hbs +7 -0
- package/src/stories/views/components/button/components/button_icon.hbs +1 -0
- package/src/stories/views/components/button/components/button_label.hbs +1 -0
- package/src/stories/views/components/button/components/button_pseudo_link.hbs +3 -0
- package/src/stories/views/components/event/artist.hbs +1 -0
- package/src/stories/views/components/event/calendar/event_calendar.hbs +3 -0
- package/src/stories/views/components/event/calendar/event_calendar_components.stories.mdx +161 -0
- package/src/stories/views/components/event/calendar/event_calendar_content.hbs +18 -0
- package/src/stories/views/components/event/calendar/event_calendar_event_teaser.hbs +60 -0
- package/src/stories/views/components/event/calendar/event_calendar_footer.hbs +8 -0
- package/src/stories/views/components/event/calendar/event_calendar_heading.hbs +3 -0
- package/src/stories/views/components/event/calendar/event_calendar_inline.hbs +3 -0
- package/src/stories/views/components/event/calendar/event_calendar_nav.hbs +27 -0
- package/src/stories/views/components/event/calendar/event_calendar_nav_item.hbs +7 -0
- package/src/stories/views/components/event/calendar/fixtures/event_calendar_event_teaser.json +1 -0
- package/src/stories/views/components/event/calendar/fixtures/event_calendar_footer.json +1 -0
- package/src/stories/views/components/event/concert_info.hbs +66 -0
- package/src/stories/views/components/event/event_details.hbs +20 -0
- package/src/stories/views/components/event/event_status.hbs +1 -0
- package/src/stories/views/components/event/event_tag.hbs +3 -0
- package/src/stories/views/components/event/event_tags.hbs +11 -0
- package/src/stories/views/components/event/event_ticket_button.hbs +30 -0
- package/src/stories/views/components/event/filtererDs.feature.js +298 -0
- package/src/stories/views/components/event/nativeScrollDs.feature.js +110 -0
- package/src/stories/views/components/label/label_byline.hbs +7 -0
- package/src/stories/views/components/label/label_group.hbs +3 -0
- package/src/stories/views/components/label/label_test.hbs +11 -0
- package/src/stories/views/components/modal/modal.feature.js +38 -0
- package/src/stories/views/components/modal/modal.hbs +7 -0
- package/src/stories/views/components/teaser/components/teaser_header.hbs +3 -0
- package/src/stories/views/components/teaser/components/teaser_heading.hbs +3 -1
- package/src/stories/views/components/teaser/components/teaser_headline.hbs +3 -0
- package/src/stories/views/components/teaser/components/teaser_title_classes.hbs +3 -0
- package/src/stories/views/components/teaser/components/teaser_title_test.hbs +3 -0
- package/src/stories/views/components/teaser/components/teaser_topline.hbs +1 -5
- package/src/stories/views/components/teaser/fixtures/teaser_event_calendar_100_no_future_events.json +1 -0
- package/src/stories/views/components/teaser/fixtures/teaser_event_calendar_100_serif.json +1 -0
- package/src/stories/views/components/teaser/teaser_event_calendar.hbs +8 -0
- package/src/stories/views/components/teaser/teaser_event_calendar.stories.mdx +131 -0
- package/tailwind.config.js +11 -4
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<nav class="relative border-b border-event-calendar-secondary js-load" data-hr-native-scroll-ds='{"isTeaser":"true"}' data-hr-filterer-ds="{}">
|
|
2
|
+
<button class="block border-0 ml-4 absolute left-0 min-w-3 min-h-3 top-1/2 js-ns-button -left" aria-hidden="true">
|
|
3
|
+
{{> components/base/image/icon _icon="arrow-left" _iconmap="icons" _addClass="w-5 h-5 fill-current" }}
|
|
4
|
+
</button>
|
|
5
|
+
<button class="block border-0 mr-4 absolute right-0 min-w-3 min-h-3 top-1/2 js-ns-button -right" aria-hidden="true">
|
|
6
|
+
{{> components/base/image/icon _icon="arrow-right" _iconmap="icons" _addClass="w-5 h-5 fill-current" }}
|
|
7
|
+
</button>
|
|
8
|
+
<div class="flex relative max-w-100vw ml-14 mr-14 overflow-hidden box-border border-teal-600">
|
|
9
|
+
<div class="flex mb-0 overflow-x-auto overflow-y-hidden whitespace-nowrap scroll-smooth js-ns-scroll -horizontal">
|
|
10
|
+
{{#each this}}
|
|
11
|
+
<div class="inline-block items-center justify-center border-event-calendar-secondary border-l js-ns-month {{#if
|
|
12
|
+
this.isCurrentMonth}} -currentMonth{{/if}}{{#if
|
|
13
|
+
this.hasFutureEventsFromNow}} -selected{{else}} js-fr-reload-trigger{{/if}}">
|
|
14
|
+
<span class="block font-heading font-bold w-24 sticky left-0 px-2 py-3 ">{{this.date.monthNameShort}} {{this.date.yearShort}}</span>
|
|
15
|
+
<ul class="flex">
|
|
16
|
+
{{#each this.days}}
|
|
17
|
+
<li class="inline-block h-full group cursor-pointer js-ns-item{{#if
|
|
18
|
+
this.isStartOfWeek}} border-l border-event-calendar-secondary{{/if}}">
|
|
19
|
+
{{> components/event/calendar/event_calendar_nav_item _contentUrl=../this.contentUrl}}
|
|
20
|
+
</li>
|
|
21
|
+
{{/each}}
|
|
22
|
+
</ul>
|
|
23
|
+
</div>
|
|
24
|
+
{{/each}}
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
</nav>
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
<a class="js-fr-trigger js-noStateManager block h-full pt-2 pb-2.5 focus:bg-black focus:text-white focus-visible:outline-none hover:bg-black hover:text-white -active{{#if this.isFirstAvailable}} -selected js-fr-initial{{/if}}"
|
|
2
|
+
data-prop-crit='{{this.date.htmlDate}}'
|
|
3
|
+
data-prop-filterer='{"crit":"{{this.date.htmlDate}}","strat":["hobid"]}'
|
|
4
|
+
href="{{_contentUrl}}">
|
|
5
|
+
<span class="block font-serif italic text-center font-bold uppercase pb-2 px-3 text-sm">{{this.date.weekdayNameShort}}</span>
|
|
6
|
+
<span class="block font-serif text-link font-bold text-labelEventCalendarTitle italic text-2xl px-3 pt-1.6 pb-0 group-hover:text-white group-focus:text-white group-focus-within:text-white">{{this.date.day}}</span>
|
|
7
|
+
</a>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"isDateInstant":false,"startDate":{"htmlDate":"2023-01-09","day":9,"weekdayNameShort":"Mon","monthNameShort":"Jan"},"startTime":{"time":"18:00"},"image":{"alttext":"Lorem ipsum","copyrightWithLinks":"","responsiveImage":{"asPicture":true,"asImage":false,"fallback":"images/emmanuel-tjeknavorian-108_v-16to9.jpg","sources":[{"media":"all and (min-width: 1024px)","sizes":"25rem","srcset":"images/emmanuel-tjeknavorian-108_v-16to9__small.jpg 320w, images/emmanuel-tjeknavorian-108_v-16to9__medium.jpg 480w, images/emmanuel-tjeknavorian-108_v-16to9__medium__extended.jpg 640w, images/emmanuel-tjeknavorian-108_v-16to9.jpg 960w, images/emmanuel-tjeknavorian-108_v-16to9__retina.jpg 1920w"},{"media":"all and (max-width: 1023px)","sizes":"(min-width: 640px) 25rem, 100vw","srcset":"images/emmanuel-tjeknavorian-108_v-4to3__small.jpg 320w, images/emmanuel-tjeknavorian-108_v-4to3__medium.jpg 480w, images/emmanuel-tjeknavorian-108_v-4to3.jpg 650w, images/emmanuel-tjeknavorian-108_v-4to3__retina.jpg 1300w"}]}},"link":{"url":"/event_100","webviewUrl":"/event_100#webview","isTargetBlank":false,"hasIcon":false,"iconName":"iconName","readMoreText":{"readMoreScreenreader":"Zum Event","readMore":"mehr","readMoreLong":"read More Long"}},"label":{"type":"event","loca":"label_concert","byline":{"bylineSsi":"14.10.22, 20:00 Uhr","bylineText":"BylineText"}},"title":"Finale: Landeswettbewerb Jugend jazzt Hessen für Big Bands","eventtags":{"series":{"title":"Hessen lacht"},"project":{"title":"HR Bigband sucht den Superjazzer"}},"venue":{"addressCity":"Frankfurt","title":"Festhalle"},"isSoldOut":false,"hasStatus":true,"statusDescriptionForLabelShort":"event_status_cancelled","concertInfo":{"artists":{"artistsAndGroups":[{"artist":{"name":"Peter Maffay","groupName":"hr bigband","role":"Sänger"},"artistGroup":"hr bigband"}],"isEmpty":false,"description":"Tolle Künstler"},"compositions":{"isEmpty":false,"description":"Komposition-Description","compositions":[{"composerAndComposition":true,"composer":"Udo Lindenberg","name":"Horizont"}]},"concertInfoHead":{"title":"Das Fest","description":"Ein tolles Festival erwartet Sie","isEmpty":false},"isEmpty":false}}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"link":{"url":"/monatsuebersicht-100","webviewUrl":"/monatsuebersicht-100#webview","isTargetBlank":false,"hasIcon":false,"iconName":"iconName","readMoreText":{"readMoreScreenreader":"Zum Artikel","readMore":"mehr","readMoreLong":"read More Long"}}}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
{{#with this.concertInfoHead}}
|
|
2
|
+
{{#unless this.isEmpty}}
|
|
3
|
+
<div class="text-center">
|
|
4
|
+
{{#with this.title}}
|
|
5
|
+
<h3 class="font-bold">{{this}}</h3>
|
|
6
|
+
{{/with}}
|
|
7
|
+
{{#with this.description}}
|
|
8
|
+
<p>{{this}}</p>
|
|
9
|
+
{{/with}}
|
|
10
|
+
</div>
|
|
11
|
+
{{/unless}}
|
|
12
|
+
{{/with}}
|
|
13
|
+
{{#with this.artists}}
|
|
14
|
+
{{#unless this.isEmpty}}
|
|
15
|
+
<div class="mt-4">
|
|
16
|
+
{{#with this.description}}
|
|
17
|
+
<p class="text-center ">{{this}}</p>
|
|
18
|
+
{{/with}}
|
|
19
|
+
<ul>
|
|
20
|
+
{{#each this.artistsAndGroups}}
|
|
21
|
+
<li class="text-center{{#with this.artistGroup}} mb-5{{/with}}">
|
|
22
|
+
{{#with this.artist}}
|
|
23
|
+
{{> components/event/artist}}
|
|
24
|
+
{{/with}}
|
|
25
|
+
{{#with this.artistGroup}}
|
|
26
|
+
{{#with this.name}}<h3>{{this}}:</h3>{{/with}}
|
|
27
|
+
{{#with this.artists}}
|
|
28
|
+
<ul>
|
|
29
|
+
{{#each this}}
|
|
30
|
+
<li class="text-center">
|
|
31
|
+
{{> components/event/artist}}
|
|
32
|
+
</li>
|
|
33
|
+
{{/each}}
|
|
34
|
+
</ul>
|
|
35
|
+
{{/with}}
|
|
36
|
+
{{/with}}
|
|
37
|
+
</li>
|
|
38
|
+
{{/each}}
|
|
39
|
+
</ul>
|
|
40
|
+
</div>
|
|
41
|
+
{{/unless}}
|
|
42
|
+
{{/with}}
|
|
43
|
+
{{#with this.compositions}}
|
|
44
|
+
{{#unless this.isEmpty}}
|
|
45
|
+
<div class="text-center">
|
|
46
|
+
{{#with this.description}}<p>{{this}}</p>{{/with}}
|
|
47
|
+
<ul>
|
|
48
|
+
{{#each this.compositions}}
|
|
49
|
+
<li>
|
|
50
|
+
{{#if this.composerAndComposition}}
|
|
51
|
+
<span class="text-center font-bold uppercase">{{this.composer}}</span>
|
|
52
|
+
{{#with this.name}} | <span class="text-center">{{this}}</span>{{/with}}
|
|
53
|
+
{{else}}
|
|
54
|
+
{{#if this.composer}}
|
|
55
|
+
<span class="text-center">{{this.composer}}</span>
|
|
56
|
+
{{/if}}
|
|
57
|
+
{{#if this.name}}
|
|
58
|
+
<span class="text-center">{{this.name}}</span>
|
|
59
|
+
{{/if}}
|
|
60
|
+
{{/if}}
|
|
61
|
+
</li>
|
|
62
|
+
{{/each}}
|
|
63
|
+
</ul>
|
|
64
|
+
</div>
|
|
65
|
+
{{/unless}}
|
|
66
|
+
{{/with}}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
<div class="flex flex-wrap content-center w-full h-full px-2 py-1">
|
|
2
|
+
{{#with this.startTime}}
|
|
3
|
+
<div class="flex grow shrink-1 basis-6/12 align-top p-2">
|
|
4
|
+
<div class="min-w-3 min-h-3">
|
|
5
|
+
{{> components/base/image/icon _icon="clock" _iconmap="icons" _addClass="w-5 h-5 fill-event-calendar-secondary" }}
|
|
6
|
+
</div>
|
|
7
|
+
<time class='text-base pl-4 font-sans font-bold'>{{loca "date_simple_at" this.time}}</time>
|
|
8
|
+
</div>
|
|
9
|
+
{{/with}}
|
|
10
|
+
{{#with this.venue}}
|
|
11
|
+
<div class="flex grow flex-shrink-1 basis-6/12 align-top p-2">
|
|
12
|
+
<div class="min-w-3 min-h-3">
|
|
13
|
+
{{> components/base/image/icon _icon="ortsmarke" _iconmap="icons" _addClass="w-5 h-5 fill-event-calendar-secondary" }}
|
|
14
|
+
</div>
|
|
15
|
+
<div class='flex flex-col text-base pl-4 font-sans font-bold w-full'>{{this.addressCity}}
|
|
16
|
+
<span class="font-normal">{{this.title}}</span>
|
|
17
|
+
</div>
|
|
18
|
+
</div>
|
|
19
|
+
{{/with}}
|
|
20
|
+
</div>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<span class="font-bold text-event-status uppercase{{#if _css}} {{_css}}{{/if}}">{{_status}}</span>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{{#with this}}
|
|
2
|
+
{{#with this.series}}
|
|
3
|
+
{{> components/event/event_tag _title=this.title}}
|
|
4
|
+
{{/with}}
|
|
5
|
+
{{#with this.project}}
|
|
6
|
+
{{> components/event/event_tag _title=this.title}}
|
|
7
|
+
{{/with}}
|
|
8
|
+
{{#with this.externalProject}}
|
|
9
|
+
{{> components/event/event_tag _title=this}}
|
|
10
|
+
{{/with}}
|
|
11
|
+
{{/with}}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
<div class="static pl-4 pt-1 pb-3 sm:absolute sm:pl-0 sm:pt-0 sm:pb-0 sm:right-4 sm:bottom-4">
|
|
2
|
+
{{#> components/button/button_v2 _id=(nextRandom) _type="inverted"}}
|
|
3
|
+
{{> components/button/components/button_icon _icon="ticket" _iconmap="icons" _css="mr-2"}}
|
|
4
|
+
{{>components/button/components/button_label _label="Tickets"}}
|
|
5
|
+
{{/components/button/button_v2}}
|
|
6
|
+
{{#> components/modal/modal _trigger=(getRandom)}}
|
|
7
|
+
{{#> components/teaser/components/teaser_headline}}
|
|
8
|
+
{{> components/teaser/components/teaser_title_test _text=(loca 'ticket_modal_headline') _css="text-2xl"}}
|
|
9
|
+
{{/components/teaser/components/teaser_headline}}
|
|
10
|
+
<p class="text-base font-copy mt-2">{{loca "ticket_modal_text"}}</p>
|
|
11
|
+
|
|
12
|
+
<div class="flex flex-wrap mt-4">
|
|
13
|
+
{{> components/button/button_pseudo _linkCss="mr-4 mt-4 ds-button js-modal-close" _buttonText="Zum Ticketshop" _withLink="true"}}
|
|
14
|
+
<button class="mt-4 ds-button" value="cancel">Abbrechen</button>
|
|
15
|
+
</div>
|
|
16
|
+
{{/components/modal/modal}}
|
|
17
|
+
<noscript>
|
|
18
|
+
<style>
|
|
19
|
+
#{{getRandom}} {
|
|
20
|
+
display:none;
|
|
21
|
+
}
|
|
22
|
+
</style>
|
|
23
|
+
{{#> components/button/components/button_pseudo_link}}
|
|
24
|
+
{{#> components/button/button_pseudo_v2 _type="inverted"}}
|
|
25
|
+
{{> components/button/components/button_icon _icon="ticket" _iconmap="icons" _css="mr-2"}}
|
|
26
|
+
{{>components/button/components/button_label _label="Tickets"}}
|
|
27
|
+
{{/components/button/button_pseudo_v2}}
|
|
28
|
+
{{/components/button/components/button_pseudo_link}}
|
|
29
|
+
</noscript>
|
|
30
|
+
</div>
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
import { pi, uxAction } from 'base/tracking/atiHelper.subfeature'
|
|
2
|
+
import { hr$, isString, listen, reinitializeFeature, simulateClickOn } from 'hrQuery'
|
|
3
|
+
import $ from 'zepto-modules'
|
|
4
|
+
|
|
5
|
+
require('zepto-modules/callbacks')
|
|
6
|
+
require('zepto-modules/deferred')
|
|
7
|
+
|
|
8
|
+
const Filterer = (context) => {
|
|
9
|
+
const { options } = context
|
|
10
|
+
const { element: rootElement } = context
|
|
11
|
+
const contentTargetClass = '.js-fr-content'
|
|
12
|
+
const errorTargetClass = 'js-fr-error-target'
|
|
13
|
+
const errorClass = 'js-fr-error'
|
|
14
|
+
const reloadTriggerClass = 'js-fr-reload-trigger'
|
|
15
|
+
const targetClass = 'js-fr-target'
|
|
16
|
+
const triggerClass = 'js-fr-trigger'
|
|
17
|
+
const triggerDomNodes = hr$(`.${triggerClass}`, rootElement)
|
|
18
|
+
let targetDomNodes = hr$(`.${targetClass}`, rootElement)
|
|
19
|
+
const errorTargetDomNodes = hr$(`.${errorTargetClass}`, rootElement)
|
|
20
|
+
const errorDomNodes = hr$(`.${errorClass}`)
|
|
21
|
+
const contentTargetDomNode = hr$(contentTargetClass, rootElement)[0]
|
|
22
|
+
|
|
23
|
+
const init = function () {
|
|
24
|
+
for (let i = 0; i < triggerDomNodes.length; i++) {
|
|
25
|
+
triggerDomNodes[i].addEventListener('click', doSetSelectedFilter.bind(this))
|
|
26
|
+
triggerDomNodes[i].addEventListener('touch', doSetSelectedFilter.bind(this))
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//die konfigration auf root ebene triggerd das verhalten beim starten
|
|
30
|
+
if (options && options.crit && options.strat) {
|
|
31
|
+
//finden des passenden triggers
|
|
32
|
+
for (i = 0; i < triggerDomNodes.length; i++) {
|
|
33
|
+
if (
|
|
34
|
+
JSON.parse(triggerDomNodes[i].getAttribute('data-prop-filterer')).crit ===
|
|
35
|
+
options.crit
|
|
36
|
+
) {
|
|
37
|
+
doSetSelectedFilter({ currentTarget: triggerDomNodes[i] }, false)
|
|
38
|
+
return
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (
|
|
44
|
+
!rootElement.classList.contains('-excerpt') &&
|
|
45
|
+
!!(window.history && window.history.pushState)
|
|
46
|
+
) {
|
|
47
|
+
listen('popstate', handlePopstate, window)
|
|
48
|
+
//initial state ersetzen so dass es ein rückkehrpunkt gibt
|
|
49
|
+
const selectedTrigger = hr$('.' + triggerClass + '.-selected', rootElement)
|
|
50
|
+
history.replaceState(
|
|
51
|
+
{
|
|
52
|
+
sel: triggerClass,
|
|
53
|
+
cache: false,
|
|
54
|
+
crit:
|
|
55
|
+
selectedTrigger.length > 0
|
|
56
|
+
? selectedTrigger[0].getAttribute('data-prop-crit')
|
|
57
|
+
: triggerDomNodes[0].getAttribute('data-prop-crit'),
|
|
58
|
+
},
|
|
59
|
+
null,
|
|
60
|
+
window.location.href
|
|
61
|
+
)
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const doSetSelectedFilter = function (e, forceReset) {
|
|
66
|
+
clearSelected()
|
|
67
|
+
|
|
68
|
+
if (!forceReset) {
|
|
69
|
+
e.currentTarget.classList.add('-selected')
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//hacky weil e beim start auch kein Event sein kann
|
|
73
|
+
'preventDefault' in e && e.preventDefault()
|
|
74
|
+
|
|
75
|
+
doFilter(e.currentTarget, forceReset, true, true)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const clearSelected = function () {
|
|
79
|
+
let triggerDomNodes = hr$(`.${triggerClass}.-selected`, rootElement)
|
|
80
|
+
|
|
81
|
+
triggerDomNodes.forEach(function (triggerDomNode) {
|
|
82
|
+
triggerDomNode.classList.remove('-selected')
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const doFilter = function (currentTarget, forceReset, push, countXTClick) {
|
|
87
|
+
let data = JSON.parse(currentTarget.getAttribute('data-prop-filterer')),
|
|
88
|
+
crit = currentTarget.getAttribute('data-prop-crit'),
|
|
89
|
+
time = new Date().getTime(),
|
|
90
|
+
reset = forceReset,
|
|
91
|
+
href = currentTarget.getAttribute('href'),
|
|
92
|
+
strat,
|
|
93
|
+
found = false
|
|
94
|
+
|
|
95
|
+
console.log('targets-length:' + targetDomNodes.length)
|
|
96
|
+
|
|
97
|
+
//falls kein array, string in array umheben
|
|
98
|
+
if (isString(data.strat)) {
|
|
99
|
+
strat = []
|
|
100
|
+
strat.push(data.strat)
|
|
101
|
+
} else {
|
|
102
|
+
strat = data.strat
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
for (let i = 0; i < strat.length; i++) {
|
|
106
|
+
if ('hobid' === strat[i]) {
|
|
107
|
+
if ($(currentTarget, rootElement).closest('.' + reloadTriggerClass).length > 0) {
|
|
108
|
+
loadContent(currentTarget)
|
|
109
|
+
} else {
|
|
110
|
+
stratHideOthersById(targetDomNodes, data.crit, reset)
|
|
111
|
+
if (push && !rootElement.classList.contains('-excerpt')) {
|
|
112
|
+
history.pushState(
|
|
113
|
+
{
|
|
114
|
+
sel: '.' + currentTarget + '.-selected',
|
|
115
|
+
crit: data.crit,
|
|
116
|
+
},
|
|
117
|
+
null,
|
|
118
|
+
href
|
|
119
|
+
)
|
|
120
|
+
uxAction('Eventkalender-Monat:: Tag geklickt', 1)
|
|
121
|
+
} else {
|
|
122
|
+
uxAction('Eventkalender:: Tag geklickt', 1)
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
} else if ('hoswid' === strat[i]) {
|
|
126
|
+
if ($(currentTarget, rootElement).closest('.' + reloadTriggerClass).length > 0) {
|
|
127
|
+
loadContent(currentTarget)
|
|
128
|
+
} else {
|
|
129
|
+
stratHideOthersStartsWithId(targetDomNodes, data.crit, reset)
|
|
130
|
+
if (push && !rootElement.classList.contains('-excerpt')) {
|
|
131
|
+
history.pushState(
|
|
132
|
+
{
|
|
133
|
+
sel: '.' + currentTarget + '.-selected',
|
|
134
|
+
crit: data.crit,
|
|
135
|
+
},
|
|
136
|
+
null,
|
|
137
|
+
href
|
|
138
|
+
)
|
|
139
|
+
uxAction('Eventkalender-Monat:: Monat geklickt', 1)
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
} else if ('cs' === strat[i]) {
|
|
143
|
+
clearSelected()
|
|
144
|
+
} else if ('initial' === strat[i]) {
|
|
145
|
+
initial()
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/* if (countXTClick) {
|
|
150
|
+
pi(
|
|
151
|
+
xtpage +
|
|
152
|
+
'&pchap=' +
|
|
153
|
+
xt_chap +
|
|
154
|
+
'&pid=' +
|
|
155
|
+
xt_pageID +
|
|
156
|
+
'&pidt=' +
|
|
157
|
+
xt_pageDate +
|
|
158
|
+
xt_multc
|
|
159
|
+
)
|
|
160
|
+
}*/
|
|
161
|
+
|
|
162
|
+
removeErrors()
|
|
163
|
+
}
|
|
164
|
+
const removeErrors = function () {
|
|
165
|
+
if (errorTargetDomNodes.length > 0) {
|
|
166
|
+
errorTargetDomNodes[0].classList.add('hidden')
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
if (errorDomNodes.length > 0) {
|
|
170
|
+
errorDomNodes[0].classList.add('hidden')
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
const loadContent = function (currentTarget) {
|
|
174
|
+
var url = createInlineUrl(currentTarget),
|
|
175
|
+
ts = new Date().getTime()
|
|
176
|
+
|
|
177
|
+
console.log('load content ' + url)
|
|
178
|
+
|
|
179
|
+
$.ajax({
|
|
180
|
+
type: 'GET',
|
|
181
|
+
dataType: 'html',
|
|
182
|
+
url: url,
|
|
183
|
+
timeout: 90 * 1000,
|
|
184
|
+
cache: true,
|
|
185
|
+
beforeSend: function () {
|
|
186
|
+
console.log('before load')
|
|
187
|
+
$(contentTargetClass, rootElement).addClass('-isLoading')
|
|
188
|
+
},
|
|
189
|
+
})
|
|
190
|
+
.done(function (data, status, xhr) {
|
|
191
|
+
var tsDelta = 500 - (new Date().getTime() - ts)
|
|
192
|
+
|
|
193
|
+
//mindesten 500ms anzeigen
|
|
194
|
+
setTimeout(
|
|
195
|
+
function () {
|
|
196
|
+
console.log('loaded')
|
|
197
|
+
|
|
198
|
+
$(contentTargetClass, rootElement).append(data)
|
|
199
|
+
|
|
200
|
+
targetDomNodes = hr$('.' + targetClass, rootElement)
|
|
201
|
+
$(contentTargetClass, rootElement).removeClass('-isLoading')
|
|
202
|
+
$(currentTarget, rootElement)
|
|
203
|
+
.closest('.' + reloadTriggerClass)
|
|
204
|
+
.removeClass(reloadTriggerClass)
|
|
205
|
+
doFilter(currentTarget, false, true, false)
|
|
206
|
+
reinitializeFeature(contentTargetDomNode)
|
|
207
|
+
},
|
|
208
|
+
tsDelta < 0 ? 0 : tsDelta
|
|
209
|
+
)
|
|
210
|
+
})
|
|
211
|
+
.fail(function (data, status, xhr) {
|
|
212
|
+
console.log('load error')
|
|
213
|
+
$(contentTargetClass, rootElement).addClass('-isLoading')
|
|
214
|
+
})
|
|
215
|
+
}
|
|
216
|
+
const createInlineUrl = function (element) {
|
|
217
|
+
var href = element.getAttribute('href'),
|
|
218
|
+
pos = href.indexOf('~') + 1
|
|
219
|
+
|
|
220
|
+
return href.substr(0, pos) + 'inline' + href.substr(pos)
|
|
221
|
+
}
|
|
222
|
+
const handlePopstate = function (event) {
|
|
223
|
+
var target
|
|
224
|
+
//nur handlen wenn es ein state gibt
|
|
225
|
+
if (event.state.sel) {
|
|
226
|
+
target = $(
|
|
227
|
+
'.' + triggerClass + "[data-prop-crit='" + event.state.crit + "']",
|
|
228
|
+
rootElement
|
|
229
|
+
)[0]
|
|
230
|
+
doFilter(target, false, false)
|
|
231
|
+
clearSelected()
|
|
232
|
+
target.classList.add('-selected')
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
const initial = function () {
|
|
236
|
+
simulateClickOn(hr$('.js-fr-initial', rootElement)[0])
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
const stratHideOthersById = function (targetDomNodes, crit, reset) {
|
|
240
|
+
var i = 0,
|
|
241
|
+
found = false
|
|
242
|
+
|
|
243
|
+
if (reset) {
|
|
244
|
+
for (i = 0; i < targetDomNodes.length; i++) {
|
|
245
|
+
targetDomNodes[i].classList.remove('hidden')
|
|
246
|
+
}
|
|
247
|
+
return
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
for (i = 0; i < targetDomNodes.length; i++) {
|
|
251
|
+
if (targetDomNodes[i].getAttribute('id') !== crit) {
|
|
252
|
+
targetDomNodes[i].classList.add('hidden')
|
|
253
|
+
} else {
|
|
254
|
+
targetDomNodes[i].classList.remove('hidden')
|
|
255
|
+
|
|
256
|
+
found = true
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
displayErrorTarget()
|
|
261
|
+
|
|
262
|
+
return found
|
|
263
|
+
}
|
|
264
|
+
const stratHideOthersStartsWithId = function (targetDomNodes, crit, reset) {
|
|
265
|
+
var i = 0,
|
|
266
|
+
found = false
|
|
267
|
+
|
|
268
|
+
if (reset) {
|
|
269
|
+
for (i = 0; i < targetDomNodes.length; i++) {
|
|
270
|
+
targetDomNodes[i].classList.remove('hidden')
|
|
271
|
+
}
|
|
272
|
+
return
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
for (i = 0; i < targetDomNodes.length; i++) {
|
|
276
|
+
if (targetDomNodes[i].getAttribute('id').indexOf(crit) !== 0) {
|
|
277
|
+
targetDomNodes[i].classList.add('hidden')
|
|
278
|
+
} else {
|
|
279
|
+
targetDomNodes[i].classList.remove('hidden')
|
|
280
|
+
|
|
281
|
+
found = true
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
displayErrorTarget()
|
|
286
|
+
|
|
287
|
+
return found
|
|
288
|
+
}
|
|
289
|
+
const displayErrorTarget = function () {
|
|
290
|
+
if (targetDomNodes.length >= 1) {
|
|
291
|
+
if (errorTargetDomNodes.length > 0) {
|
|
292
|
+
errorTargetDomNodes[0].classList.remove('hidden')
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
init()
|
|
297
|
+
}
|
|
298
|
+
export default Filterer
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { clearRequestInterval, hr$, requestInterval } from 'hrQuery'
|
|
2
|
+
import { uxAction } from 'base/tracking/atiHelper.subfeature'
|
|
3
|
+
|
|
4
|
+
const NativeScroll = function (context) {
|
|
5
|
+
console.log('loaded feature ...')
|
|
6
|
+
const { options } = context,
|
|
7
|
+
{ element: rootElement } = context,
|
|
8
|
+
isTeaser = options.isTeaser
|
|
9
|
+
let buttons,
|
|
10
|
+
scrollbar,
|
|
11
|
+
oneScrollbarItem,
|
|
12
|
+
hideScrollbar = true,
|
|
13
|
+
hasNativeSmoothScroll = false,
|
|
14
|
+
smoothScrollInterval
|
|
15
|
+
// Detect if the browser already supports native smooth scrolling (e.g., Firefox 36+ and Chrome 49+) and it is enabled:
|
|
16
|
+
const isNativeSmoothScrollEnabledOn = function () {
|
|
17
|
+
return 'scroll-behavior' in document.documentElement.style
|
|
18
|
+
}
|
|
19
|
+
const doScroll = function (e) {
|
|
20
|
+
let step = scrollbar.clientWidth - oneScrollbarItem.clientWidth * 1.5,
|
|
21
|
+
direction = e.currentTarget.classList.contains('-left') ? -1 : 1,
|
|
22
|
+
distance = direction * step
|
|
23
|
+
console.log("🚀 ~ file: nativeScroll.feature.js ~ line 22 ~ doScroll ~ direction", direction)
|
|
24
|
+
console.log("🚀 ~ file: nativeScroll.feature.js ~ line 24 ~ doScroll ~ distance", distance)
|
|
25
|
+
|
|
26
|
+
console.log('scrollbar ', scrollbar)
|
|
27
|
+
console.log('scrollbar width ', scrollbar.clientWidth)
|
|
28
|
+
console.log('oneScrollbarItem ', oneScrollbarItem)
|
|
29
|
+
console.log('oneScrollbarItem width ', oneScrollbarItem.clientWidth)
|
|
30
|
+
|
|
31
|
+
if (direction === 1) {
|
|
32
|
+
console.log('right clicked')
|
|
33
|
+
if (isTeaser) uxAction('Eventkalender:: Pfeil rechts geklickt', 1)
|
|
34
|
+
else uxAction('Eventkalender-Monat:: Pfeil rechts geklickt', 1)
|
|
35
|
+
} else {
|
|
36
|
+
console.log('left clicked')
|
|
37
|
+
if (isTeaser) uxAction('Eventkalender:: Pfeil links geklickt', 1)
|
|
38
|
+
else uxAction('Eventkalender-Monat:: Pfeil links geklickt', 1)
|
|
39
|
+
}
|
|
40
|
+
console.log("🚀 ~ file: nativeScroll.feature.js ~ line 42 ~ doScroll ~ hasNativeSmoothScroll", hasNativeSmoothScroll)
|
|
41
|
+
|
|
42
|
+
if (hasNativeSmoothScroll) {
|
|
43
|
+
scrollbar.scrollLeft += distance
|
|
44
|
+
console.log("🚀 ~ file: nativeScroll.feature.js ~ line 43 ~ doScroll ~ scrollbar.scrollLeft", scrollbar.scrollLeft)
|
|
45
|
+
} else {
|
|
46
|
+
console.log('start smooth scroll')
|
|
47
|
+
startSmoothScroll(scrollbar.scrollLeft, Date.now(), distance)
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
const startSmoothScroll = function (start_pos, start_time, distance) {
|
|
51
|
+
clearRequestInterval(smoothScrollInterval)
|
|
52
|
+
|
|
53
|
+
smoothScrollInterval = requestInterval(function () {
|
|
54
|
+
loopSmoothScroll(start_pos, start_time, distance)
|
|
55
|
+
}, 16)
|
|
56
|
+
}
|
|
57
|
+
const loopSmoothScroll = function (start_pos, start_time, distance) {
|
|
58
|
+
let timeLapsed = Date.now() - start_time,
|
|
59
|
+
duration = 900,
|
|
60
|
+
percentage = timeLapsed / duration
|
|
61
|
+
|
|
62
|
+
percentage = percentage > 1 ? 1 : percentage
|
|
63
|
+
console.log("🚀 ~ file: nativeScroll.feature.js ~ line 61 ~ loopSmoothScroll ~ percentage", percentage)
|
|
64
|
+
|
|
65
|
+
scrollbar.scrollLeft = start_pos + distance * easeInOutCubic(percentage)
|
|
66
|
+
|
|
67
|
+
if (percentage === 1) {
|
|
68
|
+
console.log('stop smooth scroll')
|
|
69
|
+
clearRequestInterval(smoothScrollInterval)
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const easeInOutCubic = function (time) {
|
|
74
|
+
// 'easeInOutCubic' - acceleration until halfway, then deceleration
|
|
75
|
+
// time = values from 0 to 1
|
|
76
|
+
return time < 0.5
|
|
77
|
+
? 4 * time * time * time
|
|
78
|
+
: (time - 1) * (2 * time - 2) * (2 * time - 2) + 1
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (hr$('.js-ns-scroll.-horizontal', rootElement).length > 0) {
|
|
82
|
+
scrollbar = hr$('.js-ns-scroll.-horizontal', rootElement)[0]
|
|
83
|
+
buttons = hr$('.js-ns-button', rootElement)
|
|
84
|
+
oneScrollbarItem = hr$('.js-ns-item', rootElement)[0]
|
|
85
|
+
hasNativeSmoothScroll = isNativeSmoothScrollEnabledOn(scrollbar)
|
|
86
|
+
let initiallySelectedMonth = hr$('.js-ns-month.-selected', rootElement)[0]
|
|
87
|
+
if (!initiallySelectedMonth) {
|
|
88
|
+
initiallySelectedMonth = hr$('.js-ns-month.-currentMonth', rootElement)[0]
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (initiallySelectedMonth) {
|
|
92
|
+
scrollbar.scrollLeft = initiallySelectedMonth.offsetLeft
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (hideScrollbar) {
|
|
96
|
+
scrollbar.style.marginBottom = scrollbar.clientHeight - scrollbar.offsetHeight + 'px'
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
for (let i = 0; i < buttons.length; i++) {
|
|
100
|
+
buttons[i].addEventListener('click', doScroll.bind(this))
|
|
101
|
+
buttons[i].addEventListener('touch', doScroll.bind(this))
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
console.log(
|
|
105
|
+
'Kein NativeScroll Element gefunden:' + rootElement + ' .js-ns-scroll.-horizontal'
|
|
106
|
+
)
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export default NativeScroll
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<span
|
|
2
|
+
class='sb-label rounded px-1.5 pt-px inline-block tracking-wide text-white text-base leading-5.5 font-heading{{#if _css}} {{_css}}{{/if}}
|
|
3
|
+
{{inline-switch
|
|
4
|
+
_type
|
|
5
|
+
'["media","event","breakingnews","comment","analysis","der-tag-in-hessen","glosse","fragen-und-antworten","infografik","interaktiv","program","download","pm","liveticker","ticker","livestream","live","livechat","buliticker","social-tv","blog","podcast","kurzmeldung"]'
|
|
6
|
+
'["bg-labelMedia","bg-labelEvent","bg-labelBreakingnews","bg-labelComment","bg-labelComment","bg-labelComment","bg-labelComment","bg-labelComment","bg-labelInfografik","bg-labelInfografik","bg-labelProgram","bg-labelDownload","bg-labelPm","bg-labelLive","bg-labelLive","bg-labelLive","bg-labelLive","bg-labelLive","bg-labelLive","bg-labelLive","bg-labelLive","bg-labelMedia","bg-labelKurzmeldung"]'
|
|
7
|
+
}}'
|
|
8
|
+
>
|
|
9
|
+
{{_text}}
|
|
10
|
+
|
|
11
|
+
</span>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { hr$, listen, unlisten } from 'hrQuery'
|
|
2
|
+
|
|
3
|
+
const Modal = (context) => {
|
|
4
|
+
const { options } = context,
|
|
5
|
+
{ element: rootElement } = context,
|
|
6
|
+
modalTriggerId = options.modalTriggerId ? '#' + options.modalTriggerId : '',
|
|
7
|
+
modalTrigger = hr$(modalTriggerId)[0],
|
|
8
|
+
modalCloseTriggers = hr$('.js-modal-close', rootElement),
|
|
9
|
+
modal = hr$('.js-modal', rootElement)[0]
|
|
10
|
+
|
|
11
|
+
const configureEventListeners = () => {
|
|
12
|
+
listen('click', show, modalTrigger)
|
|
13
|
+
|
|
14
|
+
modalCloseTriggers.forEach((modalCloseTrigger) => {
|
|
15
|
+
listen('click', close, modalCloseTrigger)
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const show = () => {
|
|
20
|
+
modal.showModal()
|
|
21
|
+
listen('click', closeFromOutside, modal)
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const closeFromOutside = (event) => {
|
|
25
|
+
if (event.target === modal) {
|
|
26
|
+
unlisten('click', closeFromOutside, modal)
|
|
27
|
+
close()
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const close = () => {
|
|
32
|
+
modal.close()
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
configureEventListeners()
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export default Modal
|