Files
orca/mobile/src/browser/MobileBrowserToolbarIconButton.tsx
Jinjing 8752996ef3 Allow switching to mobile website view in MobileBrowserPane (#5941)
* rm validation report

* Remove mobile browser view switch validation document
2026-06-20 19:41:19 -07:00

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
}
})