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

fine-tuning workspace menu styles #222

Open
wants to merge 4 commits into
base: workspace
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,7 @@
import { i18n } from '@osd/i18n';
import React, { useState } from 'react';
import { useObservable } from 'react-use';
import {
EuiCollapsibleNavGroup,
EuiContextMenu,
EuiFlexGroup,
EuiFlexItem,
EuiIcon,
EuiPopover,
EuiText,
} from '@elastic/eui';
import { EuiCollapsibleNavGroup, EuiContextMenu, EuiIcon, EuiPopover, EuiText } from '@elastic/eui';

import {
ApplicationStart,
Expand Down Expand Up @@ -139,43 +131,30 @@ export const WorkspaceMenu = ({ basePath, getUrlForApp, workspaces }: Props) =>
};

const currentWorkspaceButton = (
<EuiCollapsibleNavGroup>
<EuiFlexGroup>
<EuiFlexItem>
<EuiIcon type="logoOpenSearch" size="l" />
</EuiFlexItem>
<EuiFlexItem>
<EuiText>
<strong> {currentWorkspaceName} </strong>
</EuiText>
</EuiFlexItem>
<EuiFlexItem>
<EuiIcon type="arrowDown" onClick={onButtonClick} />
</EuiFlexItem>
</EuiFlexGroup>
</EuiCollapsibleNavGroup>
);

const currentWorkspaceTitle = (
<EuiFlexGroup>
<EuiFlexItem>
<EuiIcon type="logoOpenSearch" size="l" />
</EuiFlexItem>
<EuiFlexItem>
<EuiText>
<strong> {currentWorkspaceName} </strong>
</EuiText>
</EuiFlexItem>
<EuiFlexItem>
<EuiIcon type="cross" onClick={closePopover} />
</EuiFlexItem>
</EuiFlexGroup>
<EuiCollapsibleNavGroup
title={
<h3
style={{
width: '202px',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is is okay to use hardcode width?

Copy link
Owner Author

@ruanyl ruanyl Oct 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right, I cleanup the custom styles.

whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
overflow: 'hidden',
}}
>
{currentWorkspaceName}
</h3>
}
iconType={currentWorkspace?.icon ?? 'users'}
isCollapsible={true}
initialIsOpen={false}
onClick={onButtonClick}
forceState={isPopoverOpen ? 'open' : 'closed'}
/>
);

const panels = [
{
id: 0,
title: currentWorkspaceTitle,
items: [
{
name: (
Expand Down Expand Up @@ -213,11 +192,12 @@ export const WorkspaceMenu = ({ basePath, getUrlForApp, workspaces }: Props) =>
return (
<EuiPopover
id="contextMenuExample"
display="block"
button={currentWorkspaceButton}
isOpen={isPopoverOpen}
closePopover={closePopover}
panelPaddingSize="none"
anchorPosition="downLeft"
anchorPosition="downCenter"
>
<EuiContextMenu initialPanelId={0} panels={panels} />
</EuiPopover>
Expand Down
Loading