Skip to content

Commit

Permalink
add handleSubmit to show logic for saveandresume
Browse files Browse the repository at this point in the history
  • Loading branch information
RODO94 committed Jan 6, 2025
1 parent 4256293 commit fb6edfd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ interface Props {
handleSubmit?: (data?: any) => void;
}

export type OrNavigationType = "save-resume" | "navigate-to-published";

export const contentFlowSpacing = (theme: Theme): React.CSSProperties => ({
marginTop: theme.spacing(2),
[theme.breakpoints.up("md")]: {
Expand Down Expand Up @@ -88,7 +86,7 @@ const Card: React.FC<Props> = ({
Continue
</Button>
)}
<OrNavigationButton />
<OrNavigationButton handleSubmit={handleSubmit} />
</Box>
</InnerContainer>
</Container>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import { useStore } from "pages/FlowEditor/lib/store";
import React from "react";
import { ApplicationPath } from "types";

import { contentFlowSpacing, OrNavigationType } from "./Card";
import { contentFlowSpacing } from "./Card";
import NavigateToPublishedButton from "./NavigateToPublishedButton";
import SaveResumeButton from "./SaveResumeButton";

type OrNavigationType = "save-resume" | "navigate-to-published";

export const InnerContainer = styled(Box)(({ theme }) => ({
"& p": {
...contentFlowSpacing(theme),
Expand All @@ -21,7 +23,11 @@ const BUTTON_COMPONENTS = {
"navigate-to-published": NavigateToPublishedButton,
} as const;

const OrNavigationButton = () => {
const OrNavigationButton = ({
handleSubmit,
}: {
handleSubmit: ((data?: any) => void) | undefined;
}) => {
const [path, breadcrumbs, flow] = useStore((state) => [
state.path,
state.breadcrumbs,
Expand All @@ -41,7 +47,7 @@ const OrNavigationButton = () => {
);

const showSaveResumeButton =
path === ApplicationPath.SaveAndReturn && !hasSent;
path === ApplicationPath.SaveAndReturn && handleSubmit && !hasSent;

if (showSaveResumeButton && !isTestEnvironment) {
return "save-resume";
Expand Down

0 comments on commit fb6edfd

Please sign in to comment.