feat: add homepage
This commit is contained in:
parent
9bb941b45e
commit
1c63e79db1
1 changed files with 14 additions and 1 deletions
|
|
@ -59,6 +59,19 @@ const loadData = async () => {
|
|||
}
|
||||
}
|
||||
|
||||
const getCategoryIcon = (categoryName: string) => {
|
||||
if (!categoryName) return 'o_category'
|
||||
const text = categoryName.toLowerCase()
|
||||
|
||||
if (text.includes('ออกแบบ') || text.includes('design')) return 'o_palette'
|
||||
if (text.includes('โปรแกรม') || text.includes('code') || text.includes('dev')) return 'o_terminal'
|
||||
if (text.includes('ธุรกิจ') || text.includes('business') || text.includes('การตลาด') || text.includes('market')) return 'o_storefront'
|
||||
if (text.includes('ภาษา') || text.includes('language')) return 'o_language'
|
||||
if (text.includes('ข้อมูล') || text.includes('data')) return 'o_analytics'
|
||||
|
||||
return 'o_interests'
|
||||
}
|
||||
|
||||
const goBrowse = (slug: string) => {
|
||||
navigateTo({ path: '/browse', query: { category: slug } })
|
||||
}
|
||||
|
|
@ -274,7 +287,7 @@ onMounted(() => {
|
|||
:class="selectedCategory === category.slug ? 'bg-blue-600 text-white border-blue-600 font-semibold' : 'bg-white border-slate-200 text-slate-700 hover:border-slate-300'"
|
||||
@click="selectedCategory = category.slug"
|
||||
>
|
||||
<q-icon :name="category.icon || 'o_label'" size="20px" class="mr-1" />
|
||||
<q-icon :name="getCategoryIcon(getLocalizedText(category.name))" size="20px" class="mr-1" />
|
||||
{{ getLocalizedText(category.name) }}
|
||||
</button>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue