Skip to content

Commit 1ec9ddd

Browse files
committed
feat: display hidden iconset
1 parent a5e45a4 commit 1ec9ddd

File tree

8 files changed

+52
-29
lines changed

8 files changed

+52
-29
lines changed

scripts/prepare.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ async function prepareJSON() {
2727

2828
const collections = Object
2929
.entries(raw)
30-
.map(([id, v]) => ({ ...(v as any), id }))
31-
.filter(v => v.hidden !== true)
30+
.map(([id, v]) => ({
31+
...(v as any),
32+
id,
33+
category: (v as any).hidden ? 'Deprecated / Unavailable' : (v as any).category,
34+
}))
3235

3336
const collectionsMeta = []
3437

src/components/CollectionEntry.vue

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,18 @@ defineProps<{
1313
:key="collection.id"
1414
p3 relative
1515
border="~ base"
16+
:class="collection.hidden ? 'opacity-64 border-dashed hover:opacity-100' : ''"
1617
class="grid grid-cols-[1fr_90px] gap2 items-center color-base transition-all translate-z-0 group"
1718
hover="text-primary !border-primary shadow"
1819
:to="`/collection/${collection.id}`"
1920
>
2021
<div ml2>
21-
<div class="flex-auto text-lg leading-1em my1">
22+
<div class="flex-auto text-lg leading-1em my1" :class="{ 'line-through group-hover:no-underline': collection.hidden }">
2223
{{ collection.name }}
23-
<span v-if="isFavoritedCollection(collection.id)" m="l--0.5" op80 text-xs inline-block align-top i-carbon-star-filled />
24+
<span inline-flex align-top flex="items-center gap-0.5" m="l--0.5">
25+
<span v-if="isFavoritedCollection(collection.id)" op80 text-xs inline-block i-carbon-star-filled />
26+
<span v-if="collection.hidden" op80 text-xs text-orange inline-block i-carbon:information-disabled />
27+
</span>
2428
</div>
2529
<div flex="~ col auto" opacity-50 text-xs>
2630
<span>{{ collection.author?.name }}</span>
@@ -46,6 +50,7 @@ defineProps<{
4650
<button
4751
border="~ primary" p2 bg-base
4852
:title="isFavoritedCollection(collection.id) ? 'Remove from favorites' : 'Add to favorites'"
53+
:class="{ 'border-dashed': collection.hidden }"
4954
@click.prevent="toggleFavoriteCollection(collection.id)"
5055
>
5156
<div v-if="isFavoritedCollection(collection.id)" i-carbon-star-filled />
@@ -55,6 +60,7 @@ defineProps<{
5560
v-if="type === 'recent'"
5661
border="~ primary" p2 bg-base ml--1px
5762
:title="type === 'recent' ? 'Remove from recent' : type === 'favorite' || isFavoritedCollection(collection.id) ? 'Remove from favorites' : 'Add to favorites'"
63+
:class="{ 'border-dashed': collection.hidden }"
5864
@click.prevent="removeRecentCollection(collection.id)"
5965
>
6066
<div i-carbon-delete />

src/components/Drawer.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ const collections = computed(() => {
6767
>
6868
<div class="text-base leading-tight">
6969
{{ collection.name }}
70+
<span v-if="collection.hidden" m="l--0.5" op80 text-xs text-orange inline-block align-top i-carbon:information-disabled />
7071
</div>
7172
<div class="text-xs block opacity-50 mt-1">
7273
{{

src/components/IconSet.vue

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -193,26 +193,30 @@ useEventListener(categoriesContainer, 'wheel', (e: WheelEvent) => {
193193
<div class="flex-auto px-2">
194194
<NavPlaceholder class="md:hidden" />
195195

196-
<div class="text-gray-900 text-xl flex select-none dark:text-gray-200">
197-
<div class="whitespace-no-wrap overflow-hidden">
196+
<div class="text-gray-900 text-xl flex items-center select-none dark:text-gray-200">
197+
<div class="whitespace-no-wrap of-hidden">
198198
{{ collection.name }}
199199
</div>
200-
<a
201-
v-if="url"
202-
class="ml-1 mt-1 text-base opacity-25 hover:opacity-100"
203-
:href="url"
204-
target="_blank"
205-
>
206-
<Icon icon="la:external-link-square-alt-solid" />
207-
</a>
208-
<a
209-
v-if="npm"
210-
class="ml-1 mt-1 text-base opacity-25 hover:opacity-100"
211-
:href="npm"
212-
target="_blank"
213-
>
214-
<Icon icon="la:npm" />
215-
</a>
200+
<!-- Information icons -->
201+
<div ml-1 flex="~ items-center gap-1">
202+
<div v-if="collection.hidden" i-carbon:information-disabled text="orange sm" title="The icon set was deprecated and is no longer available" />
203+
<a
204+
v-if="url"
205+
class="flex items-center text-base opacity-25 hover:opacity-100"
206+
:href="url"
207+
target="_blank"
208+
>
209+
<Icon icon="la:external-link-square-alt-solid" />
210+
</a>
211+
<a
212+
v-if="npm"
213+
class="flex items-center text-base opacity-25 hover:opacity-100"
214+
:href="npm"
215+
target="_blank"
216+
>
217+
<Icon icon="la:npm" />
218+
</a>
219+
</div>
216220
<div class="flex-auto" />
217221
</div>
218222
<div class="text-xs block opacity-50">

src/data/index.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ export interface CollectionInfo {
3030
palette?: string
3131
total?: number
3232
prepacked?: IconifyJSON
33+
/**
34+
* The icon set was deprecated and is no longer available
35+
*/
36+
hidden?: boolean
3337
}
3438

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

4448
export const collections = infoJSON.map(c => Object.freeze(c as any as CollectionInfo))
4549
export const enabledCollections = computed(() => collections.filter(c => !isExcludedCollection(c)))
50+
4651
export const categories = Array.from(new Set(collections.map(i => i.category).filter(notNullish)))
4752

4853
export const isSearchOpen = ref(false)

src/pages/index.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { categories, categorySearch, favoritedCollections, filteredCollections,
55
const searchbar = ref<{ input: HTMLElement }>()
66
77
const categorized = ref(getIconList(categorySearch.value))
8+
const availableCategories = computed(() => categorized.value.filter(c => c.collections.length > 0))
89
910
let categorizeDebounceTimer: NodeJS.Timeout | null = null
1011
@@ -55,7 +56,8 @@ onKeyStroke('/', (e) => {
5556
})
5657
onMounted(() => searchbar.value?.input.focus())
5758
58-
const isMacOS = navigator.platform.toUpperCase().includes('MAC')
59+
const platform = (navigator as any).userAgentData?.platform || navigator.platform || ''
60+
const isMacOS = platform.toUpperCase().includes('MAC')
5961
6062
function onKeydown(e: KeyboardEvent) {
6163
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
@@ -93,11 +95,11 @@ function onKeydown(e: KeyboardEvent) {
9395
</RouterLink>
9496
</div>
9597

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

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

src/store/localstorage.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const selectedPackageManager = useStorage<string>('icones-package-manager
2424
export const excludedCollectionIds = useStorage<string[]>('icones-excluded-collections', [])
2525
export const excludedCategories = useStorage<string[]>('icones-excluded-categories', [
2626
'Archive / Unmaintained',
27+
'Deprecated / Unavailable',
2728
])
2829

2930
export function getTransformedId(icon: string) {

unocss.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { defineConfig, presetAttributify, presetIcons, presetWind3, transformerD
22

33
export default defineConfig({
44
shortcuts: {
5-
'border-base': 'border-hex-888/15',
5+
'border-base': 'border-hex-888/25',
66
'border-dark-only': 'border-transparent dark:border-dark-100',
77
'bg-base': 'bg-white dark:bg-[#181818]',
88
'color-base': 'text-gray-900 dark:text-gray-300',

0 commit comments

Comments
 (0)