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 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | 1x 4x 1x 1x 1x 1x 1x 1x 6x 1x 8x 1x 1x | import React from "react"; import { StaticQuery, graphql } from "gatsby"; import ReactGA from "react-ga4"; import lozad from "lozad"; import Information from "./Information"; import { Post as LatestPostProps } from "./LatestPost"; import { 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"; const Icon = ({ href, icon, title, }: { href: string; icon: string; title: string; }) => ( <a target="_blank" href={href} title={title} rel="external nofollow noopener noreferrer" className={style.customIcon} > <span className={style.faLayers + " fa-fw fa-2x"}> <span className={icon} /> </span> </a> ); export type StaticQueryAllPost = { readonly node: { readonly frontmatter: GatsbyTypes.Maybe< Pick<GatsbyTypes.MarkdownRemarkFrontmatter, "date" | "tags"> >; }; }; export type StaticQueryLatestPost = { readonly node: GatsbyTypes.cardDataFragment; }; export const Sidebar = ({ latestPosts, totalCount, allPosts, }: { allPosts: ReadonlyArray<StaticQueryAllPost>; totalCount: number; latestPosts: ReadonlyArray<StaticQueryLatestPost>; }) => { 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.node.frontmatter?.url || "", title: p.node.frontmatter?.title || "", slug: p.node.frontmatter?.url, }, fields: { slug: p.node.fields?.slug || "" }, }, } as LatestPostProps) ); const ap = allPosts.map( (p) => ({ node: { frontmatter: { date: p.node.frontmatter?.date || "", tags: p.node.frontmatter?.tags || [], }, }, } as AllPost) ); return ( <header className={ style.introHeader + " site-heading text-center col-xl-2 col-lg-3 col-xs-12 order-lg-1" } > <div className={style.aboutMe}> <a href="https://portfolio.tubone-project24.xyz/"> <picture> <source className={style.avatar} srcSet="/assets/avater.webp" type="image/webp" onClick={() => ReactGA.event({ category: "User", action: "push tubone Avatar", }) } /> <img className={style.avatar} src="/assets/avater.png" alt="tubone" decoding="async" onClick={() => ReactGA.event({ category: "User", action: "push tubone Avatar", }) } /> </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="icon-github" title="tubone24 github" /> <Icon href="https://soundcloud.com/user-453736300" icon="icon-soundcloud" title="tubone24 SoundCloud" /> <Icon href="https://twitter.com/meitante1conan" icon="icon-twitter" title="tubone24 twitter" /> <Icon href="https://500px.com/tubone24" icon="icon-500px" title="tubone24 500px" /> <Information posts={lp} totalCount={totalCount} allPosts={ap} /> <SearchBox /> <hr /> <Subscription /> <hr /> <TagCloud allPosts={ap} /> </div> </header> ); }; Sidebar.defaultProps = { totalCount: 0, latestPosts: [], }; // eslint-disable-next-line import/no-anonymous-default-export export default () => ( <StaticQuery query={graphql` fragment cardData on MarkdownRemark { fields { slug } frontmatter { title url: slug date } } query SidebarQuery { all: allMarkdownRemark { totalCount allPosts: edges { node { frontmatter { date tags } } } } limited: allMarkdownRemark( sort: { order: DESC, fields: frontmatter___date } limit: 6 ) { latestPosts: edges { node { ...cardData } } } } `} render={(data) => <Sidebar {...data.all} {...data.limited} />} /> ); |