"use client"; import { FC, ReactNode } from "react"; // helpers import { EAuthModes } from "@/types/auth"; type TAuthHeader = { authMode: EAuthModes; children: ReactNode; }; type TAuthHeaderContent = { header: string; subHeader: string; }; type TAuthHeaderDetails = { [mode in EAuthModes]: TAuthHeaderContent; }; const Titles: TAuthHeaderDetails = { [EAuthModes.SIGN_IN]: { header: "Sign in to upvote or comment", subHeader: "Contribute in nudging the features you want to get built.", }, [EAuthModes.SIGN_UP]: { header: "Comment or react to issues", subHeader: "Use plane to add your valuable inputs to features.", }, }; export const AuthHeader: FC = (props) => { const { authMode, children } = props; const getHeaderSubHeader = (mode: EAuthModes | null): TAuthHeaderContent => { if (mode) { return Titles[mode]; } return { header: "Comment or react to issues", subHeader: "Use plane to add your valuable inputs to features.", }; }; const { header, subHeader } = getHeaderSubHeader(authMode); return ( <>

{header}

{subHeader}

{children} ); };