diff --git a/mdsvex.config.js b/mdsvex.config.js new file mode 100644 index 0000000..5576a98 --- /dev/null +++ b/mdsvex.config.js @@ -0,0 +1,3 @@ +export default { + extensions: ['.md'] +}; diff --git a/src/lib/components/HoverIcon.svelte b/src/lib/components/HoverIcon.svelte index 58d0bc0..7fbff3c 100644 --- a/src/lib/components/HoverIcon.svelte +++ b/src/lib/components/HoverIcon.svelte @@ -4,35 +4,29 @@ let className: string = ''; export { className as class }; export let src: string | null = null; - export let alt: string | undefined = undefined; + export let text: string; export let size: number = 32; export let black: boolean = false; - function isUrl(src?: string) { - return src?.startsWith('/') || src?.startsWith('http'); - } + let isUrl; + $: isUrl = src?.startsWith('/') || src?.startsWith('http'); - +
{#if src} - {#if isUrl(src)} - + {#if isUrl} + {text} {:else} {/if} {:else} - {alt ?? 'Без иконки'} + {text} {/if} - +
diff --git a/src/lib/components/MdsvexLayout.svelte b/src/lib/components/MdsvexLayout.svelte deleted file mode 100644 index 061e2b2..0000000 --- a/src/lib/components/MdsvexLayout.svelte +++ /dev/null @@ -1,11 +0,0 @@ - - - - -{@render children()} diff --git a/src/lib/components/NavBar.svelte b/src/lib/components/NavBar.svelte index 84e5596..3316ee0 100644 --- a/src/lib/components/NavBar.svelte +++ b/src/lib/components/NavBar.svelte @@ -20,7 +20,7 @@ diff --git a/src/lib/components/SocialButton.svelte b/src/lib/components/SocialButton.svelte index b18df8b..f12be28 100644 --- a/src/lib/components/SocialButton.svelte +++ b/src/lib/components/SocialButton.svelte @@ -14,7 +14,7 @@ target={isLinkLocal(href) ? '_self' : '_blank'} >
- +
= 40rem', false); - + - + diff --git a/src/lib/components/WarningBlock.svelte b/src/lib/components/WarningBlock.svelte index 50c9cf5..e76765c 100644 --- a/src/lib/components/WarningBlock.svelte +++ b/src/lib/components/WarningBlock.svelte @@ -3,8 +3,8 @@ diff --git a/src/lib/util/LinkResolver.ts b/src/lib/util/LinkResolver.ts index b942ba1..23e1814 100644 --- a/src/lib/util/LinkResolver.ts +++ b/src/lib/util/LinkResolver.ts @@ -1,4 +1,3 @@ -// TODO: чашки на иконках выглядят страшненько, пока что пусть лучше будет голая ссылка const icons: Record = { none: 'material-symbols:link', 'steamcommunity.com': 'simple-icons:steam', @@ -13,10 +12,10 @@ const icons: Record = { 'bsky.social': 'simple-icons:bluesky', // https://хамяк.рф 'xn--80auf8a2c.xn--p1ai': 'fluent-emoji-high-contrast:hamster', - // 'teasanctuary.ru': '/icons/tea-sanctuary-white.svg', + 'teasanctuary.ru': '/icons/tea-sanctuary-white.svg', 'hl.teasanctuary.ru': '/icons/half-life.svg', 'git.teasanctuary.ru': 'devicon-plain:git', - // localhost: '/icons/tea-sanctuary-white.svg', + localhost: '/icons/tea-sanctuary-white.svg', email: 'material-symbols:alternate-email', rss: 'material-symbols:rss-feed' }; diff --git a/src/routes/blog/[slug]/+page.svelte b/src/routes/blog/[slug]/+page.svelte index 4679b12..b143f3e 100644 --- a/src/routes/blog/[slug]/+page.svelte +++ b/src/routes/blog/[slug]/+page.svelte @@ -72,17 +72,18 @@
diff --git a/svelte.config.js b/svelte.config.js index 8bcc2c3..ebf0dc8 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,13 +1,8 @@ import adapter from '@sveltejs/adapter-static'; import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'; import { mdsvex } from 'mdsvex'; +import mdsvexConfig from './mdsvex.config.js'; import autoImport from 'sveltekit-autoimport'; -import { join, dirname } from 'path'; -import { fileURLToPath } from 'url'; - -// https://flaviocopes.com/fix-dirname-not-defined-es-module-scope/ -const __filename = fileURLToPath(import.meta.url); -const __dirname = dirname(__filename); /** @type {import('@sveltejs/kit').Config} */ const config = { @@ -39,10 +34,7 @@ const config = { extensions: ['.svelte', '.md'], preprocess: [ vitePreprocess(), - mdsvex({ - extensions: ['.md'], - layout: join(__dirname, "./src/lib/components/MdsvexLayout.svelte") - }), + mdsvex(mdsvexConfig), autoImport({ include: ['**/*.(svelte|md)'], components: ['./src/lib/components/', { name: './src' }]