Display search on mobile (#286)

This commit is contained in:
Mario N. Nikolov
2026-05-02 16:26:29 +03:00
committed by GitHub
parent 61dc588cd6
commit a323050958
2 changed files with 31 additions and 9 deletions

View File

@@ -178,10 +178,6 @@ div.zoom {
text-transform: uppercase; text-transform: uppercase;
} }
.ui.sub.header, .ui.list {
margin-left: 20px;
}
.limit-height { .limit-height {
height: 300px; height: 300px;
overflow-y: scroll; overflow-y: scroll;
@@ -339,6 +335,14 @@ div.zoom {
white-space: pre; white-space: pre;
} }
@media (max-width: 450px) {
/* Hide the title from the top bar when the viewport is too small to display
it alongside the search box. */
.topbar--title {
display: none;
}
}
@media (max-width: 767px) { @media (max-width: 767px) {
#sidebar { #sidebar {
background-color: #fff; background-color: #fff;
@@ -385,4 +389,15 @@ div.zoom {
#content #sidebar.very.thin ~ .pusher { #content #sidebar.very.thin ~ .pusher {
width: 100%; width: 100%;
} }
/* Push the search box to the right on small screens. */
.ui.search {
margin-left: auto;
margin-right: 1em;
}
.ui.search>.results {
left: initial;
right: 0;
}
} }

View File

@@ -224,10 +224,10 @@ export function TopBar(props: Props) {
} }
switch (screenSize) { switch (screenSize) {
case ScreenSize.LARGE: { case ScreenSize.LARGE:
// Show dropdown if chart is shown, otherwise show individual menu // Show dropdown if chart is shown, otherwise show individual menu
// items. // items.
const menus = props.showingChart ? ( return props.showingChart ? (
<Dropdown <Dropdown
trigger={ trigger={
<div> <div>
@@ -250,8 +250,6 @@ export function TopBar(props: Props) {
<WikiTreeMenu menuType={MenuType.Menu} {...props} /> <WikiTreeMenu menuType={MenuType.Menu} {...props} />
</> </>
); );
return menus;
}
case ScreenSize.SMALL: case ScreenSize.SMALL:
return ( return (
@@ -311,7 +309,16 @@ export function TopBar(props: Props) {
</Dropdown.Item> </Dropdown.Item>
</Dropdown.Menu> </Dropdown.Menu>
</Dropdown> </Dropdown>
<div className="topbar--title">
{props.standalone ? <Link to="/">{title()}</Link> : title()} {props.standalone ? <Link to="/">{title()}</Link> : title()}
</div>
{props.showingChart && (
<SearchBar
data={props.data!}
onSelection={props.eventHandlers.onSelection}
{...props}
/>
)}
</> </>
); );
} }