Add icons to search query

This commit is contained in:
2024-09-03 20:14:31 +02:00
parent 2c100ecc13
commit 9f3e18ae0d
3 changed files with 13 additions and 3 deletions

View File

@@ -1,3 +1,5 @@
import { IconsCollection } from './types/types'
export default defineNuxtConfig({
future: { compatibilityVersion: 4 },
@@ -43,7 +45,7 @@ export default defineNuxtConfig({
// Nuxt Icon
icon: {
serverBundle: ['ph', 'heroicons', 'vscode-icons', 'simple-icons'],
serverBundle: IconsCollection,
},
// Nuxt Color Mode

View File

@@ -1,11 +1,12 @@
import { IconsCollection } from '~~/types/types'
export default defineEventHandler(async (event) => {
const collections = ['ph', 'heroicons']
const { query } = getQuery(event)
const response = await $fetch('https://api.iconify.design/search', {
params: {
query,
prefixes: collections.join(','),
prefixes: IconsCollection.join(','),
},
})

View File

@@ -4,6 +4,13 @@ export const COLORS = ['gray', 'slate', 'zinc', 'neutral', 'stone', 'red', 'oran
export const Subscription = ['free', 'paid'] as const
export const IconsCollection = [
'ph',
'heroicons',
'vscode-icons',
'simple-icons',
] as const
// Category
export const CreateCategorySchema = z.object({
name: z.string().min(4).max(20),