diff --git a/components/Card.vue b/components/Card.vue index 462a1ad..95910e5 100644 --- a/components/Card.vue +++ b/components/Card.vue @@ -3,6 +3,7 @@ import type { ProjectRating, ProjectShallow } from '~/types' const props = defineProps<{ project: ProjectShallow + hiddenColumns?: string[] }>() const { switcher, ecosystems, filter } = storeToRefs(useData()) @@ -11,6 +12,14 @@ const isLargeScreen = useMediaQuery('(min-width: 1024px)') const ratings: { label: string, type: string, rating: ProjectRating }[] = (props.project.ratings || []).map(rating => ({ label: rating.name, type: 'rating', rating: rating })) const ecosystem: { label: string[], type: string } = { label: ecosystems.value.filter(e => (props.project.ecosystem || []).includes(e.id)).map(e => e.icon!), type: 'ecosystem' } const projectItems: { label: string | string[], type: string, rating?: ProjectRating }[] = [{ label: props.project.usecases || [], type: 'array' }, ...ratings, ecosystem, { label: [props.project.website || '', props.project.github || '', props.project.twitter || ''], type: 'links' }] + +const { width } = useWindowSize() +const visibleColumnsCount = computed(() => { + if (width.value >= 1024) + return projectItems.filter(item => item.rating?.type ? !props.hiddenColumns?.includes(item.rating.type) : true).length + 4 + else + return 2 +})