Skip to content

Commit 48d68d2

Browse files
committed
Address PR feedback
1 parent 28be9bb commit 48d68d2

File tree

6 files changed

+15
-28
lines changed

6 files changed

+15
-28
lines changed

packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/CompactOnboarding.tsx

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
} from 'react';
1010
import {
1111
Button,
12-
Checkbox,
1312
SkipToContent,
1413
MenuToggle,
1514
MenuToggleElement,
@@ -20,12 +19,10 @@ import {
2019
} from '@patternfly/react-core';
2120
import Onboarding from '@patternfly/chatbot/dist/dynamic/Onboarding';
2221
import Chatbot, { ChatbotDisplayMode } from '@patternfly/chatbot/dist/dynamic/Chatbot';
23-
import onboardingHeader from './RH-Hat-Image.svg';
2422

2523
export const OnboardingExample: FunctionComponent = () => {
2624
const [isModalOpen, setIsModalOpen] = useState(true);
2725
const [displayMode, setDisplayMode] = useState(ChatbotDisplayMode.default);
28-
const [hasImage, setHasImage] = useState(true);
2926
const chatbotRef = useRef<HTMLDivElement>(null);
3027
const termsRef = useRef<HTMLDivElement>(null);
3128
const [isOpen, setIsOpen] = useState(false);
@@ -85,6 +82,7 @@ export const OnboardingExample: FunctionComponent = () => {
8582
width: '200px'
8683
} as CSSProperties
8784
}
85+
aria-label={selected === 'Select display mode' ? 'Select display mode' : `Display mode, ${selected}`}
8886
>
8987
{selected}
9088
</MenuToggle>
@@ -122,15 +120,7 @@ export const OnboardingExample: FunctionComponent = () => {
122120
<SelectOption value="Embedded">Embedded</SelectOption>
123121
</SelectList>
124122
</Select>
125-
<Checkbox
126-
isChecked={hasImage}
127-
aria-label="Toggle whether terms and conditions has a header image"
128-
id="toggle-header-image"
129-
name="toggle-header-image"
130-
label="Has image in header"
131-
onChange={(_event, checked) => setHasImage(checked)}
132-
></Checkbox>
133-
<Button onClick={handleModalToggle}>Launch modal</Button>
123+
<Button onClick={handleModalToggle}>Toggle modal</Button>
134124
</Stack>
135125
</div>
136126
<Chatbot ref={chatbotRef} displayMode={displayMode} isVisible isCompact></Chatbot>
@@ -141,8 +131,6 @@ export const OnboardingExample: FunctionComponent = () => {
141131
handleModalToggle={handleModalToggle}
142132
onPrimaryAction={onPrimaryAction}
143133
onSecondaryAction={onSecondaryAction}
144-
image={hasImage ? onboardingHeader : undefined}
145-
altText={hasImage ? 'Open book' : undefined}
146134
title="Redefine work in the age of AI"
147135
isCompact
148136
>

packages/module/patternfly-docs/content/extensions/chatbot/examples/UI/Onboarding.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ export const OnboardingExample: FunctionComponent = () => {
8585
width: '200px'
8686
} as CSSProperties
8787
}
88+
aria-label={selected === 'Select display mode' ? 'Select display mode' : `Display mode, ${selected}`}
8889
>
8990
{selected}
9091
</MenuToggle>
@@ -124,13 +125,12 @@ export const OnboardingExample: FunctionComponent = () => {
124125
</Select>
125126
<Checkbox
126127
isChecked={hasImage}
127-
aria-label="Toggle whether terms and conditions has a header image"
128128
id="toggle-header-image"
129129
name="toggle-header-image"
130130
label="Has image in header"
131131
onChange={(_event, checked) => setHasImage(checked)}
132132
></Checkbox>
133-
<Button onClick={handleModalToggle}>Launch modal</Button>
133+
<Button onClick={handleModalToggle}>Toggle modal</Button>
134134
</Stack>
135135
</div>
136136
<Chatbot ref={chatbotRef} displayMode={displayMode} isVisible></Chatbot>
@@ -141,8 +141,7 @@ export const OnboardingExample: FunctionComponent = () => {
141141
handleModalToggle={handleModalToggle}
142142
onPrimaryAction={onPrimaryAction}
143143
onSecondaryAction={onSecondaryAction}
144-
image={hasImage ? onboardingHeader : undefined}
145-
altText={hasImage ? 'Open book' : undefined}
144+
headerImage={hasImage ? onboardingHeader : undefined}
146145
title="Redefine work in the age of AI"
147146
>
148147
{body}
19.5 KB
Loading
51.8 KB
Loading

packages/module/src/Onboarding/Onboarding.test.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ describe('Onboarding', () => {
3838
isModalOpen
3939
onSecondaryAction={onSecondaryAction}
4040
handleModalToggle={handleModalToggle}
41-
image="./image.png"
42-
altText="Test image"
41+
headerImage="./image.png"
42+
headerImageAltText="Test image"
4343
>
4444
{body}
4545
</Onboarding>
@@ -136,8 +136,8 @@ describe('Onboarding', () => {
136136
onSecondaryAction={onSecondaryAction}
137137
handleModalToggle={handleModalToggle}
138138
isCompact={true}
139-
image="./image.png"
140-
altText="Test image"
139+
headerImage="./image.png"
140+
headerImageAltText="Test image"
141141
>
142142
{body}
143143
</Onboarding>

packages/module/src/Onboarding/Onboarding.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@ export interface OnboardingProps extends ModalProps {
2727
/** Display mode for the Chatbot parent; this influences the styles applied */
2828
displayMode?: ChatbotDisplayMode;
2929
/** Optional image displayed in header */
30-
image?: string;
30+
headerImage?: string;
3131
/** Alt text for optional image displayed in header */
32-
altText?: string;
32+
headerImageAltText?: string;
3333
/** Ref applied to modal */
3434
innerRef?: React.Ref<HTMLDivElement>;
3535
/** OuiaID applied to modal */
@@ -46,8 +46,8 @@ export const OnboardingBase: FunctionComponent<OnboardingProps> = ({
4646
primaryActionBtn = 'Continue',
4747
secondaryActionBtn = 'Skip',
4848
title = 'Onboarding',
49-
image,
50-
altText,
49+
headerImage,
50+
headerImageAltText,
5151
displayMode = ChatbotDisplayMode.default,
5252
className,
5353
children,
@@ -80,9 +80,9 @@ export const OnboardingBase: FunctionComponent<OnboardingProps> = ({
8080
<section className={`pf-chatbot__onboarding--section`} aria-label={title} tabIndex={-1} ref={innerRef}>
8181
<>
8282
<ModalBody className="pf-chatbot__onboarding--modal-body">
83-
{!isCompact && image && altText && (
83+
{!isCompact && headerImage && (
8484
<div className="pf-chatbot__onboarding--header">
85-
<img src={image} className="pf-chatbot__onboarding--image" alt={altText} />
85+
<img src={headerImage} className="pf-chatbot__onboarding--image" alt={headerImageAltText} />
8686
</div>
8787
)}
8888
<div className="pf-chatbot__onboarding--modal-text">

0 commit comments

Comments
 (0)