Skip to content

Commit

Permalink
feat: ajout composant Follow
Browse files Browse the repository at this point in the history
  • Loading branch information
slafayIGN committed Sep 30, 2024
1 parent 2e51f1f commit aedd51c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
19 changes: 19 additions & 0 deletions assets/components/Layout/AppFollow.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { memo } from "react";
import Follow from "@codegouvfr/react-dsfr/Follow";
import { routes } from "../../router/router";

const AppFollow = () => {
return (
<Follow
newsletter={{
buttonProps: {
linkProps: {
...routes.newsletter_subscribe().link,
},
},
}}
/>
);
};

export default memo(AppFollow);
4 changes: 4 additions & 0 deletions assets/components/Layout/AppLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import SessionExpiredAlert from "../Utils/SessionExpiredAlert";
import SnackbarMessage from "../Utils/SnackbarMessage";
import AppFooter from "./AppFooter";
import AppHeader from "./AppHeader";
import AppFollow from "./AppFollow";

const HiddenElements: FC = () => {
return (
Expand Down Expand Up @@ -70,6 +71,8 @@ const AppLayout: FC<PropsWithChildren<AppLayoutProps>> = ({ children, navItems,
return getBreadcrumb(route, datastoreQuery.data);
}, [route, datastoreQuery.data, customBreadcrumbProps]);

const newsletterSubscribeAction = (document.getElementById("app_env") as HTMLDivElement)?.dataset?.["newsletterSubscribeAction"] ?? null;

navItems = useMemo(() => navItems ?? defaultNavItems(t), [navItems, t]);

return (
Expand All @@ -90,6 +93,7 @@ const AppLayout: FC<PropsWithChildren<AppLayoutProps>> = ({ children, navItems,
{children}
</div>
</main>
{newsletterSubscribeAction !== null && <AppFollow />}
<AppFooter />
<SnackbarMessage />
</>
Expand Down

0 comments on commit aedd51c

Please sign in to comment.