|
1 | 1 | <template>
|
2 |
| - <div class="fr-container fr-px-0"> |
3 |
| - <div class="fr-grid-row"> |
4 |
| - <div class="fr-col-12"> |
| 2 | + <div class="fr-card fr-card--cta fr-card--horizontal fr-card--grey fr-p-4v"> |
| 3 | + <div class="fr-card__body"> |
| 4 | + <div class="fr-card__content fr-justify-center"> |
| 5 | + <h2 |
| 6 | + class="fr-card__title fr-text--blue" |
| 7 | + v-html="title" |
| 8 | + /> |
| 9 | + <p |
| 10 | + class="fr-card__desc fr-text--md" |
| 11 | + v-html="description" |
| 12 | + /> |
5 | 13 | <div
|
6 |
| - class="fr-card fr-enlarge-link fr-card--horizontal fr-card--grey fr-p-4v fr-card--no-border" |
7 |
| - :class="{ 'fr-card--no-icon': target === '_self' }" |
| 14 | + v-if="ctaBtnTitle" |
| 15 | + class="fr-card__end" |
8 | 16 | >
|
9 |
| - <div class="fr-card__body"> |
10 |
| - <div class="fr-card__content fr-justify-center"> |
11 |
| - <component |
12 |
| - :is="titleTag" |
13 |
| - class="fr-card__title" |
14 |
| - > |
15 |
| - <a |
16 |
| - v-if="onClick" |
17 |
| - href="#" |
18 |
| - :target="target" |
19 |
| - :rel="target === '_blank' ? 'noopener external' : 'noopener'" |
20 |
| - @click.prevent="onClick()" |
21 |
| - v-html="resolvedTitle" |
22 |
| - /> |
23 |
| - <a |
24 |
| - v-else |
25 |
| - :href="resolvedLink" |
26 |
| - :target="target" |
27 |
| - :rel="target === '_blank' ? 'noopener external' : 'noopener'" |
28 |
| - v-html="resolvedTitle" |
29 |
| - /> |
30 |
| - </component> |
31 |
| - <p |
32 |
| - class="fr-card__desc fr-text--md" |
33 |
| - v-html="resolvedDescription" |
34 |
| - /> |
35 |
| - <div |
36 |
| - v-if="ctaBtnTitle" |
37 |
| - class="fr-card__end" |
38 |
| - > |
39 |
| - <TeeDsfrButton class="inline-flex fr-text--yellow fr-text--bold fr-btn-align-center"> |
40 |
| - <template #default> |
41 |
| - {{ ctaBtnTitle }} |
42 |
| - </template> |
43 |
| - </TeeDsfrButton> |
44 |
| - </div> |
45 |
| - </div> |
46 |
| - </div> |
47 |
| - <div class="fr-card__header"> |
48 |
| - <div |
49 |
| - class="fr-card__img" |
50 |
| - :class="[bgColor ? `fr-bg--${bgColor}` : '', objectFit === 'contain' ? 'fr-card__img--contain' : '']" |
51 |
| - > |
52 |
| - <img |
53 |
| - class="fr-responsive-img" |
54 |
| - :src="resolvedImageSrc" |
55 |
| - :alt="resolvedImageAlt" |
56 |
| - /> |
57 |
| - <img |
58 |
| - class="fr-card__logo" |
59 |
| - :src="img('/images/logos/mission-transition-logo-alone.png', { height: 50, width: 50, quality: 100, loading: 'lazy' })" |
60 |
| - alt="Transition Ecologique des Entreprises - ADEME" |
61 |
| - /> |
62 |
| - </div> |
63 |
| - </div> |
| 17 | + <TeeDsfrButton |
| 18 | + class="inline-flex fr-text--yellow fr-text--bold fr-btn-align-center" |
| 19 | + @click.prevent="onClick()" |
| 20 | + > |
| 21 | + <template #default> |
| 22 | + {{ ctaBtnTitle }} |
| 23 | + </template> |
| 24 | + </TeeDsfrButton> |
64 | 25 | </div>
|
65 | 26 | </div>
|
66 | 27 | </div>
|
| 28 | + <TeeHeaderLogoCard |
| 29 | + :image-src="imageSrc" |
| 30 | + :image-alt="imageAlt" |
| 31 | + :img-bg-color="imgBgColor" |
| 32 | + :object-fit="objectFit" |
| 33 | + /> |
67 | 34 | </div>
|
68 | 35 | </template>
|
69 | 36 |
|
70 | 37 | <script setup lang="ts">
|
71 |
| -import { Image } from '@/tools/image' |
72 |
| -import { computed } from 'vue' |
73 |
| -import { useRouter } from 'vue-router' |
74 |
| -import { Color, RouteName } from '@/types' |
| 38 | +import { Color } from '@/types' |
75 | 39 |
|
76 | 40 | interface Props {
|
77 |
| - link?: string |
78 | 41 | title?: string
|
79 |
| - description?: string |
| 42 | + description: string |
80 | 43 | imageSrc?: string
|
81 | 44 | imageAlt?: string
|
82 | 45 | objectFit?: 'cover' | 'contain' | 'fill' | 'none' | 'scale-down'
|
83 |
| - bgColor?: Color |
| 46 | + imgBgColor?: Color |
84 | 47 | ctaBtnTitle?: string
|
85 |
| - target?: '_blank' | '_self' | '_parent' | '_top' |
86 |
| - onClick?: CallableFunction |
87 |
| - titleTag?: 'h2' | 'h3' | 'h4' | 'h5' | 'h6' |
88 |
| - withIframeResizer?: boolean |
| 48 | + onClick: CallableFunction |
89 | 49 | }
|
90 | 50 |
|
91 |
| -const props = withDefaults(defineProps<Props>(), { |
92 |
| - link: undefined, |
93 |
| - title: undefined, |
| 51 | +withDefaults(defineProps<Props>(), { |
| 52 | + title: 'Accédez aux aides publiques pour votre projet de transition écologique', |
94 | 53 | imageSrc: undefined,
|
95 | 54 | imageAlt: undefined,
|
96 | 55 | objectFit: 'cover',
|
97 |
| - bgColor: undefined, |
98 |
| - ctaBtnTitle: undefined, |
99 |
| - target: '_blank', |
100 |
| - onClick: undefined, |
101 |
| - titleTag: 'h3', |
102 |
| - withIframeResizer: true |
| 56 | + imgBgColor: undefined, |
| 57 | + ctaBtnTitle: undefined |
103 | 58 | })
|
104 |
| -
|
105 |
| -const router = useRouter() |
106 |
| -
|
107 |
| -const defaultLink = router.resolve({ name: RouteName.Homepage }).href |
108 |
| -const defaultTitle = 'Accédez aux aides publiques pour votre projet de transition écologique' |
109 |
| -const defaultImageSrc = 'images/TEE_iframe_transparent.webp' |
110 |
| -const defaultImageAlt = "Image de la page d'accueil de mission transition écologique" |
111 |
| -
|
112 |
| -const resolvedLink = computed(() => props.link || defaultLink) |
113 |
| -const resolvedTitle = computed(() => props.title || defaultTitle) |
114 |
| -const resolvedDescription = computed( |
115 |
| - () => |
116 |
| - props.description || |
117 |
| - 'Le service public <strong>Transition écologique des entreprises</strong> vous permet de trouver les aides, accompagnements' + |
118 |
| - "et ressources issues de l'ensemble des acteurs publics pour vous aider à réaliser votre projet de transition écologique" + |
119 |
| - '(ADEME, CCI, CMA, Bpifrance, DGFiP, etc.)' |
120 |
| -) |
121 |
| -const resolvedImageSrc = computed(() => |
122 |
| - props.imageSrc |
123 |
| - ? img(props.imageSrc, { height: 250, quality: 70, loading: 'lazy' }) |
124 |
| - : img(defaultImageSrc, { height: 350, quality: 100, loading: 'lazy' }) |
125 |
| -) |
126 |
| -const resolvedImageAlt = computed(() => props.imageAlt || defaultImageAlt) |
127 |
| -
|
128 |
| -const img = Image.getUrl |
129 |
| -
|
130 |
| -if (props.withIframeResizer) { |
131 |
| - const imageResizerChild = () => import('@iframe-resizer/child') |
132 |
| - imageResizerChild() |
133 |
| -} |
134 | 59 | </script>
|
135 | 60 |
|
136 | 61 | <style scoped lang="scss">
|
137 | 62 | @use '@/assets/scss/tool';
|
138 | 63 |
|
139 | 64 | .fr-card {
|
140 |
| - .fr-card--no-icon { |
141 |
| - a::after { |
142 |
| - display: none !important; |
143 |
| - } |
144 |
| - } |
145 |
| -
|
146 |
| - .fr-card__title { |
147 |
| - a { |
148 |
| - background-image: none; |
149 |
| - outline-width: 0; |
150 |
| -
|
151 |
| - &::after { |
152 |
| - display: inline-block !important; |
153 |
| - } |
154 |
| - } |
155 |
| - } |
156 |
| -
|
157 |
| - @include tool.media-query-respond-from(md) { |
158 |
| - .fr-card__header { |
159 |
| - flex-basis: 30%; |
160 |
| - } |
161 |
| - } |
162 |
| -
|
163 |
| - @include tool.media-query-respond-from(lg) { |
164 |
| - .fr-card__header { |
165 |
| - flex-basis: 25%; |
166 |
| - } |
167 |
| - } |
168 |
| -
|
169 |
| - .fr-card__header { |
170 |
| - align-content: center; |
171 |
| - } |
172 |
| -
|
173 |
| - @include tool.media-query-respond-from(md) { |
174 |
| - .fr-card__img { |
175 |
| - max-height: 250px; |
176 |
| - } |
177 |
| - } |
178 |
| -
|
179 |
| - .fr-card__img { |
180 |
| - position: relative; |
181 |
| -
|
182 |
| - img { |
183 |
| - max-height: 250px; |
184 |
| - } |
185 |
| -
|
186 |
| - &::after { |
187 |
| - content: ''; |
188 |
| - position: absolute; |
189 |
| - z-index: 0; // Lower layer |
190 |
| - height: 100%; |
191 |
| - width: 100%; |
192 |
| - top: 0; |
193 |
| - left: 0; |
194 |
| - background: linear-gradient(to bottom right, rgb(255 255 255 / 0%) 70%, rgb(255 255 255 / 100%) 95%) !important; |
195 |
| - } |
196 |
| -
|
197 |
| - .fr-card__logo { |
198 |
| - position: absolute; |
199 |
| - bottom: 0; |
200 |
| - right: 0; |
201 |
| - width: 50px; |
202 |
| - height: 50px; |
203 |
| - z-index: 1; // Higher than the gradient |
204 |
| - } |
| 65 | + :hover:not(button, button *) { |
| 66 | + cursor: default !important; |
205 | 67 | }
|
206 | 68 | }
|
207 | 69 | </style>
|
0 commit comments