@reuters-graphics/graphics-components 1.1.1 → 1.1.3

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.
@@ -34,3 +34,9 @@ onMount(() => {
34
34
  </script>
35
35
 
36
36
  <div data-freestar-ad="{dataFreestarAd || null}" id="{adId}"></div>
37
+
38
+ <style>
39
+ :global(div.freestar-adslot:has(.unfulfilled-ad)) {
40
+ display: none;
41
+ }
42
+ </style>
@@ -33,7 +33,7 @@ onMount(() => {
33
33
  <svelte:window bind:innerWidth="{windowWidth}" />
34
34
 
35
35
  <div
36
- class="leaderboard__sticky {cls}"
36
+ class="freestar-adslot leaderboard__sticky {cls}"
37
37
  class:sticky
38
38
  class:unstick
39
39
  {id}
@@ -45,6 +45,20 @@ export const loadBootstrap = () => {
45
45
  // @ts-ignore window global
46
46
  window.googletag.pubads().enableAsyncRendering();
47
47
  window.googletag.pubads().collapseEmptyDivs(true);
48
+ window.googletag
49
+ .pubads()
50
+ .addEventListener('slotRenderEnded', function (event) {
51
+ const adDiv = document.getElementById(event.slot.getSlotElementId());
52
+ if (!adDiv)
53
+ return;
54
+ // If the ad slot is empty
55
+ if (event.isEmpty) {
56
+ adDiv.classList.add('unfulfilled-ad');
57
+ }
58
+ else {
59
+ adDiv.classList.remove('unfulfilled-ad');
60
+ }
61
+ });
48
62
  });
49
63
  // Set page-level key-values
50
64
  // cf: https://help.freestar.com/help/using-key-values
@@ -3,7 +3,6 @@
3
3
  import { getTime } from './time';
4
4
 
5
5
  export let story;
6
- export let withSection = false;
7
6
 
8
7
  $: thumbnail = story.thumbnail;
9
8
  </script>
@@ -11,17 +10,8 @@
11
10
  <div class="story-card">
12
11
  <a href="{normalizeUrl(story.canonical_url)}">
13
12
  <div class="story-text" class:has-thumbnail="{thumbnail}">
14
- {#if withSection}
15
- <a href="{normalizeUrl(story.primary_section.id)}">
16
- <span class="label">{story.primary_section.name}</span>
17
- </a>
18
- {/if}
19
13
  <span>{story.title}</span>
20
- {#if !withSection}
21
- <time datetime="{story.display_time}"
22
- >{getTime(story.display_time)}</time
23
- >
24
- {/if}
14
+ <time datetime="{story.display_time}">{getTime(story.display_time)}</time>
25
15
  </div>
26
16
  {#if thumbnail}
27
17
  <div class="thumbnail">
@@ -3,7 +3,6 @@
3
3
  /** @typedef {typeof __propDef.slots} IndexSlots */
4
4
  export default class Index extends SvelteComponent<{
5
5
  story: any;
6
- withSection?: boolean | undefined;
7
6
  }, {
8
7
  [evt: string]: CustomEvent<any>;
9
8
  }, {}> {
@@ -15,7 +14,6 @@ import { SvelteComponent } from "svelte";
15
14
  declare const __propDef: {
16
15
  props: {
17
16
  story: any;
18
- withSection?: boolean | undefined;
19
17
  };
20
18
  events: {
21
19
  [evt: string]: CustomEvent<any>;
@@ -63,10 +63,7 @@
63
63
  <ul class="story-list">
64
64
  {#each stories as story}
65
65
  <li class="story-item">
66
- <StoryCard
67
- {story}
68
- withSection="{$activeSection === 'more'}"
69
- />
66
+ <StoryCard {story} />
70
67
  </li>
71
68
  {/each}
72
69
  </ul>
@@ -18,6 +18,6 @@ Import the SCSS directly in your top-level component. (This is done for you in t
18
18
  <script>
19
19
  // other imports and stuffs ...
20
20
 
21
- import '@reuters-graphics/graphics-components/scss/main';
21
+ import '@reuters-graphics/graphics-components/scss/main.scss';
22
22
  </script>
23
23
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reuters-graphics/graphics-components",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "homepage": "https://reuters-graphics.github.io/graphics-components",