How to use the docz.useDocs function in docz

To help you get started, we’ve selected a few docz 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 doczjs / docz / core / docz-theme-default / src / components / shared / Sidebar / MenuHeadings.tsx View on Github external
export const MenuHeadings: SFC = ({ route, onClick }) => {
  const docs = useDocs()
  const { linkComponent: Link } = useConfig()
  const headings = docs && getHeadings(route, docs)

  return headings && headings.length > 0 ? (
    
      {({ location }) => (
        
          {headings.map((heading: any) => (
github doczjs / docz / core / gatsby-theme-docz / src / components / NavLink / index.js View on Github external
export const NavLink = React.forwardRef(({ item, ...props }, ref) => {
  const docs = useDocs()
  const to = item.route
  const headings = docs && getHeadings(to, docs)
  const current = useCurrentDoc()
  const isCurrent = item.route === current.route
  const showHeadings = isCurrent && headings && headings.length > 0
  const currentHash = getCurrentHash()
  return (
    
      
      {showHeadings &&
github doczjs / docz-website / src / theme / components / shared / Sidebar / index.tsx View on Github external
export const Sidebar: SFC = ({
  menu: current,
  pathname,
  mobile,
}) => {
  const docs = useDocs()
  const { width } = useWindowSize()
  const { showing, setShowing } = useContext(mainContext)

  const menus = useMenus()
  const isDesktop = width > breakpoints.tablet

  const toggle = useCallback(() => {
    setShowing((s: any) => !s)
  }, [])

  const handleSidebarToggle = (ev: React.SyntheticEvent) => {
    if (isDesktop) return
    toggle && toggle()
  }

  useEffect(() => {
github grafana / tanka / docs / docs / tutorial / TutorialButtons.js View on Github external
export default ({ prev, next }) => {
  const names = useDocs().reduce(
    (map, val) => ({ ...map, [val.route]: val.name }),
    {}
  )

  return (
    <>
      <hr>
      <div></div>
github doczjs / docz / core / docz-theme-default / src / components / ui / Link.tsx View on Github external
export const Link: SFC = ({ href, ...props }) =&gt; {
  const { separator, linkComponent: Link } = useConfig()
  const docs = useDocs()
  const toCheck = useMemo(() =&gt; getSeparator(separator, href), [
    separator,
    href,
  ])

  const matched = docs &amp;&amp; docs.find(doc =&gt; doc.filepath === toCheck)
  const nHref = matched ? matched.route : href
  const isInternal = nHref &amp;&amp; nHref.startsWith('/')

  return isInternal ? (
    
  ) : (
    
  )
}

docz

It's has never been so easy to documents your things!

MIT
Latest version published 2 years ago

Package Health Score

59 / 100
Full package analysis