-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcomponent.tsx
More file actions
33 lines (31 loc) · 1.06 KB
/
component.tsx
File metadata and controls
33 lines (31 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import { ReactElement } from 'react';
import { PressableProps as GesturePressableProps } from 'react-native-gesture-handler';
import { cn } from '@open-webui-react-native/mobile/shared/ui/styles';
import { Icon, IconProps } from '../icon/component';
import { IconName } from '../icon/types';
import { GestureAppPressable } from '../pressable';
import { AppSpinner } from '../spinner';
export interface GesturePressableIconButtonProps extends GesturePressableProps {
iconName: IconName;
iconProps?: Omit<IconProps, 'name'>;
isLoading?: boolean;
className?: string;
}
export function GesturePressableIconButton({
iconName,
iconProps,
isLoading,
disabled,
className,
...pressableProps
}: GesturePressableIconButtonProps): ReactElement {
return (
<GestureAppPressable
{...pressableProps}
hitSlop={8}
disabled={disabled || isLoading}
className={cn('p-8 disabled:opacity-30 items-center justify-center', className)}>
{isLoading ? <AppSpinner size='small' /> : <Icon name={iconName} {...iconProps} />}
</GestureAppPressable>
);
}