Skip to content

Commit 81e3570

Browse files
committed
fix(android): space the New thread FAB 16dp from the edge and tab bar
1 parent 82f40d7 commit 81e3570

3 files changed

Lines changed: 15 additions & 9 deletions

File tree

‎apps/mobile/src/features/home/AndroidHomeFab.android.tsx‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import { useWorkspaceState } from "../../state/workspace";
1212
import { FabScrollContext } from "./FabScrollContext";
1313
import { updateFabScroll } from "./fab-scroll";
1414
import { useAppearancePreferences } from "../settings/appearance/AppearancePreferencesProvider";
15+
import { ANDROID_HOME_FAB_MARGIN, androidHomeFabBottom } from "./android-home-fab-position";
1516

1617
export function AndroidHomeFabLayout(props: ComponentProps<typeof SharedAndroidHomeFabLayout>) {
1718
const insets = useSafeAreaInsets();
@@ -42,11 +43,10 @@ export function AndroidHomeFabLayout(props: ComponentProps<typeof SharedAndroidH
4243
extended
4344
expanded={expanded}
4445
onPress={props.onStartNewTask}
45-
className="absolute right-5"
46+
className="absolute"
4647
style={{
47-
bottom: props.sidebar
48-
? Math.max(insets.bottom, 12) + 6
49-
: Math.max(insets.bottom, 16) + 16,
48+
right: ANDROID_HOME_FAB_MARGIN,
49+
bottom: androidHomeFabBottom(insets.bottom, props.sidebar),
5050
}}
5151
/>
5252
) : null}

‎apps/mobile/src/features/home/ThreadListToolbar.tsx‎

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import { WorkspaceConnectionTitle } from "./WorkspaceConnectionTitle";
2222
import { useWorkspaceState } from "../../state/workspace";
2323
import { useAndroidControlSizing } from "../../components/ui/useAndroidControlSizing";
2424
import { useToolbarLayout } from "../../components/ui/useToolbarLayout";
25+
import { ANDROID_HOME_FAB_MARGIN, androidHomeFabBottom } from "./android-home-fab-position";
2526

2627
/** One toolbar height for the compact list and expanded sidebar, including search. */
2728
export function ThreadListToolbar(props: {
@@ -140,12 +141,10 @@ export function ThreadListToolbar(props: {
140141
</View>
141142
{state.hasConnections ? (
142143
<View
143-
className="absolute right-5 z-[5]"
144+
className="absolute z-[5]"
144145
style={{
145-
bottom:
146-
(props.sidebar ? Math.max(insets.bottom, 12) + 6 : Math.max(insets.bottom, 16) + 16) +
147-
fabSize +
148-
8,
146+
right: ANDROID_HOME_FAB_MARGIN,
147+
bottom: androidHomeFabBottom(insets.bottom, props.sidebar) + fabSize + 8,
149148
}}
150149
>
151150
<AndroidAnchoredMenu actions={props.filterActions} onPressAction={props.onFilterAction}>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Material's FAB margin, in dp so it does not grow with the app's text size.
2+
export const ANDROID_HOME_FAB_MARGIN = 16;
3+
4+
/** Bottom offset shared by the New thread FAB and the filter button stacked above it. */
5+
export function androidHomeFabBottom(safeAreaBottom: number, sidebar: boolean | undefined) {
6+
return sidebar ? Math.max(safeAreaBottom, 12) + 6 : safeAreaBottom + ANDROID_HOME_FAB_MARGIN;
7+
}

0 commit comments

Comments
 (0)