How to use the @s-ui/js/lib/react.getTarget function in @s-ui/js

To help you get started, we’ve selected a few @s-ui/js 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 SUI-Components / sui-components / components / atom / backToTop / src / index.js View on Github external
const scrollStep = () => {
    const container = getTarget(refContainer)
    const {scrollTop} = container
    const {current: intervalId} = intervalRef

    if (scrollTop === 0) clearInterval(intervalId)
    if (scrollTop) container.scrollTop = scrollTop - scrollSteps
  }
github SUI-Components / sui-components / components / atom / backToTop / src / index.js View on Github external
useEffect(() => {
    const container = getTarget(refContainer)
    const {scrollHeight, clientHeight} = container
    const halfHeight = Math.floor((scrollHeight - clientHeight) / 2)

    const handleScroll = () => {
      const {scrollTop} = container
      if (scrollTop > halfHeight) {
        if (!show) {
          setShow(true)
        }
      } else {
        if (show) {
          setShow(false)
          setHover(false)
        }
      }
    }

@s-ui/js

Set of JS utilities

MIT
Latest version published 2 days ago

Package Health Score

84 / 100
Full package analysis

Similar packages