Блоги #1

Merged
rndtrash merged 64 commits from feature-blogs into master 2025-10-22 08:44:56 +03:00
4 changed files with 22 additions and 16 deletions
Showing only changes of commit 9722448c36 - Show all commits

View file

@ -4,29 +4,35 @@
let className: string = '';
export { className as class };
export let src: string | null = null;
export let text: string;
export let alt: string | undefined = undefined;
export let size: number = 32;
export let black: boolean = false;
let isUrl;
$: isUrl = src?.startsWith('/') || src?.startsWith('http');
function isUrl(src?: string) {
return src?.startsWith('/') || src?.startsWith('http');
}
</script>
<div
class="{className} {black
? 'fill-slate-950'
: 'fill-slate-50'} text-sm uppercase transition-all"
>
<span class="{className} {black ? 'fill-slate-950' : 'fill-slate-50'} hover-icon">
{#if src}
{#if isUrl}
<img {src} alt={text} width={size} height={size} />
{#if isUrl(src)}
<img {src} {alt} width={size} height={size} />
{:else}
<Icon width={size} height={size} icon={src} color={black ? '#020618' : '#f8fafc'} />
{/if}
{:else}
{text}
{alt ?? 'Без иконки'}
{/if}
</div>
</span>
<style>
@import '$src/app.css';
.hover-icon {
@apply text-sm uppercase transition-all;
img {
margin: 0;
}
}
</style>

View file

@ -20,7 +20,7 @@
<HoverIcon
src={route.icon}
class="text-sm uppercase"
text={route.href}
alt={route.label}
size={32}
black={!isActive(route.href)}
/>

View file

@ -14,7 +14,7 @@
target={isLinkLocal(href) ? '_self' : '_blank'}
>
<div class="shrink-0 rounded-l-xl bg-slate-800 p-2">
<HoverIcon src={customIcon ?? tryGetIcon(href)} class="text-sm uppercase" text={href} />
<HoverIcon src={customIcon ?? tryGetIcon(href)} class="text-sm uppercase" />
</div>
<div
class="flex shrink-0 grow flex-nowrap items-center justify-center rounded-r-xl bg-slate-100 p-2 text-2xl text-nowrap text-slate-950"

View file

@ -11,11 +11,11 @@
const sm = new MediaQuery('width >= 40rem', false);
</script>
<a {href} class="{className} group inline-block" target={isLinkLocal(href) ? '_self' : '_blank'}>
<a {href} class="{className} group inline-block no-underline" target={isLinkLocal(href) ? '_self' : '_blank'}>
<span
class="inline-block size-6 rounded-sm bg-emerald-800 p-0.5 align-bottom transition-all group-hover:scale-110 sm:size-8 sm:rounded-xl sm:p-1"
>
<HoverIcon src={customIcon ?? tryGetIcon(href)} text={href} size={sm.current ? 24 : 20} />
<HoverIcon src={customIcon ?? tryGetIcon(href)} size={sm.current ? 24 : 20} />
</span>
<span class="text-emerald-900 underline">
<slot />