File tree Expand file tree Collapse file tree 2 files changed +36
-4
lines changed
src/components/DsfrButton Expand file tree Collapse file tree 2 files changed +36
-4
lines changed Original file line number Diff line number Diff line change 11import { OhVueIcon as VIcon , addIcons } from 'oh-vue-icons'
22
3- import { RiCheckboxCircleLine , RiSearchLine } from 'oh-vue-icons/icons/ri/index.js'
3+ import { RiCheckboxCircleLine , RiLoader4Line , RiSearchLine } from 'oh-vue-icons/icons/ri/index.js'
44
55import DsfrButton from './DsfrButton.vue'
66
7- addIcons ( RiCheckboxCircleLine , RiSearchLine )
7+ addIcons ( RiCheckboxCircleLine , RiSearchLine , RiLoader4Line )
88
99/**
1010 * [Voir quand l’utiliser sur la documentation du DSFR](https://www.systeme-de-design.gouv.fr/elements-d-interface/composants/bouton)
@@ -114,6 +114,35 @@ BoutonPrimaireAvecIcone.args = {
114114 size : undefined ,
115115}
116116
117+ export const BoutonPrimaireAvecIconeAnimee = ( args ) => ( {
118+ components : { DsfrButton } ,
119+ data ( ) {
120+ return {
121+ ...args ,
122+ }
123+ } ,
124+ template : `
125+ <DsfrButton
126+ :label="label"
127+ :disabled="disabled"
128+ :icon="icon"
129+ :size="size"
130+ :no-outline="noOutline"
131+ :icon-right="iconRight"
132+ @click="onClick"
133+ />
134+ ` ,
135+
136+ } )
137+ BoutonPrimaireAvecIconeAnimee . args = {
138+ label : 'Label bouton' ,
139+ disabled : false ,
140+ icon : { name : 'ri-loader-4-line' , animation : 'spin' } ,
141+ iconRight : true ,
142+ noOutline : false ,
143+ size : undefined ,
144+ }
145+
117146export const BoutonSecondaire = ( args ) => ( {
118147 components : { DsfrButton } ,
119148 data ( ) {
Original file line number Diff line number Diff line change 11<script lang="ts" setup>
22import { type Ref , computed , ref } from ' vue'
33import { OhVueIcon as VIcon } from ' oh-vue-icons'
4+ import { type CustomizeIconType } from ' oh-vue-icons'
45
56// import '@gouvfr/dsfr/dist/component/button/button.module.js'
67
@@ -13,7 +14,7 @@ export type DsfrButtonProps = {
1314 iconOnly? : boolean
1415 noOutline? : boolean
1516 size? : ' sm' | ' small' | ' lg' | ' large' | ' md' | ' medium' | ' ' | undefined
16- icon? : string
17+ icon? : string | CustomizeIconType
1718 onClick? : ($event : MouseEvent ) => void
1819}
1920
@@ -33,6 +34,8 @@ const focus = () => {
3334 btn .value ?.focus ()
3435}
3536defineExpose ({ focus })
37+
38+ const iconProps = computed (() => typeof props .icon === ' string' ? { name: props .icon } : props .icon )
3639 </script >
3740
3841<template >
@@ -57,7 +60,7 @@ defineExpose({ focus })
5760 >
5861 <VIcon
5962 v-if =" icon"
60- :name = " icon "
63+ v-bind = " iconProps "
6164 />
6265 <span v-if =" !iconOnly" >
6366 {{ label }}
You can’t perform that action at this time.
0 commit comments