Skip to content
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

feat(react-components): Added optional support in Split window header to render a component #4723

Merged
merged 4 commits into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
6 changes: 3 additions & 3 deletions react-components/src/components/Widgets/WindowWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type WindowWidgetProps = {
subtitle?: string;
header?: string;
type?: string;
openInNewTab?: ReactNode;
customComponent?: ReactNode;
pramodcog marked this conversation as resolved.
Show resolved Hide resolved
children: ReactNode;
onClose?: () => void;
onResize?: (width: number, height: number) => void;
Expand All @@ -39,7 +39,7 @@ export const WindowWidget = ({
header,
type,
children,
openInNewTab,
customComponent,
onClose,
onResize
}: WindowWidgetProps): ReactElement => {
Expand Down Expand Up @@ -117,7 +117,7 @@ export const WindowWidget = ({
onResize={handleResize}>
<Widget>
<Widget.Header title={title} type={type} header={header} subtitle={subtitle}>
{openInNewTab !== undefined && <div>{openInNewTab}</div>}
{customComponent !== undefined && customComponent}
<CogsTooltip
content={
isMinimized
Expand Down
2 changes: 1 addition & 1 deletion react-components/src/components/Widgets/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ export const WIDGET_WINDOW_X_OFFSET = 150;
export const WIDGET_WINDOW_Y_OFFSET = 75;
export const WIDGET_WIDTH_FACTOR = 0.4;
export const WIDGET_HEIGHT_FACTOR = 0.7;
export const WIDGET_WINDOW_MIN_WIDTH = 300;
export const WIDGET_WINDOW_MIN_WIDTH = 400;
export const WIDGET_WINDOW_MIN_HEIGHT = 48;
export const WIDGET_INSIDE_WINDOW_MIN_HEIGHT = 150;
8 changes: 6 additions & 2 deletions react-components/stories/SplitWindow.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const Main: Story = {
<WindowWidget
header="Widget Header"
onClose={handleClose}
openInNewTab={openExternalButton()}>
customComponent={openExternalButton()}>
<SecondaryRevealContainer />
</WindowWidget>
)}
Expand All @@ -61,7 +61,11 @@ export const Main: Story = {
};

function openExternalButton(): ReactNode {
return <Button>Open in New Tab</Button>;
return (
<Button style={{ whiteSpace: 'nowrap', overflow: 'hidden', textOverflow: 'ellipsis' }}>
Open in New Tab
</Button>
);
}

function SecondaryRevealContainer(): ReactElement {
Expand Down
Loading