Skip to content

Commit

Permalink
fix: Function list sidebar being expanded by the items inside
Browse files Browse the repository at this point in the history
  • Loading branch information
NriotHrreion committed Aug 11, 2024
1 parent 6a4f4b3 commit 6ade7ad
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/components/sidebar/FunctionListItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ const FunctionListItem: React.FC<ListItemProps> = (props) => {
<span><InlineMath>{(props.mode === FunctionInputtingType.NORMAL ? "y" : "\\rho") +"_{"+ (props.index + 1).toString() +"} ="}</InlineMath></span>
</div>
<div className="function-list-item-value">
<span><InlineMath>{props.value}</InlineMath></span>
<span>
<InlineMath>{props.value}</InlineMath>
<div className="function-list-item-value-shadow"/>
</span>
</div>

<div className="function-list-item-buttons">
Expand Down
2 changes: 1 addition & 1 deletion src/components/sidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const Sidebar: React.FC = () => {
}, [sidebarOpen]);

return (
<aside className={"sidebar-container"+ (sidebarOpen ? " open" : "")} style={!Utils.isMobile() ? { width } : {}}>
<aside className={"sidebar-container"+ (sidebarOpen ? " open" : "")} style={!Utils.isMobile() ? { minWidth: width, maxWidth: width } : {}}>
{/* Mobile only */}
{<div className="mobile-control-panel">
<div className="sidebar-title">
Expand Down
17 changes: 14 additions & 3 deletions src/style/calculator/mixin.less
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,11 @@
overflow-y: auto;
.scrollbar-style();
&-item {
@transition-delay: 90ms;
display: flex;
height: 25px;
margin: 3px 20px;
padding: 3px 7px;
border-radius: 5px;
transition: background-color @transition-delay ease;
animation: function-item-added 100ms ease;
animation-iteration-count: 1;
&-tag {
Expand All @@ -163,9 +161,20 @@
}
&-value {
flex: 5;
width: 100%;
display: flex;
align-items: center;
color: var(--ca-gray-light);
overflow: hidden;
position: relative;
&-shadow {
width: 30px;
position: absolute;
top: 0;
right: 0;
bottom: 0;
background: linear-gradient(to left, var(--ca-light2), transparent);
}
}
&-buttons {
flex: .5;
Expand All @@ -181,7 +190,6 @@
width: 19px;
height: 19px;
margin-top: 3px;
transition: fill @transition-delay ease;
cursor: pointer;
}
}
Expand All @@ -194,6 +202,9 @@
.function-list-item-buttons svg:hover {
fill: var(--ca-gray1);
}
.function-list-item-value .function-list-item-value-shadow {
background: linear-gradient(to left, var(--ca-gray9), transparent);
}
}
}
}
Expand Down
8 changes: 7 additions & 1 deletion src/style/sidebar.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
.sidebar-container {
display: flex;
flex-direction: row;
overflow: hidden;
.border-line(top);
.border-line(right);
.mobile-control-panel {
display: none;
flex-direction: column;
Expand Down Expand Up @@ -99,10 +101,11 @@
}
.ka-wrapper {
flex: 4;
width: 100%;
background-color: var(--ca-light2);
position: relative;
.border-line(right);
.ka-content {
width: 100%;
height: 100%;
.sidebar-page {
display: flex;
Expand Down Expand Up @@ -287,4 +290,7 @@
.sash {
height: calc(100% - 26px - 40px);
}
&:has(.sidebar-page#function-list) {
z-index: 1;
}
}
3 changes: 1 addition & 2 deletions src/style/theme.less
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,8 @@ body[theme=light] {
}
}

.sidebar-container .ka-wrapper:has(.sidebar-page#function-list) {
.sidebar-container:has(.sidebar-page#function-list) {
box-shadow: 3px 0 10px -2px rgba(0, 0, 0, 0.1);
z-index: 1;
}

.calculator-container .output-container .number-box-list .number-box.active * {
Expand Down

1 comment on commit 6ade7ad

@github-actions
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.