Skip to content

Commit 2f540be

Browse files
authored
Add styled container for alert messages in both chatbots (#1742)
Introduces .ansible-chatbot-alert-outer and .ansible-chatbot-alert-inner classes to center and constrain alert messages in the chatbot UI. Updates the component to render alerts outside the main content area for improved layout and visibility. Improve alert styling and layout in AnsibleChatbot Refactored alert rendering in AnsibleChatbot to use new wrapper classes for better centering and max-width control. Updated SCSS to add .ansible-chatbot-alert-outer and adjust .ansible-chatbot-alert-inner to use rem units for consistency across both chatbot implementations.
1 parent 30b4ab9 commit 2f540be

File tree

4 files changed

+45
-17
lines changed

4 files changed

+45
-17
lines changed

aap_chatbot/src/AnsibleChatbot/AnsibleChatbot.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,3 +76,13 @@
7676
--pf-v6-c-avatar--Height: 3rem;
7777
--pf-v6-c-avatar--BorderRadius: 0rem;
7878
}
79+
80+
.ansible-chatbot-alert-outer {
81+
padding: var(--pf-t--global--spacer--lg);
82+
display: flex;
83+
justify-content: center;
84+
}
85+
86+
.ansible-chatbot-alert-inner {
87+
max-width: 60rem;
88+
}

aap_chatbot/src/AnsibleChatbot/AnsibleChatbot.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,9 @@ export const AnsibleChatbot: React.FunctionComponent<ChatbotContext> = (
235235
</ChatbotHeaderActions>
236236
</ChatbotHeaderMain>
237237
</ChatbotHeader>
238-
<ChatbotContent>
239-
<MessageBox>
240-
<ChatbotWelcomePrompt
241-
title={"Hello " + context?.username}
242-
description="How may I help you today?"
243-
/>
244-
{alertMessage && (
238+
{alertMessage && (
239+
<div className="ansible-chatbot-alert-outer">
240+
<div className="ansible-chatbot-alert-inner">
245241
<ChatbotAlert
246242
variant={alertMessage.variant}
247243
onClose={() => {
@@ -251,7 +247,15 @@ export const AnsibleChatbot: React.FunctionComponent<ChatbotContext> = (
251247
>
252248
{alertMessage.message}
253249
</ChatbotAlert>
254-
)}
250+
</div>
251+
</div>
252+
)}
253+
<ChatbotContent>
254+
<MessageBox>
255+
<ChatbotWelcomePrompt
256+
title={"Hello " + context?.username}
257+
description="How may I help you today?"
258+
/>
255259
{(conversationId &&
256260
setCurrentConversation(conversationId, messages)) || <></>}
257261
{messages.map(

ansible_ai_connect_chatbot/src/AnsibleChatbot/AnsibleChatbot.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,13 @@
6262
--pf-v6-c-avatar--Height: 3rem;
6363
--pf-v6-c-avatar--BorderRadius: 0rem;
6464
}
65+
66+
.ansible-chatbot-alert-outer {
67+
padding: var(--pf-t--global--spacer--lg);
68+
display: flex;
69+
justify-content: center;
70+
}
71+
72+
.ansible-chatbot-alert-inner {
73+
max-width: 60rem;
74+
}

ansible_ai_connect_chatbot/src/AnsibleChatbot/AnsibleChatbot.tsx

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -353,14 +353,9 @@ export const AnsibleChatbot: React.FunctionComponent = () => {
353353
</ChatbotHeaderOptionsDropdown>
354354
</ChatbotHeaderActions>
355355
</ChatbotHeader>
356-
<ChatbotContent>
357-
<MessageBox>
358-
<ChatbotWelcomePrompt
359-
title="Hello, Ansible User"
360-
description="How may I help you today?"
361-
prompts={welcomePrompts}
362-
/>
363-
{alertMessage && (
356+
{alertMessage && (
357+
<div className="ansible-chatbot-alert-outer">
358+
<div className="ansible-chatbot-alert-inner">
364359
<ChatbotAlert
365360
variant={alertMessage.variant}
366361
onClose={() => {
@@ -370,7 +365,16 @@ export const AnsibleChatbot: React.FunctionComponent = () => {
370365
>
371366
{alertMessage.message}
372367
</ChatbotAlert>
373-
)}
368+
</div>
369+
</div>
370+
)}
371+
<ChatbotContent>
372+
<MessageBox>
373+
<ChatbotWelcomePrompt
374+
title="Hello, Ansible User"
375+
description="How may I help you today?"
376+
prompts={welcomePrompts}
377+
/>
374378
{(conversationId &&
375379
setCurrentConversation(conversationId, messages)) || <></>}
376380
{messages.map(

0 commit comments

Comments
 (0)