Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 | 1x 30x 1x 10x 10x 10x 10x 10x 10x 10x 10x 10x 2x 1x | import React from "react";
import ReactGA from "react-ga4";
import lozad from "lozad";
import Information from "./Information";
import type { Post as LatestPostProps } from "./LatestPost";
import type { AllPost } from "./entity";
import SearchBox from "@/components/SearchBox";
import Subscription from "./Subscription";
import TagCloud from "./TagCloud";
import * as style from "./index.module.scss";
import { isBrowser } from "@/utils";
import { GitHubIcon, XIcon, InstagramIcon } from "@/icons/BrandIcons";
const Icon = ({
href,
icon,
title,
}: {
href: string;
icon: React.ReactNode;
title: string;
}) => (
<a
target="_blank"
href={href}
title={title}
rel="external nofollow noopener noreferrer"
className={style.customIcon}
>
{icon}
</a>
);
export type SidebarLatestPost = {
title: string;
slug: string;
date: string;
url?: string;
};
export type SidebarAllPost = {
date: string;
tags: string[];
};
export const Sidebar = ({
latestPosts = [],
totalCount = 0,
allPosts = [],
}: {
allPosts: SidebarAllPost[];
totalCount: number;
latestPosts: SidebarLatestPost[];
}) => {
React.useEffect(() => {
Eif (isBrowser()) {
const observer = lozad(".lozad", {
loaded(el) {
el.classList.add("loaded");
},
});
observer.observe();
}
}, []);
const lp = latestPosts.map(
(p) =>
({
node: {
frontmatter: {
url: p.url || p.slug || "",
title: p.title || "",
slug: p.url || p.slug,
},
fields: { slug: p.slug || "" },
},
}) as LatestPostProps,
);
const ap = allPosts.map(
(p) =>
({
node: {
frontmatter: {
date: p.date || "",
tags: p.tags || [],
},
},
}) as AllPost,
);
return (
<header
className={
style.introHeader +
" site-heading text-center col-xl-2 col-lg-3 col-12 order-lg-1"
}
>
<div className={style.aboutMe}>
<a
href="https://portfolio.tubone-project24.xyz/"
onClick={() =>
ReactGA.event({
category: "User",
action: "push tubone Avatar",
})
}
>
<picture>
<source
className={style.avatar}
srcSet="/assets/avater.webp"
type="image/webp"
/>
<img
className={style.avatar}
src="/assets/avater.png"
alt="tubone"
decoding="async"
/>
</picture>
</a>
<a
href="https://portfolio.tubone-project24.xyz/"
onClick={() =>
ReactGA.event({
category: "User",
action: "push tubone Avatar Str",
})
}
>
<h2>tubone</h2>
</a>
<p className={style.soliloquy}>It's my life</p>
<Icon
href="https://github.com/tubone24"
icon={<GitHubIcon size={28} />}
title="tubone24 github"
/>
<Icon
href="https://x.com/tubone24"
icon={<XIcon size={28} />}
title="tubone24 X"
/>
<Icon
href="https://www.instagram.com/mugimugi.cutedog/"
icon={<InstagramIcon size={28} />}
title="mugimugi.cutedog Instagram"
/>
<Information posts={lp} totalCount={totalCount} allPosts={ap} />
<SearchBox />
<hr />
<Subscription />
<hr />
<TagCloud allPosts={ap} />
</div>
</header>
);
};
export default Sidebar;
|