From 4b6464283701c84fc34dd6e85ae0a219d3e82651 Mon Sep 17 00:00:00 2001 From: Emmanuel Pelletier Date: Wed, 15 May 2024 20:39:33 +0200 Subject: [PATCH] gaufre: new variant props to impact sizing this is done to integrate the button more easily in an app using the DSFR heading --- .../integration/src/components/Gaufre.tsx | 20 +++++++++- packages/integration/src/dev/DsfrHeader.tsx | 37 ++++++++++++++++--- packages/integration/src/dev/dev.tsx | 3 +- packages/integration/src/styles/gaufre.css | 26 +++++++++++-- 4 files changed, 73 insertions(+), 13 deletions(-) diff --git a/packages/integration/src/components/Gaufre.tsx b/packages/integration/src/components/Gaufre.tsx index 2988847..2277477 100644 --- a/packages/integration/src/components/Gaufre.tsx +++ b/packages/integration/src/components/Gaufre.tsx @@ -1,11 +1,27 @@ import { useTranslate } from "../i18n/useTranslate" -export const Gaufre = () => { +export type Props = { + /** + * Variantes d'affichage : + * + * "responsive": Affiche un bouton plus petit sur écran mobile/tablette, plus grand sur écran plus large. + * "small": Affiche un bouton plus petit. + */ + variant?: "responsive" | "small" +} + +const variantClasses = { + responsive: "lasuite-gaufre-btn--responsive", + small: "lasuite-gaufre-btn--small", +} + +export const Gaufre = ({ variant }: Props) => { const { t } = useTranslate() + const variantClass = !!variant ? variantClasses[variant] : "" return ( +
}) => {
+ ) } diff --git a/packages/integration/src/dev/dev.tsx b/packages/integration/src/dev/dev.tsx index 2783e9f..b20384f 100644 --- a/packages/integration/src/dev/dev.tsx +++ b/packages/integration/src/dev/dev.tsx @@ -115,7 +115,7 @@ const routes = [ label: "Gaufre (header DSFR)", component: ( - ]} /> +

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec ac diam a libero posuere @@ -157,7 +157,6 @@ const routes = [