Skip to content

Commit

Permalink
feat: scroll to enterprise on selection
Browse files Browse the repository at this point in the history
  • Loading branch information
victor committed Jan 30, 2025
1 parent 33c4292 commit bce8664
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ export const EnterpriseAgreementSearchInput = ({
goBack={() => {
setSelectedEnterprise(undefined);
setSelectedAgreement(undefined);
window.scrollTo(0, 0);
}}
onAgreementSelect={(agreement) => {
emitSelectEnterpriseEvent({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
"use client";
import { fr } from "@codegouvfr/react-dsfr";
import { Enterprise } from "../types";
import { useEffect, useRef } from "react";

type Props = {
enterprise: Omit<Enterprise, "complements">;
};

export const EnterpriseAgreementSelectionDetail = ({ enterprise }: Props) => {
const titleRef = useRef<HTMLParagraphElement>(null);
useEffect(() => {
titleRef.current?.scrollIntoView();
}, []);
return (
<>
<p className={fr.cx("fr-h4", "fr-mt-2w", "fr-mb-0")}>Votre entreprise</p>
<p className={fr.cx("fr-h4", "fr-mt-2w", "fr-mb-0")} ref={titleRef}>
Votre entreprise
</p>
<h2 className={fr.cx("fr-h6", "fr-m-0", "fr-mt-2w")}>
{enterprise.label}
</h2>
Expand Down

0 comments on commit bce8664

Please sign in to comment.