๐Ÿ“ฆ directus / website

๐Ÿ“„ LogoDoubleTicker.vue ยท 60 lines
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 setup lang="ts">
import type { BlockLogoCloudLogo } from '~/types/schema/blocks';
import type { File } from '~/types/schema';
import { Vue3Marquee } from 'vue3-marquee';

const props = defineProps<{
	logos: BlockLogoCloudLogo[];
}>();

const arrayMidpointIndex = Math.ceil((unref(props.logos) ?? []).length / 2);

const topLogoArray = computed(() => {
	const blockLogos = unref(props.logos) ?? [];
	return blockLogos.slice(0, arrayMidpointIndex);
});

const bottomLogoArray = computed(() => {
	const blockLogos = unref(props.logos) ?? [];
	return blockLogos.slice(arrayMidpointIndex);
});
</script>

<template>
	<div v-for="(logoArray, index) in [topLogoArray, bottomLogoArray]" :key="index" class="block-logo-cloud-ticker">
		<Vue3Marquee :clone="true" :duration="30" :direction="index === 1 ? 'reverse' : 'normal'">
			<div class="logo-container">
				<BaseDirectusImage
					v-for="logo in logoArray"
					:key="logo.id"
					:uuid="(logo.directus_files_id as File).id"
					:alt="(logo.directus_files_id as File).description ?? ''"
				/>
				<div class="logo-spacer"></div>
			</div>
		</Vue3Marquee>
	</div>
</template>

<style scoped lang="scss">
.block-logo-cloud-ticker {
	position: relative;
	overflow: hidden;
	mask-image: linear-gradient(to right, transparent, black 20%, black 80%, transparent);
	mask-size: 100% 100%;

	.logo-container {
		display: flex;
		gap: var(--space-14);
		position: relative;
	}

	& img {
		flex-shrink: 0;
		max-width: var(--space-48);
		height: var(--space-20);
		object-fit: contain;
	}
}
</style>