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

new-log-viewer: In the menubar, show file name with a centered ellipsis when the name overflows (Fixes #97). #98

Merged
merged 2 commits into from
Oct 21, 2024
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
6 changes: 6 additions & 0 deletions new-log-viewer/src/components/MenuBar/PageNumInput.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
.page-num-input {
/* Ensures the content within the element does not wrap, preventing visual overflow when
adjacent elements under the same parent container attempt to take up space. */
white-space: nowrap;
}

.page-num-input input::-webkit-outer-spin-button,
.page-num-input input::-webkit-inner-spin-button {
margin: 0;
Expand Down
19 changes: 16 additions & 3 deletions new-log-viewer/src/components/MenuBar/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,28 @@
.menu-bar-logo-container {
display: flex;
justify-content: center;
width: 48px;
min-width: 48px;
Copy link
Member Author

Choose a reason for hiding this comment

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

This avoids the YScope logo container from being squeezed when the other items in the menu bar try to take space.

height: var(--ylv-status-bar-height);
}

.menu-bar-open-file-icon {
font-size: 24px !important;
}

.menu-bar-filename {
.menu-bar-filename-container {
overflow-x: hidden;
display: flex;
flex-grow: 1;
padding-left: 10px;
padding-inline: 0.75rem !important;
}

.menu-bar-filename-left-split {
overflow-x: hidden;
text-overflow: ellipsis;
}

.menu-bar-filename-right-split {
overflow-x: hidden;
display: flex !important;
justify-content: flex-end;
}
22 changes: 17 additions & 5 deletions new-log-viewer/src/components/MenuBar/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {useContext} from "react";

import {
Box,
Divider,
IconButton,
Sheet,
Expand Down Expand Up @@ -59,12 +60,23 @@ const MenuBar = () => {
</Tooltip>
<Divider orientation={"vertical"}/>

<Typography
className={"menu-bar-filename"}
level={"body-md"}
<Box
className={"menu-bar-filename-container"}
title={fileName}
>
{fileName}
</Typography>
<Typography
className={"menu-bar-filename-left-split"}
level={"body-md"}
>
{fileName.slice(0, fileName.length / 2)}
</Typography>
<Typography
className={"menu-bar-filename-right-split"}
level={"body-md"}
>
{fileName.slice(fileName.length / 2)}
</Typography>
</Box>

<Divider orientation={"vertical"}/>
<NavigationBar/>
Expand Down
Loading