mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-02 22:52:58 +00:00
- Add DropdownTrigger and ComboboxTrigger with an overridable chevron slot and a 1 px translateY caret nudge for consistent vertical alignment. - Convert text-based dropdown/combobox triggers across model selector, agent controls, mode control, settings, and new workspace to use the shared components. - Lay out New Workspace arguments horizontally on desktop without labels while keeping the mobile vertical stack; align the project icon left edge with the title.
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import type { ReactElement, ReactNode } from "react";
|
|
import { View } from "react-native";
|
|
import { StyleSheet, withUnistyles } from "react-native-unistyles";
|
|
import { ChevronDown } from "lucide-react-native";
|
|
import { ICON_SIZE, type Theme } from "@/styles/theme";
|
|
import { DropdownMenuTrigger, type DropdownMenuTriggerProps } from "@/components/ui/dropdown-menu";
|
|
|
|
const ThemedChevronDown = withUnistyles(ChevronDown);
|
|
|
|
interface DropdownTriggerProps extends Omit<DropdownMenuTriggerProps, "children"> {
|
|
children?: ReactNode;
|
|
chevron?: ReactNode | null;
|
|
}
|
|
|
|
const chevronColorMapping = (theme: Theme) => ({
|
|
color: theme.colors.foregroundMuted,
|
|
});
|
|
|
|
export function DropdownTrigger({
|
|
children,
|
|
chevron,
|
|
...props
|
|
}: DropdownTriggerProps): ReactElement {
|
|
return (
|
|
<DropdownMenuTrigger {...props}>
|
|
<View style={styles.row}>
|
|
{children}
|
|
{chevron !== null &&
|
|
(chevron ?? (
|
|
<View style={styles.chevronContainer}>
|
|
<ThemedChevronDown size={ICON_SIZE.sm} uniProps={chevronColorMapping} />
|
|
</View>
|
|
))}
|
|
</View>
|
|
</DropdownMenuTrigger>
|
|
);
|
|
}
|
|
|
|
const styles = StyleSheet.create((theme) => ({
|
|
row: {
|
|
flexDirection: "row",
|
|
alignItems: "center",
|
|
gap: theme.spacing[1],
|
|
},
|
|
chevronContainer: {
|
|
transform: [{ translateY: 1 }],
|
|
},
|
|
}));
|