blockmenu.js 791 B

12345678910111213141516171819202122232425
  1. import { NeoButton, NeoButtonLink } from 'app/design/controls'
  2. import { sanitazeUrl } from 'app/lib/util'
  3. /** Compact title-only control for block header switcher menus. */
  4. export default function MenuItemBlockmenu({ title, pressed, disabled, addon, onPress, href, borderShape = 'roundedRectangle' }) {
  5. const commonProps = {
  6. label: title,
  7. style: pressed ? 'bordered' : 'borderless',
  8. selected: pressed,
  9. selectedState: 'pressed',
  10. controlSize: 'small',
  11. borderShape,
  12. disabled,
  13. addon,
  14. haptics: 'Medium',
  15. onPress,
  16. }
  17. const finalHref = sanitazeUrl(href)
  18. if (finalHref) {
  19. return <NeoButtonLink {...commonProps} href={finalHref} />
  20. }
  21. return <NeoButton {...commonProps} interactive />
  22. }