Skip to content

Commit

Permalink
better is-prominent
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakeii committed Dec 21, 2023
1 parent 8a5c245 commit 26df873
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/lib/gam.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const CLICK_MACRO = '%%CLICK_URL_UNESC%%';
const CACHE_BUST = '%%CACHEBUSTER%%';

type GAMVariable<T extends string = string> = `[%${T}%]` | '';
type GAMVariable<T extends string = string> = T;

const gamVar = <T extends string>(s: T): GAMVariable<T> => `[%${s}%]`;
const gamVar = <T extends string>(s: T): `[%${GAMVariable<T>}%]` => `[%${s}%]`;

const replaceGAMVariables = (
input: string,
Expand Down
10 changes: 8 additions & 2 deletions src/templates/components/ManualCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,15 @@
export let callToAction: string;
export let buttonColour: string;
export let direction = 'row';
export let isProminent = false;
</script>

<a class="card" href={url} style={`--direction: ${direction}`}>
<a
class="card"
class:is-prominent={isProminent}
href={url}
style={`--direction: ${direction}`}
>
<div class="media">
<picture>
<img src={image} alt="" />
Expand Down Expand Up @@ -127,7 +133,7 @@
margin: 10px 0px;
}
:global(.is-prominent) .card:nth-child(1) {
.is-prominent.card:nth-child(1) {
display: flex;
flex-direction: row;
align-items: stretch;
Expand Down
7 changes: 5 additions & 2 deletions src/templates/csr/manual-multiple/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@
},
];
const isProminent = IsProminent === 'true';
offers = offers.filter((offer) => offer.title !== '');
let height: number = -1;
Expand All @@ -81,13 +83,14 @@
{Explainer}
</svelte:fragment>
</ManualHeader>
<div class="cards-container" class:is-prominent={IsProminent}>
{#each offers as offer}
<div class="cards-container" class:is-prominent={isProminent}>
{#each offers as offer, i}
<ManualCard
image={offer.image}
url={offer.url}
callToAction={offer.linkText}
buttonColour="#005689"
isProminent={isProminent && i === 0}
>
<svelte:fragment slot="title">
{offer.title}
Expand Down

0 comments on commit 26df873

Please sign in to comment.