tailwind-nextjs-blog/components/SearchButton.tsx

35 lines
1014 B
TypeScript
Raw Normal View History

2023-08-16 23:55:57 +08:00
import { AlgoliaButton } from 'pliny/search/AlgoliaButton';
import { KBarButton } from 'pliny/search/KBarButton';
import siteMetadata from '@/data/siteMetadata';
const SearchButton = () => {
if (
siteMetadata.search &&
2023-08-16 23:55:57 +08:00
(siteMetadata.search.provider === 'algolia' ||
siteMetadata.search.provider === 'kbar')
) {
const SearchButtonWrapper =
2023-08-16 23:55:57 +08:00
siteMetadata.search.provider === 'algolia' ? AlgoliaButton : KBarButton;
return (
<SearchButtonWrapper aria-label="Search">
<svg
xmlns="http://www.w3.org/2000/svg"
fill="none"
viewBox="0 0 24 24"
strokeWidth={1.5}
stroke="currentColor"
2023-08-16 23:55:57 +08:00
className="text-gray-900 dark:text-gray-100 h-6 w-6">
<path
strokeLinecap="round"
strokeLinejoin="round"
d="M21 21l-5.197-5.197m0 0A7.5 7.5 0 105.196 5.196a7.5 7.5 0 0010.607 10.607z"
/>
</svg>
</SearchButtonWrapper>
2023-08-16 23:55:57 +08:00
);
}
2023-08-16 23:55:57 +08:00
};
2023-08-16 23:55:57 +08:00
export default SearchButton;