aboutsummaryrefslogtreecommitdiff
path: root/src/components/DirectionCard.svelte
blob: 7f9d76f6a99d658410c6e20a79887a5c242a64e3 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<script>
	export let imageSpec;
	export let direction;
</script>

<section class="direction-card">
	{#if direction === 'right'}
		<div class="direction-card__row row my-2">
			<div class="direction-card__media col-md-4">
				<img
					class="img-fluid rounded shadow"
					src={imageSpec.image}
					alt={imageSpec.alt}
					loading="lazy"
					decoding="async"
				/>
			</div>
			<div class="direction-card__content col-md-8 card">
				<slot />
			</div>
		</div>
	{:else}
		<div class="direction-card__row row my-2">
			<div class="direction-card__content col-md-8 card">
				<slot />
			</div>
			<div class="direction-card__media col-md-4">
				<img
					class="img-fluid rounded shadow"
					src={imageSpec.image}
					alt={imageSpec.alt}
					loading="lazy"
					decoding="async"
				/>
			</div>
		</div>
	{/if}
</section>

<style>
	.direction-card__row {
		align-items: center;
	}

	.direction-card__media {
		max-width: 420px;
		margin-inline: auto;
	}

	@media (min-width: 768px) {
		.direction-card__media {
			max-width: none;
		}
	}

	.direction-card :global(img) {
		max-height: 520px;
		object-fit: cover;
	}
</style>