Skip to content

Commit becaee8

Browse files
Feature : bouton "Copier le lien" sur la fiche dispositif (#958)
- Ajout de la couleur noir dans le scss et dans le fichier de typage - Création d'un composant générique TeeCopyLinkButton utilisé dans la fiche dispositif et dans la fiche projet - Adaptation du composant pour correspondre aux maquettes de la fiche dispositif et de la fiche projet
1 parent efc9d9b commit becaee8

File tree

9 files changed

+64
-34
lines changed

9 files changed

+64
-34
lines changed

apps/web/public/css/custom.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,6 @@ button.fr-link:hover, .tee-router-link:hover {
267267
}
268268

269269
/* RESULTS LIST */
270-
.tee-program-title {
271-
color: #6A6AF4;
272-
font-size: 1.2rem;
273-
font-weight: bold;
274-
}
275270
.tee-program-resume {
276271
color: #000091;
277272
font-size: 1.7rem;

apps/web/src/assets/custom.css

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -264,11 +264,6 @@ button.fr-link:hover, .tee-router-link:hover {
264264
}
265265

266266
/* RESULTS LIST */
267-
.tee-program-title {
268-
color: #6A6AF4;
269-
font-size: 1.2rem;
270-
font-weight: bold;
271-
}
272267
.tee-program-resume {
273268
color: #000091;
274269
font-size: 1.7rem;

apps/web/src/assets/scss/setting/_color.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ $base-yellow: #facf35;
1616
$base-yellow-light: #fef7da;
1717
$colors: (
1818
"white": color.$white,
19+
"black": color.$black,
1920
"yellow": (
2021
"color": $base-yellow,
2122
"color-with-background": var(--text-action-high-blue-france)

apps/web/src/components.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ declare module 'vue' {
6161
TeeButtonExternalLink: typeof import('./components/element/button/TeeButtonExternalLink.vue')['default']
6262
TeeButtonLink: typeof import('./components/element/button/TeeButtonLink.vue')['default']
6363
TeeCallout: typeof import('./components/element/TeeCallout.vue')['default']
64+
TeeCopyLinkButton: typeof import('./components/element/TeeCopyLinkButton.vue')['default']
6465
TeeCounterResult: typeof import('./components/element/TeeCounterResult.vue')['default']
6566
TeeCredits: typeof import('./components/TeeCredits.vue')['default']
6667
TeeCta: typeof import('./components/home/TeeCta.vue')['default']
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<template>
2+
<DsfrButton
3+
:label="linkCopied ? 'Lien copié' : 'Copier le lien'"
4+
:size="size"
5+
:tertiary="tertiary"
6+
:no-outline="noOutline"
7+
class="fr-radius-a--2v"
8+
:class="`${linkCopied ? copyClass : ''} ${textClass}`"
9+
icon="fr-icon-link"
10+
@click="copyUrl"
11+
/>
12+
</template>
13+
<script setup lang="ts">
14+
interface Props {
15+
size?: 'sm' | 'md' | 'lg'
16+
noOutline?: boolean
17+
tertiary?: boolean
18+
copyClass?: string
19+
textClass?: string
20+
}
21+
withDefaults(defineProps<Props>(), {
22+
size: 'sm',
23+
noOutline: false,
24+
tertiary: false,
25+
copyClass: 'fr-bg--green',
26+
textClass: ''
27+
})
28+
const linkCopied = ref<boolean>(false)
29+
30+
const copyUrl = async () => {
31+
const pageUrl = window.location.href
32+
await navigator.clipboard.writeText(pageUrl)
33+
linkCopied.value = true
34+
setTimeout(() => {
35+
linkCopied.value = false
36+
}, 2000)
37+
}
38+
</script>

apps/web/src/components/program/detail/ProgramDetail.vue

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,16 @@
5151
<!-- TITLE & RESUME -->
5252
<div class="fr-col">
5353
<!-- PROGRAM TITLE -->
54-
<p class="tee-program-title fr-mb-5v">
55-
{{ program?.titre }}
56-
</p>
54+
<div class="program-title fr-text--purple fr-h6 fr-text--bold fr-mb-5v">
55+
<div class="program-title-text">{{ program?.titre }}</div>
56+
<TeeCopyLinkButton
57+
class="fr-ml-6v"
58+
:tertiary="true"
59+
:no-outline="true"
60+
copy-class="fr-text--green"
61+
text-class="fr-text--black"
62+
/>
63+
</div>
5764

5865
<!-- PROGRAM RESUME / TEXT-->
5966
<h2
@@ -310,3 +317,13 @@ const scrollToProgramForm = () => {
310317
}
311318
}
312319
</script>
320+
<style lang="scss" scoped>
321+
.program-title {
322+
display: flex;
323+
align-items: center;
324+
}
325+
326+
.program-title-text {
327+
height: 32px;
328+
}
329+
</style>

apps/web/src/components/program/list/ProgramCard.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<div class="fr-card__content">
44
<!-- TITLE -->
55
<div class="fr-card__start fr-mb-2v">
6-
<p class="tee-program-title">
6+
<p class="fr-text--purple fr-h6 fr-text--bold">
77
{{ program.titre }}
88
</p>
99
</div>

apps/web/src/components/project/details/ProjectDetail.vue

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,7 @@
1111
<div class="fr-container">
1212
<div class="fr-grid-row fr-pt-4v">
1313
<div class="fr-col-3 fr-col-sm-3 fr-hidden-xs">
14-
<DsfrButton
15-
:label="linkCopied ? 'Lien copié' : 'Copier le lien'"
16-
size="sm"
17-
class="fr-m-4v fr-radius-a--2v"
18-
:class="linkCopied ? 'fr-bg--green' : ''"
19-
icon="fr-icon-link"
20-
@click="copyUrl"
21-
/>
14+
<TeeCopyLinkButton class="fr-m-4v" />
2215
<ProjectSideNav :project="project" />
2316
</div>
2417
<div class="fr-col-8 fr-col-xs-12 fr-col-sm-9">
@@ -42,13 +35,11 @@
4235
<script setup lang="ts">
4336
import { ThemeType, Project, Color } from '@/types'
4437
import { Theme } from '@/utils/theme'
45-
import { DsfrButton } from '@gouvminint/vue-dsfr'
4638
import { useProjectStore } from '@/stores/project'
4739
import { onBeforeMount } from 'vue'
4840
4941
const projectStore = useProjectStore()
5042
51-
const linkCopied = ref<boolean>(false)
5243
const project = ref<Project>()
5344
const theme = ref<ThemeType>()
5445
@@ -59,15 +50,6 @@ const props = defineProps<Props>()
5950
6051
const themeColor = computed<Color | undefined>(() => theme.value?.color)
6152
62-
const copyUrl = async () => {
63-
const pageUrl = window.location.href
64-
await navigator.clipboard.writeText(pageUrl)
65-
linkCopied.value = true
66-
setTimeout(() => {
67-
linkCopied.value = false
68-
}, 2000)
69-
}
70-
7153
onBeforeMount(async () => {
7254
if (props.projectSlug !== projectStore.currentProject?.slug) {
7355
await projectStore.getProjectBySlug(props.projectSlug)

apps/web/src/types/color.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,5 +28,6 @@ export enum Color {
2828
yellowLighted = 'yellow--light',
2929
yellowLightnessed = 'yellow--lightness',
3030

31-
white = 'white'
31+
white = 'white',
32+
black = 'black'
3233
}

0 commit comments

Comments
 (0)