Skip to content

Commit

Permalink
Update dependencies and fix import formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
yacosta738 committed Dec 22, 2023
1 parent 9e09a2d commit ad600ea
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 44 deletions.
8 changes: 0 additions & 8 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 2 additions & 4 deletions src/components/molecules/Menus.astro
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
import { type Menu, navMenus } from '@models:Menu';
import { Icon } from 'astro-icon/components';
import Search from 'molecules:Search';
import Search from 'molecules:Search';
import { DRAWER_MENU_ID } from '@store:constants';
import LanguageSelector from './LanguageSelector.astro';
import { getLangFromUrl, useTranslatedPath, useTranslations } from '@i18n:utils';
Expand Down Expand Up @@ -59,9 +59,7 @@ const isBlogRoot =
>
<Icon name="mdi:rss" class="h-5 w-5" />
</a>
{
isBlogRoot && (<Search />)
}
{isBlogRoot && <Search />}
</li>
<li>
<a
Expand Down
60 changes: 30 additions & 30 deletions src/components/molecules/Search.astro
Original file line number Diff line number Diff line change
Expand Up @@ -32,37 +32,37 @@ const docSearchStrings = getDocSearchStrings(Astro);
const { default: docsearch } = await import('@docsearch/js');
const translations = JSON.parse(this.dataset.translations || '{}');
docsearch({
container: 'sl-doc-search',
appId: 'QI0BGJ0O1W',
indexName: 'yunielacosta',
apiKey: 'ba9bb2c6979626993f7c5d05f30b44af',
searchParameters: { facetFilters: [[`lang:${location.pathname.split('/')[1]}`]] },
insights: true,
getMissingResultsUrl: ({ query }: { query: string }) =>
`https://github.com/yacosta738/yacosta738.github.io/issues/new?title=Missing+results+for+query+%22${encodeURIComponent(
query
)}%22`,
transformItems: (items) => {
return items.map((item) => {
// We transform the absolute URL into a relative URL to
// work better on localhost, preview URLS.
const url = new URL(item.url);
if (url.hash === '#overview') url.hash = '';
return {
...item,
url: url.href.replace(url.origin, ''),
};
});
},
placeholder: translations.placeholder,
translations: {
...translations,
button: {
buttonText: translations.button,
buttonAriaLabel: translations.button,
container: 'sl-doc-search',
appId: 'QI0BGJ0O1W',
indexName: 'yunielacosta',
apiKey: 'ba9bb2c6979626993f7c5d05f30b44af',
searchParameters: { facetFilters: [[`lang:${location.pathname.split('/')[1]}`]] },
insights: true,
getMissingResultsUrl: ({ query }: { query: string }) =>
`https://github.com/yacosta738/yacosta738.github.io/issues/new?title=Missing+results+for+query+%22${encodeURIComponent(
query
)}%22`,
transformItems: (items) => {
return items.map((item) => {
// We transform the absolute URL into a relative URL to
// work better on localhost, preview URLS.
const url = new URL(item.url);
if (url.hash === '#overview') url.hash = '';
return {
...item,
url: url.href.replace(url.origin, ''),
};
});
},
},
});
placeholder: translations.placeholder,
translations: {
...translations,
button: {
buttonText: translations.button,
buttonAriaLabel: translations.button,
},
},
});
});
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/i18n/search-translation.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import type docsearch from '@docsearch/js';


type ModalTranslations = NonNullable<Parameters<typeof docsearch>[0]['translations']>['modal'];

export interface DocSearchTranslation {
Expand All @@ -21,4 +20,3 @@ export interface DocSearchTranslation {

/** Helper to type check a dictionary of DocSearch string translations. */
export const DocSearchDictionary = (dict: DocSearchTranslation) => dict;

0 comments on commit ad600ea

Please sign in to comment.