Skip to content

feat: tabbar supports React.ReactNode for description #4386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weโ€™ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core-browser/src/layout/layout.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface SideStateManager {
export interface View {
id: string;
name?: string;
description?: string;
description?: string | React.ComponentType<any>;
message?: string;
weight?: number;
priority?: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ export interface SectionState {
interface AccordionViewChangeEvent {
id: string;
title?: string;
description?: string;
description?: string | React.ComponentType<any>;
message?: string;
badge?: string | ViewBadge | undefined;
}
Expand Down Expand Up @@ -198,7 +198,7 @@ export class AccordionService extends WithEventBus {
}
}

updateViewDesciption(viewId: string, desc: string) {
updateViewDesciption(viewId: string, desc: string | React.ComponentType<any>) {
const view = this.views.find((view) => view.id === viewId);
if (view) {
view.description = desc;
Expand Down
8 changes: 6 additions & 2 deletions packages/main-layout/src/browser/accordion/section.view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export interface CollapsePanelProps extends React.PropsWithChildren<any> {
// Header Title
header: string;
// Header Description
description?: string;
description?: string | React.ComponentType<any>;
// Panel Message
message?: string;
// Header Size
Expand Down Expand Up @@ -185,7 +185,11 @@ export const AccordionSection = ({
</div>
{metadata.description && (
<div className={styles.section_description} style={{ lineHeight: headerSize + 'px' }}>
{transformLabelWithCodicon(metadata.description, {}, iconService.fromString.bind(iconService))}
{typeof metadata.description === 'string' ? (
transformLabelWithCodicon(metadata.description, {}, iconService.fromString.bind(iconService))
) : (
<metadata.description />
)}
</div>
)}
{metadata.badge && (
Expand Down
2 changes: 1 addition & 1 deletion packages/main-layout/src/browser/tabbar-handler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ export class TabBarHandler {
/**
* ๆ›ดๆ–ฐๅญ่ง†ๅ›พ็š„ๆ่ฟฐ
*/
updateViewDescription(viewId: string, desciption: string) {
updateViewDescription(viewId: string, desciption: string | React.ComponentType<any>) {
this.accordionService.updateViewDesciption(viewId, desciption);
}

Expand Down
Loading