Better sidebar header css styling

Use sticky header which removes some hard-coded pixel positions and should work in safari.
This commit is contained in:
Tyler Hallada 2022-02-12 19:36:52 -05:00
parent 141d9c025d
commit b77c8f50d9
3 changed files with 28 additions and 19 deletions

View File

@ -65,10 +65,12 @@ const Sidebar: React.FC<Props> = ({
if (selectedCell) {
return (
<div className={styles.sidebar}>
<div className={styles["sidebar-header"]}>
<button className={styles.close} onClick={onClose}>
</button>
<h1>
</div>
<h1 className={styles["cell-name-header"]}>
Cell {selectedCell.x}, {selectedCell.y}
</h1>
{renderCellData(selectedCell)}
@ -78,9 +80,11 @@ const Sidebar: React.FC<Props> = ({
const modId = parseInt(router.query.mod as string, 10);
return (
<div className={styles.sidebar}>
<div className={styles["sidebar-header"]}>
<button className={styles.close} onClick={onClose}>
</button>
</div>
{!Number.isNaN(modId) && renderModData(modId)}
</div>
);

View File

@ -4,4 +4,5 @@
a.name {
line-height: 1.75rem;
word-wrap: break-word;
}

View File

@ -25,25 +25,29 @@
}
}
.sidebar-header {
position: sticky;
top: 0px;
width: 100%;
}
.close {
position: fixed;
top: 4px;
left: 240px;
position: absolute;
display: block;
top: 0px;
right: 0px;
font-size: 24px;
margin-left: 12px;
border: none;
background: none;
cursor: pointer;
}
@media only screen and (max-width: 600px) {
.close {
top: calc(55% + 8px);
left: initial;
right: 12px;
}
margin-top: -16px;
}
.close:hover {
color: #888888;
}
.cell-name-header {
line-height: 1.75rem;
word-wrap: break-word;
}