Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions scripts/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ async function prepareJSON() {

const collections = Object
.entries(raw)
.map(([id, v]) => ({ ...(v as any), id }))
.filter(v => v.hidden !== true)
.map(([id, v]) => ({
...(v as any),
id,
category: (v as any).hidden ? 'Deprecated / Unavailable' : (v as any).category,
}))

const collectionsMeta = []

Expand Down
10 changes: 8 additions & 2 deletions src/components/CollectionEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,18 @@ defineProps<{
:key="collection.id"
p3 relative
border="~ base"
:class="{ 'border-dashed': collection.hidden }"
class="grid grid-cols-[1fr_90px] gap2 items-center color-base transition-all translate-z-0 group"
hover="text-primary !border-primary shadow"
:to="`/collection/${collection.id}`"
>
<div ml2>
<div class="flex-auto text-lg leading-1em my1">
<div class="flex-auto text-lg leading-1em my1" :class="{ 'line-through group-hover:no-underline': collection.hidden }">
{{ collection.name }}
<span v-if="isFavoritedCollection(collection.id)" m="l--0.5" op80 text-xs inline-block align-top i-carbon-star-filled />
<span inline-flex align-top flex="items-center gap-0.5" m="l--0.5">
<div v-if="isFavoritedCollection(collection.id)" op80 text-xs i-carbon-star-filled />
<div v-if="collection.hidden" op80 text-xs text-orange i-carbon:information-disabled />
</span>
</div>
<div flex="~ col auto" opacity-50 text-xs>
<span>{{ collection.author?.name }}</span>
Expand All @@ -46,6 +50,7 @@ defineProps<{
<button
border="~ primary" p2 bg-base
:title="isFavoritedCollection(collection.id) ? 'Remove from favorites' : 'Add to favorites'"
:class="{ 'border-dashed': collection.hidden }"
@click.prevent="toggleFavoriteCollection(collection.id)"
>
<div v-if="isFavoritedCollection(collection.id)" i-carbon-star-filled />
Expand All @@ -55,6 +60,7 @@ defineProps<{
v-if="type === 'recent'"
border="~ primary" p2 bg-base ml--1px
:title="type === 'recent' ? 'Remove from recent' : type === 'favorite' || isFavoritedCollection(collection.id) ? 'Remove from favorites' : 'Add to favorites'"
:class="{ 'border-dashed': collection.hidden }"
@click.prevent="removeRecentCollection(collection.id)"
>
<div i-carbon-delete />
Expand Down
1 change: 1 addition & 0 deletions src/components/Drawer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ const collections = computed(() => {
>
<div class="text-base leading-tight">
{{ collection.name }}
<span v-if="collection.hidden" m="l--0.5" op80 text-xs text-orange inline-block align-top i-carbon:information-disabled />
</div>
<div class="text-xs block opacity-50 mt-1">
{{
Expand Down
40 changes: 22 additions & 18 deletions src/components/IconSet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -193,26 +193,30 @@ useEventListener(categoriesContainer, 'wheel', (e: WheelEvent) => {
<div class="flex-auto px-2">
<NavPlaceholder class="md:hidden" />

<div class="text-gray-900 text-xl flex select-none dark:text-gray-200">
<div class="whitespace-no-wrap overflow-hidden">
<div class="text-gray-900 text-xl flex items-center select-none dark:text-gray-200">
<div class="whitespace-no-wrap of-hidden">
{{ collection.name }}
</div>
<a
v-if="url"
class="ml-1 mt-1 text-base opacity-25 hover:opacity-100"
:href="url"
target="_blank"
>
<Icon icon="la:external-link-square-alt-solid" />
</a>
<a
v-if="npm"
class="ml-1 mt-1 text-base opacity-25 hover:opacity-100"
:href="npm"
target="_blank"
>
<Icon icon="la:npm" />
</a>
<!-- Information icons -->
<div ml-1 flex="~ items-center gap-1">
<div v-if="collection.hidden" i-carbon:information-disabled text="orange sm" title="The icon set was deprecated and is no longer available" />
<a
v-if="url"
class="flex items-center text-base opacity-25 hover:opacity-100"
:href="url"
target="_blank"
>
<Icon icon="la:external-link-square-alt-solid" />
</a>
<a
v-if="npm"
class="flex items-center text-base opacity-25 hover:opacity-100"
:href="npm"
target="_blank"
>
<Icon icon="la:npm" />
</a>
</div>
<div class="flex-auto" />
</div>
<div class="text-xs block opacity-50">
Expand Down
5 changes: 5 additions & 0 deletions src/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ export interface CollectionInfo {
palette?: string
total?: number
prepacked?: IconifyJSON
/**
* The icon set was deprecated and is no longer available
*/
hidden?: boolean
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

export interface CollectionMeta extends CollectionInfo {
Expand All @@ -43,6 +47,7 @@ const installed = ref<string[]>([])

export const collections = infoJSON.map(c => Object.freeze(c as any as CollectionInfo))
export const enabledCollections = computed(() => collections.filter(c => !isExcludedCollection(c)))

export const categories = Array.from(new Set(collections.map(i => i.category).filter(notNullish)))

export const isSearchOpen = ref(false)
Expand Down
15 changes: 9 additions & 6 deletions src/pages/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { categories, categorySearch, favoritedCollections, filteredCollections,
const searchbar = ref<{ input: HTMLElement }>()

const categorized = ref(getIconList(categorySearch.value))
const availableCategories = computed(() => categorized.value.filter(c => c.collections.length > 0))

let categorizeDebounceTimer: NodeJS.Timeout | null = null

Expand Down Expand Up @@ -55,7 +56,8 @@ onKeyStroke('/', (e) => {
})
onMounted(() => searchbar.value?.input.focus())

const isMacOS = navigator.platform.toUpperCase().includes('MAC')
const platform = (navigator as any).userAgentData?.platform || navigator.platform || ''
const isMacOS = platform.toUpperCase().includes('MAC')

function onKeydown(e: KeyboardEvent) {
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
Expand Down Expand Up @@ -93,11 +95,11 @@ function onKeydown(e: KeyboardEvent) {
</RouterLink>
</div>

<div of-y-auto>
<div of-y-auto relative space-y-6>
<!-- Category listing -->
<template v-for="c of categorized" :key="c.name">
<div v-if="(c.collections).length" px4>
<div px-2 op50 mt6 text-lg>
<template v-for="c of availableCategories" :key="c.name">
<div px4>
<div px-2 text-op-50 text-lg sticky top-0 bg-base z-1>
{{ c.name }}
</div>
<CollectionEntries
Expand All @@ -109,12 +111,13 @@ function onKeydown(e: KeyboardEvent) {
</template>

<div
v-if="categorized.every(c => !c.collections.length)"
v-if="availableCategories.length === 0"
class="flex flex-col flex-grow w-full py-6 justify-center items-center"
>
<Icon icon="ph:x-circle-bold" class="text-4xl mb-2 opacity-20" />
<span class="text-lg opacity-60">There is no result corresponding to your search query.</span>
</div>

<Footer />
</div>
</div>
Expand Down
1 change: 1 addition & 0 deletions src/store/localstorage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const selectedPackageManager = useStorage<string>('icones-package-manager
export const excludedCollectionIds = useStorage<string[]>('icones-excluded-collections', [])
export const excludedCategories = useStorage<string[]>('icones-excluded-categories', [
'Archive / Unmaintained',
'Deprecated / Unavailable',
])

export function getTransformedId(icon: string) {
Expand Down
2 changes: 1 addition & 1 deletion unocss.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { defineConfig, presetAttributify, presetIcons, presetWind3, transformerD

export default defineConfig({
shortcuts: {
'border-base': 'border-hex-888/15',
'border-base': 'border-hex-888/25',
'border-dark-only': 'border-transparent dark:border-dark-100',
'bg-base': 'bg-white dark:bg-[#181818]',
'color-base': 'text-gray-900 dark:text-gray-300',
Expand Down