Skip to content

Commit 8fb51b9

Browse files
authored
fix: Adding conditional check to apply styles for TitleDescriptionWithIcon and added some examples (#398)
1 parent 28352f1 commit 8fb51b9

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

example/src/config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,11 @@ export const tabbarButtons: TabBarMainAction[] = [
3232
text: 'Welcome screen',
3333
icon: MynahIcons.Q,
3434
},
35+
{
36+
id: 'account-details',
37+
text: 'Non chat tab (Account Details)',
38+
icon: MynahIcons.USER,
39+
},
3540
{
3641
id: 'splash-loader',
3742
text: 'Show splash loader',

example/src/main.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ import {
5353
mcpToolRunSampleCard,
5454
mcpToolRunSampleCardInit,
5555
sampleRulesList,
56+
accountDetailsTabData,
5657
} from './samples/sample-data';
5758
import escapeHTML from 'escape-html';
5859
import './styles/styles.scss';
@@ -990,6 +991,8 @@ here to see if it gets cut off properly as expected, with an ellipsis through cs
990991
...mynahUIDefaults.store,
991992
...welcomeScreenTabData.store,
992993
});
994+
} else if (buttonId === 'account-details') {
995+
mynahUI.updateStore('', accountDetailsTabData);
993996
} else if (buttonId === 'export-chat-md') {
994997
const serializedChat = mynahUI.serializeChat(tabId, 'markdown');
995998
const blob = new Blob([serializedChat], { type: 'text/plain' });

example/src/samples/sample-data.ts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,39 @@ Transform your java project from an old version to a new one.
445445
],
446446
};
447447

448+
export const accountDetailsTabData: MynahUIDataModel = {
449+
tabBackground: false,
450+
compactMode: false,
451+
tabTitle: 'Account Details',
452+
promptInputVisible: false,
453+
tabHeaderDetails: {
454+
title: `Account details`,
455+
},
456+
chatItems: [
457+
{
458+
type: ChatItemType.ANSWER,
459+
body: `### Subscription
460+
Free Tier
461+
`,
462+
buttons: [
463+
{
464+
status: 'primary',
465+
id: 'upgrade-subscription',
466+
text: `Upgrade`,
467+
},
468+
],
469+
},
470+
{
471+
type: ChatItemType.ANSWER,
472+
body: `### Usage
473+
591/1000 queries used
474+
$0.00 incurred in overages
475+
Limits reset on 8/1/2025 at 12:00:00 GMT
476+
`,
477+
},
478+
],
479+
};
480+
448481
export const qAgentQuickActions: MynahUIDataModel['quickActionCommands'] = [
449482
{
450483
commands: [

src/components/title-description-with-icon.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,11 @@ export class TitleDescriptionWithIcon {
2424
this.render = DomBuilder.getInstance().build({
2525
type: 'div',
2626
testId: props.testId,
27-
classNames: [ 'mynah-ui-title-description-icon-wrapper', ...(this.props.classNames ?? []) ],
27+
// Apply icon wrapper styles only if icon is provided
28+
classNames: [
29+
...(this.props.icon !== undefined ? [ 'mynah-ui-title-description-icon-wrapper' ] : []),
30+
...(this.props.classNames ?? [])
31+
],
2832
children: [
2933
...(this.props.icon !== undefined
3034
? [ {

0 commit comments

Comments
 (0)