Files
orca/mobile/src/browser/MobileBrowserKeyRow.tsx
Kelvin Amoaba a079f51991 feat(mobile): unify corner radii across the app (#36437)
* feat(mobile): give every corner one of three shapes

Corners had drifted to 17 different radii, so a screen mixed 6 pt
buttons, 14 pt cards, 12 pt groups and 4 pt badges. Every corner now
comes from the shape of what it is:

- control (12): anything you tap — buttons, icon buttons, fields,
  pickers, segmented controls, key caps.
- surface (16): anything that holds content — cards, groups, sheets,
  banners, code boxes. Dialogs and the composer box use floating (24).
- pill: badges, chips, status pills, dots, avatars and the composer's
  own round buttons.
- tile (10) for icon squares and mark (4) for inline code and check
  squares; nested shapes take the parent's radius minus the gap.

Every rounded style also asks for the continuous (squircle) corner
curve; iOS draws it, Android and the web ignore it.

* fix(mobile): keep circles and pills on the circular corner curve

The continuous curve squares off a corner radius that reaches half the element's size, so the FAB, dots, avatars and the composer's round buttons stopped being round on iOS.

* fix(mobile): put the anchored detail card on the surface radius

* fix(mobile): keep the circular curve on unclipped bordered styles

React Native strokes an unclipped visible border on a circular path while it fills the background with the continuous curve, so the two edges drifted apart at the corners.
2026-10-30 21:27:30 +00:00

68 lines
1.7 KiB
TypeScript

import { Pressable, Text, View } from 'react-native'
import { colors, radii, spacing, typography } from '../theme/mobile-theme'
import { themedStyleSheet } from '../theme/themed-styles'
import { useMobileColorScheme } from '../theme/use-mobile-color-scheme'
const BROWSER_KEYS = ['Enter', 'Backspace', 'Tab', 'Escape'] as const
type Props = {
disabled: boolean
onKeypress: (key: string) => void
}
export function MobileBrowserKeyRow({ disabled, onKeypress }: Props): React.JSX.Element {
useMobileColorScheme()
return (
<View style={styles.keyRow}>
{BROWSER_KEYS.map((key) => (
<Pressable
key={key}
style={({ pressed }) => [
styles.keyButton,
pressed && styles.keyButtonPressed,
disabled && styles.disabled
]}
disabled={disabled}
onPress={() => onKeypress(key)}
>
<Text style={[styles.keyButtonText, disabled && styles.disabledText]}>
{key === 'Backspace' ? '⌫' : key === 'Escape' ? 'Esc' : key}
</Text>
</Pressable>
))}
</View>
)
}
const styles = themedStyleSheet(() => ({
keyRow: {
flexDirection: 'row',
gap: spacing.xs,
paddingHorizontal: spacing.sm,
paddingTop: spacing.xs
},
keyButton: {
minHeight: 30,
minWidth: 42,
alignItems: 'center',
justifyContent: 'center',
borderRadius: radii.control,
backgroundColor: colors.bgRaised,
paddingHorizontal: spacing.sm
},
keyButtonPressed: {
backgroundColor: colors.borderSubtle
},
keyButtonText: {
color: colors.textSecondary,
fontSize: 12,
fontFamily: typography.monoFamily
},
disabled: {
opacity: 0.35
},
disabledText: {
color: colors.textMuted
}
}))