Skip to content

Commit

Permalink
Merge pull request #333 from guardian/ei/capi-multiple-events-template
Browse files Browse the repository at this point in the history
Add Svelte version of events multiple template
  • Loading branch information
emma-imber authored Nov 16, 2023
2 parents ebfa2ee + 21946f4 commit 36de988
Show file tree
Hide file tree
Showing 9 changed files with 458 additions and 64 deletions.
File renamed without changes.
114 changes: 114 additions & 0 deletions src/templates/components/EventsHeader.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
<script context="module" lang="ts">
import { CLICK_MACRO } from '$lib/gam';
</script>

<script lang="ts">
import type { GAMVariable } from '$lib/gam';
import ArrowRight from './icons/ArrowRight.svelte';
import LiveLogo from './icons/LiveLogo.svelte';
import '$templates/components/fonts/Headline.css';
import '$templates/components/fonts/SansBold.css';
export let HeaderButtonUrl: GAMVariable;
export let BannerDescription: GAMVariable;
export let HeaderButtonText: GAMVariable;
</script>

<header>
<div class="logo">
<LiveLogo />
</div>

<div class="banner-description-container">
<span class="banner-description">{BannerDescription}</span>
</div>

<div class="button-container">
<a class="button" href={`${CLICK_MACRO}${HeaderButtonUrl}`} target="_top">
{HeaderButtonText}
<ArrowRight width={30} />
</a>
</div>
</header>

<style lang="scss">
header {
background-color: #c83877;
color: black;
padding: 6px 20px;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-between;
}
.logo {
align-self: flex-start;
}
a {
color: inherit;
text-decoration: none;
}
.banner-description {
font-size: 16px;
line-height: 22px;
font-family: 'GH Guardian Headline', 'Georgia', serif;
font-weight: 500;
color: #000000;
background: #ffffff;
box-decoration-break: clone;
-webkit-box-decoration-break: clone;
padding: 2px 5px 2px 2px;
@media (max-width: 1140px) {
display: none;
}
}
div.banner-description-container {
margin-top: 20px;
margin-bottom: 20px;
}
.button-container {
display: flex;
flex-direction: row;
}
a.button {
font-size: 13px;
font-weight: 700;
font-family: 'GuardianTextSans', 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif;
background: #ffffff;
color: #000000;
text-decoration: none;
border-radius: 10rem;
padding: 3px;
padding-left: 1rem;
display: inline-flex;
justify-content: space-between;
align-items: center;
}
@media (min-width: 1140px) {
header {
padding: 12px 20px;
width: 171px;
flex-direction: column;
}
.button-container {
flex-direction: column;
width: 100%;
}
}
@media (min-width: 1300px) {
header {
width: 251px;
}
}
</style>
162 changes: 162 additions & 0 deletions src/templates/components/ManualCard.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<script context="module" lang="ts">
import { CLICK_MACRO } from '$lib/gam';
import type { GAMVariable } from '$lib/gam';
</script>

<script lang="ts">
import '$templates/components/fonts/Egyptian.css';
import '$templates/components/fonts/Headline.css';
import '$templates/components/fonts/Sans.css';
import ArrowRight from './icons/ArrowRight.svelte';
export let TotalCardNumber: number;
export let EventTitle: GAMVariable;
export let EventDateTime: GAMVariable;
export let EventImage: GAMVariable;
export let EventUrl: GAMVariable;
export let direction = 'row';
let [boldTitle, regularTitle] = EventTitle.split(':');
if (regularTitle) {
boldTitle += ':';
} else {
regularTitle = '';
}
</script>

<a
class="card split-into-{TotalCardNumber}"
href={EventUrl}
style={`--direction: ${direction}`}
>
<div class="media">
<picture>
<img src={EventImage} alt="" />
</picture>
</div>
<div class="text">
<h2><b>{boldTitle}</b>{regularTitle}</h2>
<p>{EventDateTime}</p>
</div>
<a class="button" href={`${CLICK_MACRO}${EventUrl}`} target="_top">
Book tickets
<ArrowRight width={24} />
</a>
</a>

<style>
a {
color: #000000;
text-decoration: none;
}
a.card {
padding: 12px 10px;
display: block;
margin: 0px;
width: 50%;
}
a.card:nth-child(n + 3) {
display: none;
}
a.card:not(:first-of-type)::before {
content: '';
position: absolute;
top: 91px;
bottom: 12px;
margin-left: -10px;
width: 1px;
background: #dcdcdc;
}
.media {
background-color: gray;
margin: 0 0 10px 0;
}
.text {
padding: 0;
}
picture,
img {
display: block;
width: 100%;
}
h2 {
font-size: 1rem;
line-height: 1.25rem;
font-family: 'GH Guardian Headline', 'Georgia', serif;
font-weight: 500;
padding: 0px;
margin-bottom: 3px;
}
p {
display: block;
font-size: 0.75rem;
line-height: 1rem;
font-family: 'GuardianTextSans', 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif;
margin: 3px 0px;
}
a.button {
font-size: 12px;
line-height: 0;
font-weight: 700;
font-family: 'GuardianTextSans', 'Helvetica Neue', Helvetica, Arial,
'Lucida Grande', sans-serif;
background: #c83877;
color: #ffffff;
text-decoration: none;
border-radius: 10rem;
display: inline-flex;
padding-left: 0.5rem;
margin-top: 3px;
align-self: flex-start;
align-items: center;
}
@media (min-width: 740px) {
a.card:nth-child(n) {
padding: 12px 10px;
display: block;
margin: 0px;
}
a.split-into-2 {
width: 50%;
}
a.split-into-3 {
width: 33%;
}
a.split-into-4 {
width: 25%;
}
a.button {
margin-top: 6px;
margin-bottom: 10px;
}
h2 {
margin-bottom: 10px;
}
p {
margin: 10px 0px;
}
}
@media (min-width: 1140px) {
a.card:not(:first-of-type)::before {
top: 12px;
}
}
</style>
8 changes: 7 additions & 1 deletion src/templates/components/icons/ArrowRight.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,13 @@
export let flip = false;
</script>

<svg aria-hidden="true" class:flip viewBox="0 0 30 30" {width} height={width}
<svg
aria-hidden="true"
class:flip
viewBox="0 0 30 30"
{width}
height={width}
fill="currentColor"
><path
d="M22.8 14.6l-7.6-7.6-.7.7 5.5 6.6h-14v1.5h14l-5.5 6.6.7.7 7.6-7.6v-.9"
/></svg
Expand Down
53 changes: 53 additions & 0 deletions src/templates/components/icons/LiveLogo.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<svg
aria-hidden="true"
width="120.9px"
height="63.9px"
viewBox="0 0 120.9 63.9"
fill="#ffffff"
>
<path
d="M27.7,21.3l2.1-1.1V3.5h-1.6l-3.9,5.2h-0.4l0.2-5.8h17l0.2,5.8h-0.5L37,3.5h-1.6v16.6l2.1,1.1v0.6h-9.8 V21.3z"
/>
<path
d="M43,20.5V2.1l-1.6-0.7V1.1l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
Loading

0 comments on commit 36de988

Please sign in to comment.