Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/update bouquet card component on listing #599

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/assets/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,18 @@ body {
display: block;
}

.flex-nowrap {
flex-wrap: nowrap;
}

.flex-1-1-auto {
flex: 1 1 auto;
}

.overflow-hidden {
overflow: hidden;
}

/* FONT CUSTOM */
.uppercase {
text-transform: uppercase;
Expand Down
1 change: 0 additions & 1 deletion src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ export {}
declare module 'vue' {
export interface GlobalComponents {
BouquetCard: typeof import('./components/bouquets/BouquetCard.vue')['default']
BouquetCardHome: typeof import('./components/bouquets/BouquetCardHome.vue')['default']
BouquetDatasetAccordionTitle: typeof import('./components/bouquets/BouquetDatasetAccordionTitle.vue')['default']
BouquetDatasetCard: typeof import('./components/bouquets/BouquetDatasetCard.vue')['default']
BouquetDatasetList: typeof import('./components/bouquets/BouquetDatasetList.vue')['default']
Expand Down
119 changes: 73 additions & 46 deletions src/components/bouquets/BouquetCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import { toRef } from 'vue'
import type { RouteLocationRaw } from 'vue-router'

import OrganizationLogo from '@/components/OrganizationLogo.vue'
import { NoOptionSelected } from '@/model/theme'
import type { Topic } from '@/model/topic'
import { stripFromMarkdown } from '@/utils'
import { getOwnerAvatar } from '@/utils/avatar'
Expand All @@ -23,6 +22,10 @@ const props = defineProps({
bouquet: {
type: Object as () => Topic,
required: true
},
hideDescription: {
type: Boolean,
default: false
}
})

Expand All @@ -44,49 +47,49 @@ const { themeColors } = useThemeOptions(theme)
</script>

<template>
<article class="fr-my-3w fr-p-3w border border-default-grey fr-enlarge-link">
<article
class="fr-my-1w fr-px-3w fr-py-2w border border-default-grey fr-enlarge-link"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

24px partout sur la maquette

Suggested change
class="fr-my-1w fr-px-3w fr-py-2w border border-default-grey fr-enlarge-link"
class="fr-my-1w fr-p-3w border border-default-grey fr-enlarge-link"

J'avais pas fait attention que ça restait pareil en mobile… Ça me semble être beaucoup

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avec ce résultat j'ai un espacement plus grand en haut que sur les côtés, ce qui ne fait pas trop harmonieux. C'est, il me semble, plus agréable quand on distingue une carré d'espacement dans les angles

>
<div
v-if="bouquet.private"
class="absolute top-0 fr-grid-row fr-grid-row--middle fr-mt-n3v"
>
<p class="fr-badge fr-badge--mention-grey fr-mr-1w">Brouillon</p>
</div>
<div class="fr-grid-row fr-grid-row--gutters fr-grid-row--top">
<div class="fr-col-auto">
<div class="fr-grid-row">
<div class="fr-col-12">
<DsfrTag
class="fr-card__detail fr-mt-1w fr-mb-1w card__tag"
:label="subtheme"
/>
</div>
</div>
<div class="fr-grid-row fr-pt-2v align-center flex-nowrap">
<div class="fr-col-12 fr-col-sm-2 bouquet-card-col-logo">
<OrganizationLogo
v-if="bouquet.organization"
:size="64"
:size="43"
:object="bouquet"
/>
<div v-else class="border fr-p-1-5v fr-mr-1-5v">
<div v-else class="border fr-p-1-5v fr-mr-1-5v inline-block">
<img
:src="getOwnerAvatar(bouquet)"
alt=""
loading="lazy"
class="owner-avatar"
height="64"
width="64"
height="42"
width="42"
/>
</div>
</div>
<div class="fr-col">
<div
class="fr-col-12 fr-col-sm-10 fr-pl-2v overflow-hidden flex-1-1-auto"
>
<h3 class="fr-mb-1v fr-grid-row h4">
<RouterLink :to="bouquetLink" class="text-grey-500">
{{ bouquet.name }}
</RouterLink>
</h3>
<DsfrTag
v-if="theme && subtheme !== NoOptionSelected"
:class="[
{
'fr-card__detail': true,
'fr-mt-1w': subtheme !== NoOptionSelected
},
'fr-mb-1w',
'card__tag'
]"
:label="subtheme"
/>
<p
v-if="bouquet.organization || bouquet.owner"
class="fr-m-0 fr-text--sm"
Expand All @@ -98,43 +101,67 @@ const { themeColors } = useThemeOptions(theme)
/>
</template>
<template v-else>{{ ownerName }}</template>
— mis à jour {{ formatRelativeIfRecentDate(bouquet.last_modified) }}
</p>
<p
class="fr-mt-1w fr-mb-2w fr-hidden fr-unhidden-sm overflow-wrap-anywhere"
>
<text-clamp
v-if="bouquet.description"
:auto-resize="true"
:text="stripFromMarkdown(bouquet.description)"
:max-lines="3"
/>
</p>
<p class="fr-tag">
<VIcon name="ri-database-2-line" class="fr-mr-1v" />
<span class="fr-mr-1v">
{{
`${nbData > 0 ? nbData : 'Aucune'} donnée${nbData > 1 ? 's' : ''}`
}}
</span>
</p>
<p v-if="spatialCoverage" class="fr-tag fr-ml-1w">
<VIcon name="ri-map-2-line" class="fr-mr-1v" />
<span class="fr-mr-1v">
{{ spatialCoverage.name }}
</span>
</p>
</div>
</div>
<div v-if="!hideDescription" class="fr-grid-row description fr-mt-3v">
<p class="fr-mb-1v">{{ stripFromMarkdown(bouquet.description) }}</p>
</div>

<p class="fr-mb-2v fr-text--sm flex align-center fr-pt-3v text-grey-380">
<VIcon name="ri:time-line" class="fr-mr-1v text-grey-380" />
Mis à jour {{ formatRelativeIfRecentDate(bouquet.last_modified) }}
</p>

<div class="fr-grid-row">
<span class="fr-tag fr-mr-2v fr-mb-2v">
<VIcon name="ri-database-2-line" class="fr-mr-1v" />
<span class="fr-mr-1v">
{{
`${nbData > 0 ? nbData : 'Aucune'} donnée${nbData > 1 ? 's' : ''}`
}}
</span>
</span>

<span v-if="spatialCoverage" class="fr-tag fr-mb-2v">
<VIcon name="ri-map-2-line" class="fr-mr-1v" />
<span class="fr-mr-1v">
{{ spatialCoverage.name }}
</span>
</span>
</div>
</article>
</template>

<style scoped>
.owner-avatar {
margin-bottom: -6px;
display: inline-block;
}
.card__tag {
color: v-bind('themeColors.color');
background-color: v-bind('themeColors.background');
}

.fr-card__detail,
:deep(h3) {
max-width: 100%;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
display: block;
line-height: inherit;
}

.bouquet-card-col-logo {
max-width: 4.25rem;
}

.description p {
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2;
-webkit-box-orient: vertical;
}
</style>
144 changes: 0 additions & 144 deletions src/components/bouquets/BouquetCardHome.vue

This file was deleted.

15 changes: 5 additions & 10 deletions src/components/bouquets/BouquetList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { computed, onMounted } from 'vue'
import { useLoading } from 'vue-loading-overlay'
import { useRoute, useRouter, type LocationQueryRaw } from 'vue-router'

import BouquetCard from '@/components/bouquets/BouquetCard.vue'
import { NoOptionSelected } from '@/model/theme'
import type { Topic } from '@/model/topic'
import { useTopicStore } from '@/store/TopicStore'
Expand Down Expand Up @@ -172,15 +171,11 @@ defineExpose({
</div>
</div>
<div class="bouquets-list-container fr-container fr-mb-4w border-top">
<div class="fr-grid-row fr-grid-row--gutters fr-mb-1w">
<div class="fr-col-12">
<BouquetCard
v-for="bouquet in bouquets"
:key="bouquet.id"
:bouquet="bouquet"
/>
</div>
</div>
<ul class="fr-mt-3w fr-pl-0" role="list">
<li v-for="bouquet in bouquets" :key="bouquet.id" class="fr-col-12">
<BouquetCard :bouquet="bouquet" />
</li>
</ul>
</div>
</template>

Expand Down
Loading