Skip to content

Commit

Permalink
Lint
Browse files Browse the repository at this point in the history
  • Loading branch information
emma-imber committed Jan 4, 2024
1 parent a792648 commit 2f4490f
Show file tree
Hide file tree
Showing 8 changed files with 67 additions and 34 deletions.
28 changes: 20 additions & 8 deletions src/templates/components/CapiCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,25 @@
export let single: Single;
export let direction = 'row';
const { articleHeadline, articleUrl, articleText, articleImage, audioTag, galleryTag, videoTag, kicker } = single;
const {
articleHeadline,
articleUrl,
articleText,
articleImage,
audioTag,
galleryTag,
videoTag,
kicker,
} = single;
const pictureSupported =
articleImage.sources.length > 0 && 'srcset' in new Image();
</script>

<a class="{templateType}-card" href={articleUrl} style={`--direction: ${direction}`}>
<a
class="{templateType}-card"
href={articleUrl}
style={`--direction: ${direction}`}
>
<div class="media">
{#if pictureSupported}
<picture>
Expand All @@ -40,12 +53,12 @@
<div class="text">
<h2>
{#if kicker}
<span class="kicker">{kicker && kicker}</span><br>
<span class="kicker">{kicker && kicker}</span><br />
{/if}
{#if audioTag}
<AudioIcon />
{:else if galleryTag}
<CameraIcon/>
<CameraIcon />
{:else if videoTag}
<VideoIcon />
{/if}
Expand Down Expand Up @@ -73,7 +86,7 @@
}
a.multiple-card {
margin: 12px 10px 0px 10px;;
margin: 12px 10px 0px 10px;
display: block;
padding: 0 0 8px 0;
width: auto;
Expand Down Expand Up @@ -133,7 +146,7 @@
font-weight: 500;
padding: 0px;
margin: 6px 0 8px 0;
color: #333
color: #333;
}
}
Expand Down Expand Up @@ -166,7 +179,7 @@
}
a.multiple-card {
margin: 12px 10px
margin: 12px 10px;
}
a.multiple-card:nth-child(n) {
Expand All @@ -187,5 +200,4 @@
top: 12px;
}
}
</style>
8 changes: 5 additions & 3 deletions src/templates/components/PaidForHeader.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
{#if popup}
<div id="popup">
<p>
Paid content is paid for and controlled by an advertiser and produced
by the Guardian Labs team
Paid content is paid for and controlled by an advertiser and
produced by the Guardian Labs team
</p>
<a
class="popup-link"
Expand All @@ -44,7 +44,9 @@
{/if}
</div>

<h1 class="adverts__title {templateType === 'multiple' && 'multiple-title'}">
<h1
class="adverts__title {templateType === 'multiple' && 'multiple-title'}"
>
<a
href={`${CLICK_MACRO}https://theguardian.com/${SeriesUrl}`}
target="_top"
Expand Down
9 changes: 7 additions & 2 deletions src/templates/components/Sponsor.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,15 @@
const { width, height } = logo.dimensions;
</script>

<div class="{templateType === 'multiple' ? 'multiple-logo-container' : ''}">
<div class={templateType === 'multiple' ? 'multiple-logo-container' : ''}>
<p>Paid for by</p>
<a href={`${CLICK_MACRO}${branding.logo.link}`}>
<img class="{templateType === 'multiple' ? 'multiple-logo' : ''}" src={logo.src} alt="" style={`aspect-ratio: ${width} / ${height};`} />
<img
class={templateType === 'multiple' ? 'multiple-logo' : ''}
src={logo.src}
alt=""
style={`aspect-ratio: ${width} / ${height};`}
/>
</a>
</div>

Expand Down
6 changes: 5 additions & 1 deletion src/templates/components/icons/AudioIcon.svelte
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<svg width="16" height="13" viewBox="0 0 16 13" class="icon"><path d="M3 4h-2l-1 1v3l1 1h2l4 4h1v-13h-1l-4 4zm11.7 2.5c0 2-.7 3.8-1.8 5.2l.4.4c1.6-1.3 2.6-3.3 2.6-5.6s-1-4.3-2.6-5.6l-.4.4c1.2 1.5 1.8 3.3 1.8 5.2m-3.7 0c0 1.1-.3 2.2-.9 3.1l.5.5c.8-1 1.4-2.2 1.4-3.6s-.6-2.6-1.5-3.5l-.5.5c.6.8 1 1.9 1 3"/></svg>
<svg width="16" height="13" viewBox="0 0 16 13" class="icon"
><path
d="M3 4h-2l-1 1v3l1 1h2l4 4h1v-13h-1l-4 4zm11.7 2.5c0 2-.7 3.8-1.8 5.2l.4.4c1.6-1.3 2.6-3.3 2.6-5.6s-1-4.3-2.6-5.6l-.4.4c1.2 1.5 1.8 3.3 1.8 5.2m-3.7 0c0 1.1-.3 2.2-.9 3.1l.5.5c.8-1 1.4-2.2 1.4-3.6s-.6-2.6-1.5-3.5l-.5.5c.6.8 1 1.9 1 3"
/></svg
>
6 changes: 5 additions & 1 deletion src/templates/components/icons/CameraIcon.svelte
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<svg width="18" height="13" viewBox="0 0 18 13" class="icon"><path d="M18 3.5v8l-1.5 1.5h-15l-1.5-1.5v-8l1.5-1.5h3.5l2-2h4l2 2h3.5l1.5 1.5zm-9 7.5c1.9 0 3.5-1.6 3.5-3.5s-1.6-3.5-3.5-3.5-3.5 1.6-3.5 3.5 1.6 3.5 3.5 3.5z"/></svg>
<svg width="18" height="13" viewBox="0 0 18 13" class="icon"
><path
d="M18 3.5v8l-1.5 1.5h-15l-1.5-1.5v-8l1.5-1.5h3.5l2-2h4l2 2h3.5l1.5 1.5zm-9 7.5c1.9 0 3.5-1.6 3.5-3.5s-1.6-3.5-3.5-3.5-3.5 1.6-3.5 3.5 1.6 3.5 3.5 3.5z"
/></svg
>
6 changes: 5 additions & 1 deletion src/templates/components/icons/VideoIcon.svelte
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
<svg viewBox="0 0 36 23" class="icon"><path d="M3.2 0l-3.2 3.3v16.4l3.3 3.3h18.7v-23h-18.8m30.4 1l-8.6 8v5l8.6 8h2.4v-21h-2.4"/></svg>
<svg viewBox="0 0 36 23" class="icon"
><path
d="M3.2 0l-3.2 3.3v16.4l3.3 3.3h18.7v-23h-18.8m30.4 1l-8.6 8v5l8.6 8h2.4v-21h-2.4"
/></svg
>
34 changes: 18 additions & 16 deletions src/templates/csr/capi-multiple-paidfor/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,29 +41,29 @@
headline: Article1Headline,
image: Article1Image,
url: Article1URL,
kicker: Article1Kicker
kicker: Article1Kicker,
},
{
headline: Article2Headline,
image: Article2Image,
url: Article2URL,
kicker: Article2Kicker
kicker: Article2Kicker,
},
{
headline: Article3Headline,
image: Article3Image,
url: Article3URL,
kicker: Article3Kicker
kicker: Article3Kicker,
},
{
headline: Article4Headline,
image: Article4Image,
url: Article4URL,
kicker: Article4Kicker
kicker: Article4Kicker,
},
];
const requestData = retrieveCapiData(cards, SeriesUrl)
const requestData = retrieveCapiData(cards, SeriesUrl);
if (isValidReplacedVariable(Trackingpixel)) addTrackingPixel(Trackingpixel);
Expand All @@ -81,18 +81,21 @@
edition={response.articles[0].branding.edition}
{ComponentTitle}
{SeriesUrl}
templateType='multiple'
templateType="multiple"
/>
<div class="body">
<div class="cards-container">
{#each formattedCards as single}
<CapiCard templateType='multiple' {single} />
{/each}
</div>
<div class="sponsor-container">
<Sponsor branding={response.articles[0].branding} templateType ='multiple' />
</div>
<div class="body">
<div class="cards-container">
{#each formattedCards as single}
<CapiCard templateType="multiple" {single} />
{/each}
</div>
<div class="sponsor-container">
<Sponsor
branding={response.articles[0].branding}
templateType="multiple"
/>
</div>
</div>
</aside>
<Resizer {height} />
{/await}
Expand Down Expand Up @@ -147,5 +150,4 @@
flex-direction: column;
}
}
</style>
4 changes: 2 additions & 2 deletions src/templates/csr/capi-single-paidfor/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,12 @@
{:then single}
<aside bind:clientHeight={height}>
<PaidForHeader
templateType='single'
templateType="single"
edition={single.branding.edition}
{ComponentTitle}
{SeriesUrl}
/>
<CapiCard templateType='single' {single} />
<CapiCard templateType="single" {single} />
</aside>
<Resizer {height} />
{:catch}
Expand Down

0 comments on commit 2f4490f

Please sign in to comment.