Skip to content

Commit

Permalink
fix(): Fixed support case to take a link. (#18)
Browse files Browse the repository at this point in the history
fix(): Fixed support case to take a link
  • Loading branch information
dlabaj committed Mar 3, 2023
1 parent 5664af2 commit 8ac294c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions packages/module/patternfly-docs/content/examples/Basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export const BasicExample: React.FunctionComponent = () => {
email= "test@redhat.com"
onShareFeedback='https://console.redhat.com/self-managed-feedback-form'
onJoinMailingList='https://console.redhat.com/self-managed-research-form'
onOpenSupportCase='http://www.redhat.com'
isOpen={isOpen}
onClose={()=>setIsOpen(false)}/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ const pageData = {
"type": "string | \"()=>{}\"",
"description": "If a URL is given the join mailing list link will redirect to another site to join the mailing list. If a function is provided we will display a join mailing list screen with a submit button. If it's undefined then report a bug will be removed from share feedback modal"
},
{
"name": "onOpenSupportCase",
"type": "string",
"description": "URL to open a support case"
},
{
"name": "onReportABug",
"type": "string | \"()=>{}\"",
Expand Down Expand Up @@ -75,7 +80,7 @@ pageData.relativeImports = {
};
pageData.examples = {
'Example': props =>
<Example {...pageData} {...props} {...{"code":"import React from 'react';\nimport { FeedbackModal} from '@patternfly/react-user-feedback';\nimport { Button } from '@patternfly/react-core';\n\n\nexport const BasicExample: React.FunctionComponent = () => {\n const [isOpen, setIsOpen] = React.useState<boolean>(false);\n const handleButtonClicked = () => {setIsOpen(true)}; \n return <>\n <Button onClick={handleButtonClicked}>Show Modal</Button>\n <FeedbackModal \n email= \"test@redhat.com\" \n onShareFeedback='https://console.redhat.com/self-managed-feedback-form' \n onJoinMailingList='https://console.redhat.com/self-managed-research-form'\n isOpen={isOpen}\n onClose={()=>setIsOpen(false)}/>\n </>\n}\n","title":"Example","lang":"js"}}>
<Example {...pageData} {...props} {...{"code":"import React from 'react';\nimport { FeedbackModal} from '@patternfly/react-user-feedback';\nimport { Button } from '@patternfly/react-core';\n\n\nexport const BasicExample: React.FunctionComponent = () => {\n const [isOpen, setIsOpen] = React.useState<boolean>(false);\n const handleButtonClicked = () => {setIsOpen(true)}; \n return <>\n <Button onClick={handleButtonClicked}>Show Modal</Button>\n <FeedbackModal \n email= \"test@redhat.com\" \n onShareFeedback='https://console.redhat.com/self-managed-feedback-form' \n onJoinMailingList='https://console.redhat.com/self-managed-research-form'\n onOpenSupportCase='http://www.redhat.com'\n isOpen={isOpen}\n onClose={()=>setIsOpen(false)}/>\n </>\n}","title":"Example","lang":"js"}}>

</Example>
};
Expand Down
2 changes: 2 additions & 0 deletions packages/module/src/Feedback/FeedbackModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export interface FeedbackModalProps {
onReportABug?: string | "()=>{}"
/** Feedback image that shows up in the modal */
feedbackImg?: string;
/** URL to open a support case */
onOpenSupportCase?: string;
};

/**
Expand Down
4 changes: 2 additions & 2 deletions packages/module/src/Feedback/FeedbackModalInternal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export type FeedbackPages =
| 'bugReportSuccess'
| 'informDirectionSuccess';

export const FeedbackModalInternal = memo(({ email, isOpen, onShareFeedback, onJoinMailingList, onReportABug, onClose, feedbackImg }: FeedbackModalProps) => {
export const FeedbackModalInternal = memo(({ email, isOpen, onShareFeedback, onJoinMailingList, onReportABug, onOpenSupportCase, onClose, feedbackImg }: FeedbackModalProps) => {
const intl = React.useContext(LocaleContext);

const [modalPage, setModalPage] = useState<FeedbackPages>('feedbackHome');
Expand Down Expand Up @@ -68,7 +68,7 @@ export const FeedbackModalInternal = memo(({ email, isOpen, onShareFeedback, onJ
isSelectableRaised
isCompact
onClick={() => {
window.open('https://access.redhat.com/support/cases/#/case/new/open-case?caseCreate=true', '_blank');
window.open(onOpenSupportCase ? onOpenSupportCase : 'https://access.redhat.com/support/cases/#/case/new/open-case?caseCreate=true', '_blank');
}}
>
<CardTitle className="chr-c-feedback-card-title">
Expand Down

0 comments on commit 8ac294c

Please sign in to comment.