Skip to content

Commit

Permalink
Add subheader.
Browse files Browse the repository at this point in the history
  • Loading branch information
elmisback committed Nov 7, 2024
1 parent eb32fcf commit 23303bb
Show file tree
Hide file tree
Showing 3 changed files with 52 additions and 3 deletions.
33 changes: 32 additions & 1 deletion src/herbie/HerbieUI.css
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,11 @@ input[type="text"]:focus, select:focus {
display: grid;
grid-template-areas:
"header header"
"subheader subheader"
"visualizations expressions"
"visualizations expressions";
height: 100vh;
grid-template-rows: 40px 1fr 3em;
grid-template-rows: 40px 50px 1fr 3em;
grid-template-columns: 4fr 6fr; /*min(70%, 600px);*/
}

Expand Down Expand Up @@ -282,4 +283,34 @@ a.action:focus {

.katex .mathnormal {
font: normal 1em 'Ruda' !important;
}

.subheader {
grid-area: subheader; /* Place the subheader in the "subheader" grid area */
display: grid;
grid-template-columns: 1fr auto 1fr; /* Three columns: flexible space, center item, flexible space */
align-items: center; /* Center items vertically */
padding: 10px 27px;
font-size: 20px;
background-color: var(--background-color);
color: var(--foreground-color);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.subheader .left-item {
grid-column: 1; /* Place in the first column */
font-size: 14px;
color: var(--action-color);
text-decoration: none;
}

/* .subheader .left-item:hover {
text-decoration: underline;
} */

.subheader .center-item {
grid-column: 2; /* Place in the center column */
justify-self: center; /* Center the item within its grid cell */
font-family: 'Ruda', sans-serif;
font-weight: bold;
}
20 changes: 19 additions & 1 deletion src/herbie/HerbieUI.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,24 @@ function HerbieUIInner() {
)
}

function mySubHeader() {
return (
<div className="subheader">
<a
href="#"
className="left-item action"
onClick={() => setShowOverlay(true)}
>
&larr; Back to Spec Entry
</a>
<div className="center-item">
<strong>{spec.expression}</strong>
</div>
<div></div> {/* Empty div for flexible space on the right */}
</div>
);
}

return (
<div>
{showOverlay && // HACK to show the spec config component. Not a true overlay now, needs to be refactored.
Expand All @@ -569,7 +587,7 @@ function HerbieUIInner() {
{!showOverlay &&
<div className="grid-container">
{myHeader()}

{mySubHeader()}
<ExpressionTable />
<div className="visualizations">
<SelectableVisualization components={components} />
Expand Down
2 changes: 1 addition & 1 deletion src/herbie/SpecComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ function SpecComponent({ showOverlay, setShowOverlay }: { showOverlay: boolean,
return (
<div className="spec-container">
<div className="spec-title">
<div className="spec-text" onClick={handleSpecClick}>{value.expression}</div>
{/* <div className="spec-text" onClick={handleSpecClick}>{value.expression}</div> */}
</div>
<Modal
isOpen={false}
Expand Down

0 comments on commit 23303bb

Please sign in to comment.