Sha256: 62d173d24f2236067b18f17f27a84ee907d34814a43ed0d47d6df9d7c2d60d0e

Contents?: true

Size: 1.91 KB

Versions: 144

Compression:

Stored size: 1.91 KB

Contents

import React, { useState } from 'react'

import Flex from '../../pb_flex/_flex'
import PbReactPopover from '../../pb_popover/_popover'
import Icon from '../../pb_icon/_icon'
import Nav from '../../pb_nav/_nav'
import NavItem from '../../pb_nav/_item'

const MoreExtensionsDropdown = ({extensions}: any) => {
  const [showPopover, setShowPopover] = useState(false)

  const handleTogglePopover = () => {
    setShowPopover(true)
  }

  const handlePopoverClose = (shouldClosePopover: boolean) => {
    setShowPopover(!shouldClosePopover)
  }


const popoverReference = (
    <button
        className="toolbar_button"
        onClick={handleTogglePopover}
        role="button"
        type="button"
    >
    <Flex 
        align="center"
        className="toolbar_button_icon"
        justify="center"
    >
      <Icon icon="ellipsis"
          size="lg"
      />
    </Flex>
  </button>

);

  return (
      <PbReactPopover
          closeOnClick='outside'
          padding='none'
          placement="bottom"
          reference={popoverReference}
          shouldClosePopover={handlePopoverClose}
          show={showPopover}
      >
        <Nav 
            paddingBottom={extensions.length > 1 ? "xs" : "none"}
            paddingTop={extensions.length > 1 ? "xs" : "none"} 
            variant="subtle"
        >
          {extensions && extensions.map(({ icon, text, onclick, isActive}: any, index: number) => ( 
            <NavItem
                className={`pb_tiptap_toolbar_dropdown_list_item ${isActive ? "is-active" : ""}`}
                cursor="pointer"
                iconLeft={icon}
                key={`${text}_${index}`}
                margin='none'
                onClick={()=> {onclick(); setShowPopover(false)}}
                paddingBottom='xxs'
                paddingTop='xxs'
                text={text}
            />
          ))}
        </Nav>
      </PbReactPopover>
  )
}

export default MoreExtensionsDropdown

Version data entries

144 entries across 144 versions & 1 rubygems

Version Path
playbook_ui-13.32.0.pre.alpha.PLAY14143288 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.32.0.pre.alpha.PLAY14143272 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.32.0.pre.alpha.PLAY14143271 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.32.0.pre.alpha.PLAY1138iconkitaddcolorprop3268 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.32.0.pre.alpha.PLAY14143267 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.32.0.pre.alpha.play1416movealiaslogic3266 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.32.0.pre.alpha.PLAY14143264 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.32.0.pre.alpha.PLAY14143260 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.32.0.pre.alpha.PLAY14143255 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.32.0.pre.alpha.PLAY14143251 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.32.0.pre.alpha.play1416movealiaslogic3239 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.32.0.pre.alpha.PLAY14103236 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.31.0.pre.alpha.play1416movealiaslogic3232 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.31.0.pre.alpha.PBNTR342navtabbing3231 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.31.0.pre.alpha.PBNTR342navtabbing3230 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.32.0 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.31.0.pre.alpha.powercentrainplaybookpt23212 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.31.0.pre.alpha.PLAY10863204 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.31.0.pre.alpha.PLAY10863202 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx
playbook_ui-13.31.0.pre.alpha.PLAY882formpillprimaryandneutral3201 app/pb_kits/playbook/pb_rich_text_editor/TipTap/MoreExtensionsDropdown.tsx