Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add headericon for prompt #822

Merged
merged 1 commit into from
Nov 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/custom/Prompt/promt-component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ interface State {
primaryOption: string;
showInfoIcon?: string;
variant?: PromptVariant;
headerIcon?: React.ReactNode;
}

interface ShowParams {
Expand All @@ -33,6 +34,7 @@ interface ShowParams {
primaryOption: string;
variant: PromptVariant;
showInfoIcon?: string;
headerIcon?: React.ReactNode;
}

export interface PromptRef {
Expand All @@ -46,7 +48,8 @@ const PromptComponent = forwardRef<PromptRef, PromptProps>(({ variant }, ref) =>
subtitle: '',
primaryOption: '',
showInfoIcon: '',
variant
variant,
headerIcon: undefined
});

/* This ref is used to store the resolve and reject functions of the promise returned by the show method */
Expand Down Expand Up @@ -78,7 +81,7 @@ const PromptComponent = forwardRef<PromptRef, PromptProps>(({ variant }, ref) =>
show
}));

const { isOpen, primaryOption, title, subtitle, showInfoIcon } = state;
const { isOpen, primaryOption, title, subtitle, showInfoIcon, headerIcon } = state;
const { resolve } = promiseInfoRef.current;

return (
Expand All @@ -87,7 +90,7 @@ const PromptComponent = forwardRef<PromptRef, PromptProps>(({ variant }, ref) =>
closeModal={hide}
title={title}
id="searchClick"
headerIcon={undefined}
headerIcon={headerIcon}
reactNode={undefined}
>
{subtitle && (
Expand Down
Loading