How to use the actionsack.useOnline function in actionsack

To help you get started, we’ve selected a few actionsack examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github carbon-app / carbon / components / SnippetToolbar.js View on Github external
function SnippetToolbar(props) {
  const user = useAuth()
  const online = useOnline()

  if (!online) {
    return null
  }

  if (!user) {
    return null
  }

  if (!props.snippet) {
    return null
  }

  const sameUser = user.uid === props.snippet.userId

  return (
github carbon-app / carbon / components / TweetButton.js View on Github external
function TweetButton(props) {
  const api = useAPI()
  const online = useOnlineListener()
  const [onClick, { loading }] = useAsyncCallback(props.onClick)

  if (!api || !api.tweet) {
    return null
  }

  if (!online) {
    return null
  }

  return (
github carbon-app / carbon / components / ExportMenu.js View on Github external
function ExportMenu({
  backgroundImage,
  onChange,
  exportSize,
  isVisible,
  toggleVisibility,
  exportImage: exp
}) {
  const tooLarge = React.useMemo(() => !verifyPayloadSize(backgroundImage), [backgroundImage])
  const online = useOnline()
  const isSafari = useSafari()

  const [exportImage, { loading }] = useAsyncCallback(exp)
  useKeyboardListener('⌘-⇧-e', () => exportImage())

  const disablePNG = isSafari && (tooLarge || !online)

  const input = React.useRef()

  const handleExportSizeChange = selectedSize => () => onChange('exportSize', selectedSize)

  const handleExport = format => () =>
    exportImage(format, {
      filename: input.current.value
    })

actionsack

React UX components for handling common interactions

MIT
Latest version published 3 years ago

Package Health Score

42 / 100
Full package analysis