material: add AppTopBar

This commit is contained in:
thislight 2024-11-26 15:18:45 +08:00
parent 47e36a354b
commit bece50643f
No known key found for this signature in database
GPG key ID: FCFE5192241CCD4E
3 changed files with 43 additions and 16 deletions

View file

@ -0,0 +1,5 @@
.AppTopBar {
& > .toolbar {
padding-top: var(--safe-area-inset-top, 0px);
}
}

View file

@ -0,0 +1,28 @@
import { AppBar, Toolbar } from "@suid/material";
import { splitProps, type JSX, type ParentComponent } from "solid-js";
import "./AppTopBar.css";
const AppTopBar: ParentComponent<{
class?: string;
style?: JSX.HTMLAttributes<HTMLElement>["style"];
}> = (oprops) => {
const [props, rest] = splitProps(oprops, ["children", "class"]);
return (
<AppBar
class={`AppTopBar ${props.class || ""}`}
elevation={1}
position="static"
{...rest}
>
<Toolbar
variant="dense"
class="toolbar"
sx={{ paddingTop: "var(--safe-area-inset-top, 0px)" }}
>
{props.children}
</Toolbar>
</AppBar>
);
};
export default AppTopBar;