Skip to content

Commit

Permalink
🎨 Subtitle slug
Browse files Browse the repository at this point in the history
  • Loading branch information
rayriffy committed Oct 29, 2019
1 parent e20ec70 commit d63b704
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/templates/search/components/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import _ from 'lodash'
import React, { useEffect, useState } from 'react'
import React, { useContext, useEffect, useState } from 'react'

import { FaSearch } from 'react-icons/fa'

Expand All @@ -11,6 +11,8 @@ import Pagination from './pagination'

import { searchHentai } from '../services/searchHentai'

import { Subtitle } from '../../../app/context'

import { IFetchedRaw } from '../../../core/@types/IFetchedRaw'
import { IProps } from '../@types/IProps'

Expand All @@ -36,6 +38,8 @@ const StyledFlex = styled(Flex)`
const SearchComponent: React.FC<IProps> = props => {
const {raw, skip} = props.pageContext

const [, setSubtitle] = useContext(Subtitle)

const [query, setQuery] = useState<string>('')
const [res, setRes] = useState<IFetchedRaw[]>([])

Expand All @@ -62,6 +66,12 @@ const SearchComponent: React.FC<IProps> = props => {
}
}, [res])

useEffect(() => {
if (setSubtitle) {
setSubtitle(`search`)
}
}, [])

return (
<Box pt={3}>
<Flex justifyContent={`center`}>
Expand Down

0 comments on commit d63b704

Please sign in to comment.