Skip to content

Commit a829f98

Browse files
committed
AppBar tweaks to prevent strange behavior on mobile devices
1 parent a1f1c73 commit a829f98

File tree

4 files changed

+11
-16
lines changed

4 files changed

+11
-16
lines changed

packages/firecms_core/src/app/Scaffold.tsx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ export const Scaffold = React.memo<PropsWithChildren<ScaffoldProps>>(
137137

138138
const DrawerHeader = () => {
139139
return (
140-
<div className="flex flex-col min-h-[68px]"></div>
140+
<div className="flex flex-col min-h-14 sm:min-h-16"></div>
141141
);
142142
};
143143

@@ -168,11 +168,10 @@ function DrawerWrapper(props: {
168168
sideOffset={12}
169169
asChild={true}>
170170
<div
171-
className="ml-2 fixed top-2 left-3 !bg-gray-50 dark:!bg-gray-900 rounded-full w-fit z-20">
171+
className="ml-2 fixed top-1 left-2 sm:top-2 sm:left-3 !bg-gray-50 dark:!bg-gray-900 rounded-full w-fit z-20">
172172
<IconButton
173173
color="inherit"
174174
aria-label="Open menu"
175-
className="sticky top-2 left-3 "
176175
onClick={() => props.setDrawerOpen(true)}
177176
size="large"
178177
>
@@ -210,7 +209,7 @@ function DrawerWrapper(props: {
210209
aria-label="Open drawer"
211210
onClick={() => props.setDrawerOpen(true)}
212211
size="large"
213-
className="absolute top-2 left-5"
212+
className="absolute sm:top-2 sm:left-5 top-1 left-2"
214213
>
215214
<MenuIcon/>
216215
</IconButton>

packages/firecms_core/src/core/DefaultAppBar.tsx

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,16 @@ export const DefaultAppBar = function DefaultAppBar({
9595
return (
9696
<div
9797
style={style}
98-
className={cls("w-full h-16 transition-all ease-in duration-75 fixed",
98+
className={cls("w-full h-14 sm:h-16 transition-all ease-in duration-75 absolute top-0 max-w-full overflow-x-auto no-scrollbar",
99+
"flex flex-row gap-2 px-4 items-center",
99100
{
100-
"pl-[17rem]": drawerOpen && largeLayout,
101-
"pl-20": hasDrawer && !(drawerOpen && largeLayout),
101+
"pl-[19rem]": drawerOpen && largeLayout,
102+
"pl-24": hasDrawer && !(drawerOpen && largeLayout),
102103
"z-10": largeLayout,
103-
// "w-full": !hasDrawer,
104-
// "w-[calc(100%-64px)]": hasDrawer && !(drawerOpen && largeLayout),
105-
// "w-[calc(100%-17rem)]": hasDrawer && (drawerOpen && largeLayout),
106-
"duration-150": drawerOpen && largeLayout,
104+
"duration-100": drawerOpen && largeLayout,
107105
},
108106
className)}>
109107

110-
<div className="flex flex-row gap-2 px-4 h-full items-center">
111108

112109
{navigation && <div className="mr-8 hidden lg:block">
113110
<ReactLink
@@ -174,7 +171,6 @@ export const DefaultAppBar = function DefaultAppBar({
174171

175172
</Menu>
176173

177-
</div>
178174
</div>
179175
);
180176
}

packages/firecms_core/src/core/EntityEditView.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,7 +659,7 @@ export function EntityEditViewInner<M extends Record<string, any>>({
659659
});
660660
setEntityId(updatedId);
661661
} catch (e) {
662-
onIdUpdateError && onIdUpdateError(e);
662+
onIdUpdateError?.(e);
663663
console.error(e);
664664
}
665665
setCustomIdLoading(false);
@@ -894,7 +894,7 @@ export function EntityEditViewInner<M extends Record<string, any>>({
894894

895895
<div className="h-full overflow-auto">
896896

897-
<div className="pt-12 pb-16 pl-8 pr-8 md:pl-10 md:pr-10">
897+
<div className="pt-12 pb-16 pl-4 sm:px-8 md:px-10">
898898
<div
899899
className={`w-full py-2 flex flex-col items-start mt-${4 + (pluginActions ? 8 : 0)} lg:mt-${8 + (pluginActions ? 8 : 0)} mb-8`}>
900900

packages/ui/src/components/Avatar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const AvatarInner: React.ForwardRefRenderFunction<HTMLButtonElement, AvatarProps
2727
style={style}
2828
{...props}
2929
className={cls("rounded-full flex items-center justify-center overflow-hidden",
30-
"p-1 hover:bg-slate-200 hover:dark:bg-slate-700 w-12 h-12",
30+
"p-1 hover:bg-slate-200 hover:dark:bg-slate-700 w-12 h-12 min-w-12 min-h-12",
3131
outerClassName
3232
)}>
3333
{src

0 commit comments

Comments
 (0)