<template>
	<div class="item" @click="goToDetail">
		<div class="flex items-center">
			<img class="icon" :src="item.coverImage || ''" alt="" />
			<div class="flex-1 flex flex-col justify-between">
				<div class="title">{{ item.title || '' }}</div>
				<div class="flex items-center gap-30">
					<div class="flex items-center data gap-12">
						<img alt="" src="/launches/detail/icon_thumb.png" class="wh-24" />
						<div>{{ item.likeCount || 0 }}</div>
					</div>
					<div class="flex items-center data gap-12">
						<img alt="" src="/launches/detail/icon_star.png" class="wh-24" />
						<div>{{ item.rating || 0 }}</div>
					</div>
				</div>
			</div>
		</div>
		<div class="summary">{{ item.summary || '' }}</div>
	</div>
</template>

<script>
export default {
	props: {
		item: {
			type: Object,
			default: () => ({})
		}
	},
	data() {
		return {
		}
	},
	methods: {
		goToDetail() {
			if (this.item && this.item.slug) {
				this.$router.push(`/launches/detail?news_slug=${this.item.slug}`);
			}
		}
	},
}
</script>

<style scoped lang="scss">
.gap-30 {
	gap: 30px;
}
.item {
	cursor: pointer;
	transition: all 0.3s ease;
	max-width: 330px;
	overflow: hidden;

	&:hover {
		opacity: 0.8;
	}

	.icon {
		width: 70px;
		height: 70px;
		border-radius: 6px;
		margin-right: 20px;
	}
	.title {
		flex: 1;
		font-family: 'Poppins-SemiBold';
		font-size: 24px;
		color: #1E293B;
		font-weight: 600;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
	.data {
		font-family: 'Poppins-Regular';
		color: #64748B;
	}
	.summary {
		font-family: 'Poppins-Regular';
		color: #64748B;
		margin-top: 12px;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}
}
</style>
