diff --git a/src/components/Offers/Offers.js b/src/components/Offers/Offers.js index bef189c..41f3a4f 100644 --- a/src/components/Offers/Offers.js +++ b/src/components/Offers/Offers.js @@ -1,12 +1,16 @@ import React from 'react'; +import useTagsQuery from '../../hooks/useTagsQuery' import './Offers.scss' import Tags from './Tags/Tags' +import TagItem from './Tags/TagItem' import PopularIcon from '../../images/popular-icon.svg' import ViewsIcon from '../../images/views-icon.svg' import BooksIcon from '../../images/books-icon.svg' const Offers = () => { + const { tags } = useTagsQuery() + return (
@@ -25,7 +29,9 @@ const Offers = () => {
)}
- + + {tags.map(({ node }, i) => )} +
diff --git a/src/components/Offers/Tags/TagItem.js b/src/components/Offers/Tags/TagItem.js new file mode 100644 index 0000000..598aa42 --- /dev/null +++ b/src/components/Offers/Tags/TagItem.js @@ -0,0 +1,13 @@ +import React from 'react'; +import { Link } from 'gatsby' +import sligify from '../../../helpers/slugify' + +const TagItem = ({ title }) => { + return ( +
+ {title} +
+ ) +} + +export default TagItem \ No newline at end of file diff --git a/src/components/Offers/Tags/Tags.js b/src/components/Offers/Tags/Tags.js index 7d34e60..baf6f72 100644 --- a/src/components/Offers/Tags/Tags.js +++ b/src/components/Offers/Tags/Tags.js @@ -1,20 +1,8 @@ import React from 'react' -import { Link } from 'gatsby' -import sligify from '../../../helpers/slugify' -import useTagsQuery from '../../../hooks/useTagsQuery' import TagIcon from '../../../images/tag-icon.svg' -const TagItem = ({ title }) => { - return ( -
- {title} -
- ) -} - -const Tags = () => { - const { edges } = useTagsQuery() +const Tags = ({ children }) => { return (
@@ -23,7 +11,7 @@ const Tags = () => { Тэги
- {edges.map(({ node }, i) => )} + {children}
) diff --git a/src/hooks/useTagsQuery.js b/src/hooks/useTagsQuery.js index d3049e4..6f92170 100644 --- a/src/hooks/useTagsQuery.js +++ b/src/hooks/useTagsQuery.js @@ -14,7 +14,7 @@ const useTagsQuery = () => { } } `) - return { edges } + return { tags: edges } } export default useTagsQuery \ No newline at end of file