Skip to content

Commit 6d3d5e1

Browse files
i18n(fr): update guides/images.mdx
See withastro#12413
1 parent 90813fa commit 6d3d5e1

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

src/content/docs/fr/guides/images.mdx

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,33 @@ import Logo from '../assets/logo.svg';
433433
<Logo width={64} height={64} fill="currentColor" />
434434
```
435435

436+
#### Type `SvgComponent`
437+
438+
<Since v="5.14.0" />
439+
440+
Vous pouvez également appliquer la sûreté du typage pour vos ressources `.svg` à l'aide du type `SvgComponent` :
441+
442+
```astro title="src/components/Logo.astro"
443+
---
444+
import type { SvgComponent } from "astro/types";
445+
import HomeIcon from './Home.svg'
446+
447+
interface Link {
448+
url: string
449+
text: string
450+
icon: SvgComponent
451+
}
452+
453+
const links: Link[] = [
454+
{
455+
url: '/',
456+
text: 'Accueil',
457+
icon: HomeIcon
458+
}
459+
]
460+
---
461+
```
462+
436463
### Création de composants d'image personnalisés
437464

438465
Vous pouvez créer un composant d'image personnalisé et réutilisable en enveloppant le composant `<Image />` ou `<Picture/>` dans un autre composant Astro. Cela vous permet de définir les attributs et les styles par défaut une seule fois.

0 commit comments

Comments
 (0)