diff --git a/docs/.vitepress/components/FakeInput.vue b/docs/.vitepress/components/FakeInput.vue index 187f876bf..078cdd21e 100644 --- a/docs/.vitepress/components/FakeInput.vue +++ b/docs/.vitepress/components/FakeInput.vue @@ -1,8 +1,14 @@ @@ -19,6 +25,8 @@ text-align: left; border: 1px solid transparent; cursor: text; + display: flex; + gap: 12px; } .fake-input:hover, .fake-input:focus { diff --git a/docs/.vitepress/components/HomeHeroIconsCard.vue b/docs/.vitepress/components/HomeHeroIconsCard.vue index 40b9c2b5a..88592de4e 100644 --- a/docs/.vitepress/components/HomeHeroIconsCard.vue +++ b/docs/.vitepress/components/HomeHeroIconsCard.vue @@ -63,9 +63,9 @@ onBeforeUnmount(() => { - - Search 964 icons... - + + Search 964 icons... + @@ -76,6 +76,7 @@ onBeforeUnmount(() => { /* padding: 0 24px; */ margin-left: auto; margin-bottom: auto; + margin-top: 48px;; } .icons-card { background: var(--vp-c-bg-alt); @@ -128,9 +129,20 @@ onBeforeUnmount(() => { .search-box { position: absolute; - bottom:-24px; width: 100%; - left: -24px; + left: 0; + top: -48px; +} + +@media (min-width: 960px) { + .search-box { + top: unset; + bottom: -24px; + left: -24px; + } + .card-wrapper { + margin-top: 0; + } } /* .search-box :deep(.input) { diff --git a/docs/.vitepress/components/IconsCategoryOverview.vue b/docs/.vitepress/components/IconsCategoryOverview.vue index 187bddeea..971bdbe10 100644 --- a/docs/.vitepress/components/IconsCategoryOverview.vue +++ b/docs/.vitepress/components/IconsCategoryOverview.vue @@ -7,24 +7,16 @@ import useSearch from '../composables/useSearch' import Input from './Input.vue' import EndOfPage from './EndOfPage.vue' import { useCategoryView } from '../composables/useCategoryView' +import useSearchInput from '../composables/useSearchInput' const props = defineProps<{ icons: IconEntity[] categories: Category[] }>() -const { selectedCategory } = useCategoryView() const activeIconName = ref('') -const searchQuery = ref( - typeof window === 'undefined' - ? '' - : ( - new URLSearchParams(window.location.search).get('search') - || '' - ) -) +const { searchInput, searchQuery, searchQueryThrottled } = useSearchInput() -const searchInput = ref() const isSearching = computed(() => !!searchQuery.value) function setActiveIconName(name: string) { @@ -57,23 +49,6 @@ const categories = computed(() => { .filter(({ icons }) => icons.length) }) -watch(searchQuery, (searchString) => { - const newUrl = new URL(window.location.href); - - newUrl.searchParams.set('search', searchString); - - nextTick(() => { - window.history.replaceState({}, '', newUrl) - }) -}) - -onMounted(() => { - const searchParams = new URLSearchParams(window.location.search); - if(searchParams.has('search')) { - searchInput.value.focus() - } -}) - const activeIcon = computed(() => props.icons?.find((icon) => icon.name === activeIconName.value) ) diff --git a/docs/.vitepress/components/IconsOverview.vue b/docs/.vitepress/components/IconsOverview.vue index 4de8da1bf..e12a15cb3 100644 --- a/docs/.vitepress/components/IconsOverview.vue +++ b/docs/.vitepress/components/IconsOverview.vue @@ -1,34 +1,26 @@