Compare commits
No commits in common. "530a89755c649bda189cb170bb74dc41a0590a59" and "d6c717a73ebfedc1830c4ef8fb495de2cce3c634" have entirely different histories.
530a89755c
...
d6c717a73e
7 changed files with 57 additions and 39 deletions
|
@ -1,6 +1,5 @@
|
|||
.AppTopBar {
|
||||
& > .toolbar {
|
||||
padding-top: var(--safe-area-inset-top, 0px);
|
||||
gap: 8px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,12 +2,11 @@ import { AppBar, Toolbar } from "@suid/material";
|
|||
import { splitProps, type JSX, type ParentComponent } from "solid-js";
|
||||
import "./AppTopBar.css";
|
||||
import { useWindowSize } from "@solid-primitives/resize-observer";
|
||||
import type { AppBarProps } from "@suid/material/AppBar";
|
||||
|
||||
const AppTopBar: ParentComponent<{
|
||||
class?: string;
|
||||
style?: JSX.HTMLAttributes<HTMLElement>["style"];
|
||||
} & AppBarProps> = (oprops) => {
|
||||
}> = (oprops) => {
|
||||
const [props, rest] = splitProps(oprops, ["children", "class"]);
|
||||
const windowSize = useWindowSize();
|
||||
|
||||
|
|
|
@ -13,7 +13,6 @@ import {
|
|||
animateSlideInFromRight,
|
||||
animateSlideOutToRight,
|
||||
} from "~platform/anim";
|
||||
import { isPointNotInRect } from "~platform/dom";
|
||||
|
||||
export type BottomSheetProps = {
|
||||
open?: boolean;
|
||||
|
@ -121,7 +120,12 @@ const BottomSheet: ParentComponent<BottomSheetProps> = (props) => {
|
|||
event.stopPropagation();
|
||||
if (event.target !== event.currentTarget) return;
|
||||
const rect = event.currentTarget.getBoundingClientRect();
|
||||
if (isPointNotInRect(rect, event.clientX, event.clientY)) {
|
||||
const isNotInDialog =
|
||||
event.clientY < rect.top ||
|
||||
event.clientY > rect.bottom ||
|
||||
event.clientX < rect.left ||
|
||||
event.clientX > rect.right;
|
||||
if (isNotInDialog) {
|
||||
props.onClose?.("backdrop");
|
||||
}
|
||||
};
|
||||
|
|
|
@ -6,6 +6,19 @@
|
|||
.MuiToolbar-root {
|
||||
margin-left: var(--safe-area-inset-left);
|
||||
margin-right: var(--safe-area-inset-right);
|
||||
|
||||
>.MuiButtonBase-root {
|
||||
&:first-child {
|
||||
margin-left: -0.5em;
|
||||
margin-right: 24px;
|
||||
}
|
||||
|
||||
&:last-child {
|
||||
margin-right: -0.5em;
|
||||
margin-left: 24px;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,6 +40,5 @@
|
|||
.Scaffold {
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
display: contents;
|
||||
background-color: var(--tutu-color-surface);
|
||||
}
|
|
@ -19,7 +19,6 @@ import { animateSlideInFromRight, animateSlideOutToRight } from "./anim";
|
|||
import { ANIM_CURVE_DECELERATION, ANIM_CURVE_STD } from "~material/theme";
|
||||
import { makeEventListener } from "@solid-primitives/event-listener";
|
||||
import { useWindowSize } from "@solid-primitives/resize-observer";
|
||||
import { isPointNotInRect } from "./dom";
|
||||
|
||||
export type StackedRouterProps = Omit<RouterProps, "url">;
|
||||
|
||||
|
@ -174,7 +173,12 @@ function onDialogClick(
|
|||
) {
|
||||
if (event.target !== event.currentTarget) return;
|
||||
const rect = event.currentTarget.getBoundingClientRect();
|
||||
if (isPointNotInRect(rect, event.clientX, event.clientY)) {
|
||||
const isNotInDialog =
|
||||
event.clientY < rect.top ||
|
||||
event.clientY > rect.bottom ||
|
||||
event.clientX < rect.left ||
|
||||
event.clientX > rect.right;
|
||||
if (isNotInDialog) {
|
||||
onClose();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
export function isPointNotInRect(rect: DOMRect, ptX: number, ptY: number) {
|
||||
return (
|
||||
ptY < rect.top || ptY > rect.bottom || ptX < rect.left || ptX > rect.right
|
||||
);
|
||||
}
|
|
@ -62,7 +62,6 @@ import {
|
|||
createSingluarItemSelection,
|
||||
default as ItemSelectionProvider,
|
||||
} from "../timelines/toots/ItemSelectionProvider";
|
||||
import AppTopBar from "~material/AppTopBar";
|
||||
|
||||
const Profile: Component = () => {
|
||||
const { pop } = useNavigator();
|
||||
|
@ -196,38 +195,44 @@ const Profile: Component = () => {
|
|||
return (
|
||||
<Scaffold
|
||||
topbar={
|
||||
<AppTopBar
|
||||
<AppBar
|
||||
role="navigation"
|
||||
position="static"
|
||||
color={scrolledPastBanner() ? "primary" : "transparent"}
|
||||
elevation={scrolledPastBanner() ? undefined : 0}
|
||||
style={{
|
||||
color: scrolledPastBanner()
|
||||
? undefined
|
||||
: bannerSampledColors()?.text,
|
||||
}}
|
||||
>
|
||||
<IconButton color="inherit" onClick={[pop, 1]} aria-label="Close">
|
||||
<Close />
|
||||
</IconButton>
|
||||
<Title
|
||||
class="Profile__page-title"
|
||||
style={{
|
||||
visibility: scrolledPastBanner() ? undefined : "hidden",
|
||||
<Toolbar
|
||||
variant="dense"
|
||||
sx={{
|
||||
display: "flex",
|
||||
color: scrolledPastBanner()
|
||||
? undefined
|
||||
: bannerSampledColors()?.text,
|
||||
paddingTop: "var(--safe-area-inset-top)",
|
||||
}}
|
||||
innerHTML={displayName()}
|
||||
></Title>
|
||||
|
||||
<IconButton
|
||||
id={menuButId}
|
||||
aria-controls={optMenuId}
|
||||
color="inherit"
|
||||
onClick={[setMenuOpen, true]}
|
||||
aria-label="Open Options for the Profile"
|
||||
>
|
||||
<MoreVert />
|
||||
</IconButton>
|
||||
</AppTopBar>
|
||||
<IconButton color="inherit" onClick={[pop, 1]} aria-label="Close">
|
||||
<Close />
|
||||
</IconButton>
|
||||
<Title
|
||||
class="Profile__page-title"
|
||||
style={{
|
||||
visibility: scrolledPastBanner() ? undefined : "hidden",
|
||||
}}
|
||||
innerHTML={displayName()}
|
||||
></Title>
|
||||
|
||||
<IconButton
|
||||
id={menuButId}
|
||||
aria-controls={optMenuId}
|
||||
color="inherit"
|
||||
onClick={[setMenuOpen, true]}
|
||||
aria-label="Open Options for the Profile"
|
||||
>
|
||||
<MoreVert />
|
||||
</IconButton>
|
||||
</Toolbar>
|
||||
</AppBar>
|
||||
}
|
||||
class="Profile"
|
||||
>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue