The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
improve mobile blog filters
Francesco Sansalvadore9e51acfefe51
diff --git a/apps/www/components/Blog/BlogFilters.tsx b/apps/www/components/Blog/BlogFilters.tsxindex 1a86a76700b..3a91fdf9b52 100644--- a/apps/www/components/Blog/BlogFilters.tsx+++ b/apps/www/components/Blog/BlogFilters.tsx@@ -6,6 +6,7 @@ import { Button, IconSearch, Input } from 'ui'import { useParams } from '~/hooks/useParams'import PostTypes from '~/types/post'+import { useBreakpoint } from 'common'interface Props {posts: PostTypes[]@@ -19,6 +20,7 @@ const BlogFilters = ({ posts, setPosts, setCategory, allCategories, handlePostsconst activeCategory = useParams()?.categoryconst [searchKey, setSearchKey] = useState<string>('')const router = useRouter()+ const isMobile = useBreakpoint()useEffect(() => {if (!!searchKey) {@@ -38,7 +40,6 @@ const BlogFilters = ({ posts, setPosts, setCategory, allCategories, handlePostsif (!searchKey) returnconst matches = posts.filter((post: any) => {const found =- // post.categories?.join(' ').replaceAll('-', ' ').includes(searchKey.toLowerCase()) ||post.tags?.join(' ').replaceAll('-', ' ').includes(searchKey.toLowerCase()) ||post.title?.toLowerCase().includes(searchKey.toLowerCase()) ||post.author?.includes(searchKey.toLowerCase())@@ -53,38 +54,36 @@ const BlogFilters = ({ posts, setPosts, setCategory, allCategories, handlePosts}return (- <div className="flex flex-col lg:flex-row lg:items-center gap-2">+ <div className="flex flex-col xl:flex-row xl:items-center justify-between gap-2">+ <div className="flex flex-wrap items-center flex-grow gap-2">+ {allCategories.map((category: string) => (+ <Button+ key={category}+ type={+ category === 'all' && !searchKey && !activeCategory+ ? 'alternative'+ : category === activeCategory+ ? 'alternative'+ : 'default'+ }+ onClick={() => setCategory(category)}+ size={isMobile ? 'tiny' : 'small'}+ >+ {startCase(category.replaceAll('-', ' '))}+ </Button>+ ))}+ </div><Inputicon={<IconSearch size="tiny" />}size="small"layout="vertical"autoComplete="off"type="text"- placeholder="Search by keyword"+ placeholder="Search blog"value={searchKey}onChange={handleSearchChange}- className="w-full lg:w-[300px]"+ className="w-full lg:w-[260px]"/>- <div className="flex flex-wrap items-center gap-2">- {allCategories- .sort((a: string, b: string) => (a.toLowerCase() > b.toLowerCase() ? 1 : -1))- .map((category: string) => (- <Button- key={category}- type={- category === 'all' && !searchKey && !activeCategory- ? 'alternative'- : category === activeCategory- ? 'alternative'- : 'default'- }- onClick={() => setCategory(category)}- size="small"- >- {startCase(category.replaceAll('-', ' '))}- </Button>- ))}- </div></div>)}diff --git a/apps/www/pages/blog.tsx b/apps/www/pages/blog.tsxindex c218d6b0b54..806452ceaa8 100644--- a/apps/www/pages/blog.tsx+++ b/apps/www/pages/blog.tsx@@ -82,13 +82,6 @@ function Blog(props: any) {router.replace(router, undefined, { shallow: true, scroll: false })}- const filteredd = props.blogs.filter((post: any) => {- const found = post.categories?.includes(category)- return found- })-- console.log(filteredd)-setBlogs(category === 'all'? shiftedBlogs