Sha256: fec72fb9bb01124c7ca6a0e32d98abf374df8d2ed67d0f7d132bc2af258443a3

Contents?: true

Size: 1.94 KB

Versions: 149

Compression:

Stored size: 1.94 KB

Contents

import React from 'react'
import classnames from 'classnames'
import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
import { globalProps, GlobalProps } from '../utilities/globalProps'

import Flex  from "../pb_flex/_flex"
import Icon from '../pb_icon/_icon'
import Button from '../pb_button/_button'

type MapProps = {
  aria?: { [key: string]: string },
  children?: React.ReactChild[] | React.ReactNode,
  className?: string,
  data?: { [key: string]: string },
  id?: string,
  zoomBtns?: boolean,
  flyTo?: boolean, 
  zoomInClick?: () => {},
  zoomOutClick?: () => {},
  flyToClick?: () => {},
} & GlobalProps

const Map = (props: MapProps) => {
  const {
  aria = {},
  children,
  className,
  data = {},
  id,
  zoomBtns = false,
  flyTo = false,
  zoomInClick,
  zoomOutClick,
  flyToClick
  } = props

  const ariaProps = buildAriaProps(aria)
  const dataProps = buildDataProps(data)
  const classes = classnames(buildCss('pb_map'), globalProps(props), className)

  return (
    <div
        {...ariaProps}
        {...dataProps}
        className={classes}
        id={id}
    >
      {
        zoomBtns ? (
          <Flex className="custom-nav-control" orientation='column'>
            <div className="custom-nav-control-zoom">
              <Button className='map-zoom-in-button'
                  onClick={zoomInClick}
              >
                    <Icon icon="plus"/>
              </Button>
              <Button className='map-zoom-out-button'
                 onClick={zoomOutClick}
              >
                    <Icon icon="minus"/>
              </Button>
            </div>
            {
              flyTo ? (
                <Button className='map-flyto-button'
                  onClick={flyToClick}
                >
                      <Icon icon="eye"/>
                </Button>
              ) : null
            }
         </Flex>
         ) : null
      }
      {children}
    </div>
  )
}

export default Map

Version data entries

149 entries across 149 versions & 1 rubygems

Version Path
playbook_ui-12.26.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown815 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.26.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown813 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.26.0.pre.alpha.alphafix812 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.26.0.pre.alpha.alphafix810 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.26.0.pre.alpha.railsmultilevelimprovements805 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.26.0.pre.alpha.multiselectfixes798 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.26.0.pre.alpha.multiselectfixes797 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.26.0.pre.alpha.multiselectfixes796 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.26.0.pre.alpha.multiselectfixes795 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.26.0.pre.alpha.PLAY603datepickerquickpickinputpresetdropdown794 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.25.0.pre.alpha.play824786 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.26.0 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.25.0.pre.alpha.railsmultilevelimprovements785 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.25.0.pre.alpha.railsmultilevelimprovements780 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.25.0.pre.alpha.PLAY818multilevelrebuild779 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.25.0.pre.alpha.railsmultilevelimprovements776 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.25.0.pre.alpha.PLAY818multilevelrebuild774 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.25.0.pre.alpha.PLAY818multilevelrebuild773 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.25.0.pre.alpha.PLAY818multilevelrebuild770 app/pb_kits/playbook/pb_map/_map.tsx
playbook_ui-12.25.0.pre.alpha.play822bolddefaultfortitle3764 app/pb_kits/playbook/pb_map/_map.tsx