-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bfe5c87
commit 0466ab9
Showing
10 changed files
with
195 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
packages/module/src/ChatbotHeader/ChatbotHeaderCloseButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from 'react'; | ||
|
||
import { Button, Icon, Tooltip, TooltipProps } from '@patternfly/react-core'; | ||
import { CloseIcon } from '@patternfly/react-icons'; | ||
|
||
export interface ChatbotHeaderCloseButtonProps { | ||
/** Callback function for when button is clicked */ | ||
onClick: () => void; | ||
/** Custom classname for the header component */ | ||
className?: string; | ||
/** Props spread to the PF Tooltip component wrapping the display mode dropdown */ | ||
tooltipProps?: TooltipProps; | ||
/** Aria label for menu */ | ||
menuAriaLabel?: string; | ||
/** Ref applied to menu */ | ||
innerRef?: React.Ref<HTMLButtonElement>; | ||
/** Content used in tooltip */ | ||
tooltipContent?: string; | ||
} | ||
|
||
const ChatbotHeaderCloseButtonBase: React.FunctionComponent<ChatbotHeaderCloseButtonProps> = ({ | ||
className, | ||
onClick, | ||
tooltipProps, | ||
menuAriaLabel = 'Close', | ||
innerRef, | ||
tooltipContent = 'Close' | ||
}: ChatbotHeaderCloseButtonProps) => ( | ||
<div className={`pf-chatbot__menu ${className}`}> | ||
<Tooltip content={tooltipContent} position="bottom" {...tooltipProps}> | ||
<Button | ||
className="pf-chatbot__button--toggle-menu" | ||
variant="plain" | ||
onClick={onClick} | ||
aria-label={menuAriaLabel} | ||
ref={innerRef} | ||
icon={ | ||
<Icon size="xl" isInline> | ||
<CloseIcon /> | ||
</Icon> | ||
} | ||
/> | ||
</Tooltip> | ||
</div> | ||
); | ||
|
||
export const ChatbotHeaderCloseButton = React.forwardRef( | ||
(props: ChatbotHeaderCloseButtonProps, ref: React.Ref<HTMLButtonElement>) => ( | ||
<ChatbotHeaderCloseButtonBase innerRef={ref} {...props} /> | ||
) | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import React from 'react'; | ||
|
||
export interface SettingsFormProps { | ||
/** Class applied to form container */ | ||
className?: string; | ||
/** Array of fields to display in the settings layout */ | ||
fields?: { id: string; label: string; field: React.ReactElement }[]; | ||
} | ||
|
||
export const SettingsForm: React.FunctionComponent<SettingsFormProps> = ({ className, fields = [], ...props }) => ( | ||
<div className={`pf-chatbot__settings-form-container ${className}`} {...props}> | ||
<form className="pf-chatbot__settings-form"> | ||
{fields.map((field) => ( | ||
<div className="pf-chatbot__settings-form-row" key={field.label}> | ||
<label className="pf-chatbot__settings-label" htmlFor={field.id}> | ||
{field.label} | ||
</label> | ||
{field.field} | ||
</div> | ||
))} | ||
</form> | ||
</div> | ||
); | ||
|
||
export default SettingsForm; |
Oops, something went wrong.