From ee6bdfd3ad246fdb29ee9778109d0d34d398e50e Mon Sep 17 00:00:00 2001 From: Lisandra-dev Date: Thu, 18 Apr 2024 19:48:40 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=84=20synced=20local=20'quartz/'=20wit?= =?UTF-8?q?h=20remote=20'quartz/'?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- quartz/components/PageList.tsx | 42 ++++++++++++++++++++++------------ quartz/styles/custom.scss | 2 +- 2 files changed, 29 insertions(+), 15 deletions(-) diff --git a/quartz/components/PageList.tsx b/quartz/components/PageList.tsx index 26593a797646d..b5e6de7e1a7ca 100644 --- a/quartz/components/PageList.tsx +++ b/quartz/components/PageList.tsx @@ -1,9 +1,11 @@ +import path from "path"; import { GlobalConfiguration } from "../cfg"; import { QuartzPluginData } from "../plugins/vfile"; -import { FullSlug, resolveRelative, sluggify } from "../util/path"; +import { FilePath, FullSlug, pathToRoot, resolveRelative, sluggify, slugifyFilePath } from "../util/path"; import { Date, getDate } from "./Date"; import { QuartzComponent, QuartzComponentProps } from "./types"; import fs from 'fs'; +import { pathToFileURL } from "url"; export function byDateAndAlphabetical( cfg: GlobalConfiguration, @@ -47,20 +49,16 @@ export const PageList: QuartzComponent = ({ cfg, fileData, allFiles, limit }: Pr const tags = page.frontmatter?.tags ?? []; const description = page.frontmatter?.description; let image : string | undefined = page.frontmatter?.image as string ?? undefined ; - if (cfg.ogImageDir) { - image = `${cfg.ogImageDir}/${image}` - image = resolveRelative(fileData.slug!, image as FullSlug); - //check if image exists - image = fs.existsSync(image) ? image : undefined; + if (cfg.ogImageDir && image) { + const imageFromOg = `${cfg.ogImageDir}/${image}` + const imageRelative = resolveRelative(fileData.slug!, imageFromOg as FullSlug); + //verify if image exists in `content/_assets/img` folder + image = fs.existsSync(path.resolve(`content/${imageFromOg}`)) ? imageRelative : undefined; } return (
  • + +

    +
      {tags.map((tag) => ( @@ -109,4 +107,20 @@ PageList.css = ` .section > .tags { margin: 0; } + +.section { + border: 1px solid var(--lightgray); + border-radius: 5px; + padding: 1rem; + position: relative; + transition: left 0.3s ease; + left: 0; +} + +.section:hover { + background-color: var(--lightgray); + position: relative; + left: -15px !important; + transition: left 0.3s ease; +} `; diff --git a/quartz/styles/custom.scss b/quartz/styles/custom.scss index 2126e9d97f539..8110d416b3a4b 100644 --- a/quartz/styles/custom.scss +++ b/quartz/styles/custom.scss @@ -33,7 +33,7 @@ ol.overflow { @media all and (max-width: $mobileBreakpoint) { .page .page-header { - width: 90dvw; + width: auto; } }