Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Resizer bug and minor style tweak #358

Merged
merged 4 commits into from
Jan 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/lib/Previews.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@

switch (data.type) {
case 'set-ad-height':
case 'resize':
const iframe = source.frameElement as HTMLIFrameElement;
iframe.height = String(data.value.height);
break;
Expand Down
26 changes: 16 additions & 10 deletions src/templates/components/CapiCard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,6 @@
background-color: #e4e4e4;
}

a.multiple-card:not(:first-of-type)::before {
content: '';
position: absolute;
top: 119px;
bottom: 102px;
margin-left: -10px;
width: 1px;
background: #dcdcdc;
}

a.single-card .media {
margin: -10px;
}
Expand Down Expand Up @@ -192,6 +182,16 @@
margin: 12px 10px;
}

a.multiple-card:not(:first-of-type)::before {
content: '';
position: absolute;
top: 78px;
bottom: 102px;
margin-left: -10px;
width: 1px;
background: #dcdcdc;
}

a.multiple-card:nth-child(n) {
display: block;
}
Expand All @@ -201,6 +201,12 @@
}
}

@media (min-width: 980px) {
a.multiple-card:not(:first-of-type)::before {
top: 131px;
}
}

@media (min-width: 1140px) {
a.single-card .text p {
display: block;
Expand Down
2 changes: 1 addition & 1 deletion src/templates/components/Resizer.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

export let height: number;

$: post({ type: 'set-ad-height', value: { height, width: -1 } });
$: post({ type: 'resize', value: { height } });
</script>
7 changes: 7 additions & 0 deletions src/templates/components/SetHeightResizer.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<script lang="ts">
import { post } from '$lib/messenger';

export let height: number;

$: post({ type: 'set-ad-height', value: { height, width: -1 } });
</script>
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 @@ -12,7 +12,7 @@
import CapiCard from '$templates/components/CapiCard.svelte';
import PaidForHeader from '$templates/components/PaidForHeader.svelte';
import { addTrackingPixel, isValidReplacedVariable } from '$lib/gam';
import Resizer from '$templates/components/Resizer.svelte';
import SetHeightResizer from '$templates/components/SetHeightResizer.svelte';

export let SeriesUrl: GAMVariable;
export let ComponentTitle: GAMVariable;
Expand All @@ -39,7 +39,7 @@
/>
<CapiCard templateType="single" {single} />
</aside>
<Resizer {height} />
<SetHeightResizer {height} />
{:catch}
<h3>Could not fetch series “{SeriesUrl}”</h3>
{/await}
Expand Down
4 changes: 2 additions & 2 deletions src/templates/csr/events-multiple/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
import type { GAMVariable } from '$lib/gam';
import '$templates/components/fonts/Sans.css';
import ManualCard from '$templates/components/ManualCard.svelte';
import Resizer from '$templates/components/Resizer.svelte';
import ManualHeader from '$templates/components/ManualHeader.svelte';
import ToneLogo from '$templates/components/ToneLogo.svelte';
import type { Tone } from '$lib/types/tones';
import SetHeightResizer from '$templates/components/SetHeightResizer.svelte';

export let BannerDescription: GAMVariable;
export let HeaderButtonText: GAMVariable;
Expand Down Expand Up @@ -89,7 +89,7 @@
{/each}
</div>
</aside>
<Resizer {height} />
<SetHeightResizer {height} />

<style lang="scss">
aside {
Expand Down
4 changes: 2 additions & 2 deletions src/templates/csr/manual-multiple/index.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import '$templates/components/fonts/Sans.css';
import ManualCard from '$templates/components/ManualCard.svelte';
import ManualHeader from '$templates/components/ManualHeader.svelte';
import Resizer from '$templates/components/Resizer.svelte';
import ToneLogo from '$templates/components/ToneLogo.svelte';
import type { Tone } from '$lib/types/tones';
import SetHeightResizer from '$templates/components/SetHeightResizer.svelte';

export let Tone: GAMVariable<Tone>;
export let TitleURL: GAMVariable;
Expand Down Expand Up @@ -92,7 +92,7 @@
{/each}
</div>
</aside>
<Resizer {height} />
<SetHeightResizer {height} />

<style lang="scss">
aside {
Expand Down
Loading