mirror of
https://github.com/stablyai/orca.git
synced 2026-09-29 16:02:50 +00:00
52 lines
1.0 KiB
TypeScript
52 lines
1.0 KiB
TypeScript
import { Pressable, StyleSheet, type StyleProp, type ViewStyle } from 'react-native'
|
|
import type { ReactNode } from 'react'
|
|
import { colors, radii } from '../theme/mobile-theme'
|
|
|
|
type Props = {
|
|
children: ReactNode
|
|
disabled?: boolean
|
|
label: string
|
|
onPress: () => void
|
|
style?: StyleProp<ViewStyle>
|
|
}
|
|
|
|
export function MobileBrowserToolbarIconButton({
|
|
children,
|
|
disabled,
|
|
label,
|
|
onPress,
|
|
style
|
|
}: Props): React.JSX.Element {
|
|
return (
|
|
<Pressable
|
|
style={({ pressed }) => [
|
|
styles.button,
|
|
style,
|
|
pressed && !disabled && styles.buttonPressed,
|
|
disabled && styles.disabled
|
|
]}
|
|
disabled={disabled}
|
|
onPress={onPress}
|
|
accessibilityLabel={label}
|
|
>
|
|
{children}
|
|
</Pressable>
|
|
)
|
|
}
|
|
|
|
const styles = StyleSheet.create({
|
|
button: {
|
|
width: 26,
|
|
height: 26,
|
|
borderRadius: radii.button,
|
|
alignItems: 'center',
|
|
justifyContent: 'center'
|
|
},
|
|
buttonPressed: {
|
|
backgroundColor: colors.bgRaised
|
|
},
|
|
disabled: {
|
|
opacity: 0.35
|
|
}
|
|
})
|