How to use the ahooks.useSize function in ahooks

To help you get started, we’ve selected a few ahooks 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 pingcap / tidb-dashboard / ui / lib / components / InstanceSelect / TableWithFilter.tsx View on Github external
},
    [onFilterChange]
  )

  const inputRef = useRef<input>(null)

  React.useImperativeHandle(ref, () =&gt; ({
    focusFilterInput() {
      inputRef.current?.focus()
    },
  }))

  // FIXME: We should put Input inside ScrollablePane after https://github.com/microsoft/fluentui/issues/13557 is resolved

  const containerRef = useRef(null)
  const containerSize = useSize(containerRef)

  const paneStyle = useMemo(
    () =&gt;
      ({
        position: 'relative',
        height: containerSize.height,
        maxHeight: tableMaxHeight ?? 400,
        width: tableWidth ?? 400,
      } as React.CSSProperties),
    [containerSize.height, tableMaxHeight, tableWidth]
  )

  const {
    className: containerClassName,
    style: containerStyle,
    ...containerRestProps
github pingcap / tidb-dashboard / ui / lib / apps / QueryEditor / Editor.tsx View on Github external
function Editor({ ...props }: IEditorProps, ref: React.Ref) {
  const containerRef = useRef(null)
  const containerSize = useSize(containerRef)
  return (
    <div>
      
    </div>