Skip to content

Commit f0f4d8c

Browse files
committed
Address PR feedback
1 parent 2213443 commit f0f4d8c

File tree

6 files changed

+15
-30
lines changed

6 files changed

+15
-30
lines changed

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

Lines changed: 2 additions & 15 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);
@@ -86,7 +83,7 @@ export const OnboardingExample: FunctionComponent = () => {
8683
} as CSSProperties
8784
}
8885
>
89-
{selected}
86+
{selected === 'Select display mode' ? 'Select display mode' : `Display mode, ${selected}`}
9087
</MenuToggle>
9188
);
9289

@@ -122,15 +119,7 @@ export const OnboardingExample: FunctionComponent = () => {
122119
<SelectOption value="Embedded">Embedded</SelectOption>
123120
</SelectList>
124121
</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>
122+
<Button onClick={handleModalToggle}>Toggle modal</Button>
134123
</Stack>
135124
</div>
136125
<Chatbot ref={chatbotRef} displayMode={displayMode} isVisible isCompact></Chatbot>
@@ -141,8 +130,6 @@ export const OnboardingExample: FunctionComponent = () => {
141130
handleModalToggle={handleModalToggle}
142131
onPrimaryAction={onPrimaryAction}
143132
onSecondaryAction={onSecondaryAction}
144-
image={hasImage ? onboardingHeader : undefined}
145-
altText={hasImage ? 'Open book' : undefined}
146133
title="Redefine work in the age of AI"
147134
isCompact
148135
>

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export const OnboardingExample: FunctionComponent = () => {
8686
} as CSSProperties
8787
}
8888
>
89-
{selected}
89+
{selected === 'Select display mode' ? 'Select display mode' : `Display mode, ${selected}`}
9090
</MenuToggle>
9191
);
9292

@@ -124,13 +124,12 @@ export const OnboardingExample: FunctionComponent = () => {
124124
</Select>
125125
<Checkbox
126126
isChecked={hasImage}
127-
aria-label="Toggle whether terms and conditions has a header image"
128127
id="toggle-header-image"
129128
name="toggle-header-image"
130129
label="Has image in header"
131130
onChange={(_event, checked) => setHasImage(checked)}
132131
></Checkbox>
133-
<Button onClick={handleModalToggle}>Launch modal</Button>
132+
<Button onClick={handleModalToggle}>Toggle modal</Button>
134133
</Stack>
135134
</div>
136135
<Chatbot ref={chatbotRef} displayMode={displayMode} isVisible></Chatbot>
@@ -141,8 +140,7 @@ export const OnboardingExample: FunctionComponent = () => {
141140
handleModalToggle={handleModalToggle}
142141
onPrimaryAction={onPrimaryAction}
143142
onSecondaryAction={onSecondaryAction}
144-
image={hasImage ? onboardingHeader : undefined}
145-
altText={hasImage ? 'Open book' : undefined}
143+
headerImage={hasImage ? onboardingHeader : undefined}
146144
title="Redefine work in the age of AI"
147145
>
148146
{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)