Initial commit from monorepo
This commit is contained in:
63
app/components/catalog/CatalogSuppliersSection.vue
Normal file
63
app/components/catalog/CatalogSuppliersSection.vue
Normal file
@@ -0,0 +1,63 @@
|
||||
<template>
|
||||
<Section variant="plain" paddingY="md">
|
||||
<Stack gap="4">
|
||||
<Stack direction="row" align="center" justify="between">
|
||||
<Heading :level="2">{{ t('catalogSuppliersSection.header.title') }}</Heading>
|
||||
<NuxtLink
|
||||
:to="localePath('/catalog/suppliers')"
|
||||
class="btn btn-sm btn-ghost"
|
||||
>
|
||||
<span>{{ t('catalogSuppliersSection.actions.view_all') }}</span>
|
||||
<Icon name="lucide:arrow-right" size="16" />
|
||||
</NuxtLink>
|
||||
</Stack>
|
||||
|
||||
<Grid :cols="1" :md="2" :lg="3" :gap="4">
|
||||
<SupplierCard
|
||||
v-for="supplier in suppliers"
|
||||
:key="supplier.uuid"
|
||||
:supplier="supplier"
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<Stack v-if="totalSuppliers > 0" direction="row" align="center" justify="between">
|
||||
<Text tone="muted">
|
||||
{{ t('common.pagination.showing', { shown: suppliers.length, total: totalSuppliers }) }}
|
||||
</Text>
|
||||
<Button v-if="canLoadMore" variant="outline" @click="loadMore">
|
||||
{{ t('common.actions.load_more') }}
|
||||
</Button>
|
||||
</Stack>
|
||||
|
||||
<Stack v-if="suppliers.length === 0" align="center" gap="2">
|
||||
<Text tone="muted">{{ t('catalogSuppliersSection.empty.no_suppliers') }}</Text>
|
||||
</Stack>
|
||||
</Stack>
|
||||
</Section>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
interface Supplier {
|
||||
uuid?: string | null
|
||||
name?: string | null
|
||||
country?: string | null
|
||||
offersCount?: number | null
|
||||
isVerified?: boolean | null
|
||||
}
|
||||
|
||||
const props = defineProps<{
|
||||
suppliers: Supplier[]
|
||||
total?: number
|
||||
canLoadMore?: boolean
|
||||
onLoadMore?: () => void
|
||||
}>()
|
||||
|
||||
const localePath = useLocalePath()
|
||||
const { t } = useI18n()
|
||||
|
||||
const totalSuppliers = computed(() => props.total ?? props.suppliers.length)
|
||||
const canLoadMore = computed(() => props.canLoadMore ?? false)
|
||||
const loadMore = () => {
|
||||
props.onLoadMore?.()
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user