import { useStaticQuery, graphql } from "gatsby"

export const useCollection = () => {
  const { collection } = useStaticQuery(
    graphql`
      query Collection {
        collection: allIndexJson {
          totalCount
          edges {
            node {
              parent {
                ... on File {
                  relativeDirectory
                }
              }
              price
              titolo
              categoryIt
              categoryEn
            }
          }
        }
      }
    `
  )
  return collection
}
