fix(div): update class name to remove weird space afterwards (#763)
Signed-off-by: Aaron <29749331+aarnphm@users.noreply.github.com>
| | |
| | | import { QuartzComponentConstructor, QuartzComponentProps } from "./types" |
| | | import { classNames } from "../util/lang" |
| | | |
| | | function ArticleTitle({ fileData, displayClass }: QuartzComponentProps) { |
| | | const title = fileData.frontmatter?.title |
| | | if (title) { |
| | | return <h1 class={`article-title ${displayClass ?? ""}`}>{title}</h1> |
| | | return <h1 class={classNames(displayClass, "article-title")}>{title}</h1> |
| | | } else { |
| | | return null |
| | | } |
| | |
| | | import { QuartzComponentConstructor, QuartzComponentProps } from "./types" |
| | | import style from "./styles/backlinks.scss" |
| | | import { resolveRelative, simplifySlug } from "../util/path" |
| | | import { classNames } from "../util/lang" |
| | | |
| | | function Backlinks({ fileData, allFiles, displayClass }: QuartzComponentProps) { |
| | | const slug = simplifySlug(fileData.slug!) |
| | | const backlinkFiles = allFiles.filter((file) => file.links?.includes(slug)) |
| | | return ( |
| | | <div class={`backlinks ${displayClass ?? ""}`}> |
| | | <div class={classNames(displayClass, "backlinks")}> |
| | | <h3>Backlinks</h3> |
| | | <ul class="overflow"> |
| | | {backlinkFiles.length > 0 ? ( |
| | |
| | | import breadcrumbsStyle from "./styles/breadcrumbs.scss" |
| | | import { FullSlug, SimpleSlug, resolveRelative } from "../util/path" |
| | | import { QuartzPluginData } from "../plugins/vfile" |
| | | import { classNames } from "../util/lang" |
| | | |
| | | type CrumbData = { |
| | | displayName: string |
| | |
| | | } |
| | | |
| | | return ( |
| | | <nav class={`breadcrumb-container ${displayClass ?? ""}`} aria-label="breadcrumbs"> |
| | | <nav class={classNames(displayClass, "breadcrumb-container")} aria-label="breadcrumbs"> |
| | | {crumbs.map((crumb, index) => ( |
| | | <div class="breadcrumb-element"> |
| | | <a href={crumb.path}>{crumb.displayName}</a> |
| | |
| | | import { formatDate, getDate } from "./Date" |
| | | import { QuartzComponentConstructor, QuartzComponentProps } from "./types" |
| | | import readingTime from "reading-time" |
| | | import { classNames } from "../util/lang" |
| | | |
| | | interface ContentMetaOptions { |
| | | /** |
| | |
| | | segments.push(timeTaken) |
| | | } |
| | | |
| | | return <p class={`content-meta ${displayClass ?? ""}`}>{segments.join(", ")}</p> |
| | | return <p class={classNames(displayClass, "content-meta")}>{segments.join(", ")}</p> |
| | | } else { |
| | | return null |
| | | } |
| | |
| | | import darkmodeScript from "./scripts/darkmode.inline" |
| | | import styles from "./styles/darkmode.scss" |
| | | import { QuartzComponentConstructor, QuartzComponentProps } from "./types" |
| | | import { classNames } from "../util/lang" |
| | | |
| | | function Darkmode({ displayClass }: QuartzComponentProps) { |
| | | return ( |
| | | <div class={`darkmode ${displayClass ?? ""}`}> |
| | | <div class={classNames(displayClass, "darkmode")}> |
| | | <input class="toggle" id="darkmode-toggle" type="checkbox" tabIndex={-1} /> |
| | | <label id="toggle-label-light" for="darkmode-toggle" tabIndex={-1}> |
| | | <svg |
| | |
| | | import script from "./scripts/explorer.inline" |
| | | import { ExplorerNode, FileNode, Options } from "./ExplorerNode" |
| | | import { QuartzPluginData } from "../plugins/vfile" |
| | | import { classNames } from "../util/lang" |
| | | |
| | | // Options interface defined in `ExplorerNode` to avoid circular dependency |
| | | const defaultOptions = { |
| | |
| | | function Explorer({ allFiles, displayClass, fileData }: QuartzComponentProps) { |
| | | constructFileTree(allFiles) |
| | | return ( |
| | | <div class={`explorer ${displayClass ?? ""}`}> |
| | | <div class={classNames(displayClass, "explorer")}> |
| | | <button |
| | | type="button" |
| | | id="explorer" |
| | |
| | | // @ts-ignore |
| | | import script from "./scripts/graph.inline" |
| | | import style from "./styles/graph.scss" |
| | | import { classNames } from "../util/lang" |
| | | |
| | | export interface D3Config { |
| | | drag: boolean |
| | |
| | | const localGraph = { ...defaultOptions.localGraph, ...opts?.localGraph } |
| | | const globalGraph = { ...defaultOptions.globalGraph, ...opts?.globalGraph } |
| | | return ( |
| | | <div class={`graph ${displayClass ?? ""}`}> |
| | | <div class={classNames(displayClass, "graph")}> |
| | | <h3>Graph View</h3> |
| | | <div class="graph-outer"> |
| | | <div id="graph-container" data-cfg={JSON.stringify(localGraph)}></div> |
| | |
| | | import { pathToRoot } from "../util/path" |
| | | import { QuartzComponentConstructor, QuartzComponentProps } from "./types" |
| | | import { classNames } from "../util/lang" |
| | | |
| | | function PageTitle({ fileData, cfg, displayClass }: QuartzComponentProps) { |
| | | const title = cfg?.pageTitle ?? "Untitled Quartz" |
| | | const baseDir = pathToRoot(fileData.slug!) |
| | | return ( |
| | | <h1 class={`page-title ${displayClass ?? ""}`}> |
| | | <h1 class={classNames(displayClass, "page-title")}> |
| | | <a href={baseDir}>{title}</a> |
| | | </h1> |
| | | ) |
| | |
| | | import style from "./styles/recentNotes.scss" |
| | | import { Date, getDate } from "./Date" |
| | | import { GlobalConfiguration } from "../cfg" |
| | | import { classNames } from "../util/lang" |
| | | |
| | | interface Options { |
| | | title: string |
| | |
| | | const pages = allFiles.filter(opts.filter).sort(opts.sort) |
| | | const remaining = Math.max(0, pages.length - opts.limit) |
| | | return ( |
| | | <div class={`recent-notes ${displayClass ?? ""}`}> |
| | | <div class={classNames(displayClass, "recent-notes")}> |
| | | <h3>{opts.title}</h3> |
| | | <ul class="recent-ul"> |
| | | {pages.slice(0, opts.limit).map((page) => { |
| | |
| | | import style from "./styles/search.scss" |
| | | // @ts-ignore |
| | | import script from "./scripts/search.inline" |
| | | import { classNames } from "../util/lang" |
| | | |
| | | export default (() => { |
| | | function Search({ displayClass }: QuartzComponentProps) { |
| | | return ( |
| | | <div class={`search ${displayClass ?? ""}`}> |
| | | <div class={classNames(displayClass, "search")}> |
| | | <div id="search-icon"> |
| | | <p>Search</p> |
| | | <div></div> |
| | |
| | | import { QuartzComponentConstructor, QuartzComponentProps } from "./types" |
| | | import { classNames } from "../util/lang" |
| | | |
| | | function Spacer({ displayClass }: QuartzComponentProps) { |
| | | return <div class={`spacer ${displayClass ?? ""}`}></div> |
| | | return <div class={classNames(displayClass, "spacer")}></div> |
| | | } |
| | | |
| | | export default (() => Spacer) satisfies QuartzComponentConstructor |
| | |
| | | import { QuartzComponentConstructor, QuartzComponentProps } from "./types" |
| | | import legacyStyle from "./styles/legacyToc.scss" |
| | | import modernStyle from "./styles/toc.scss" |
| | | import { classNames } from "../util/lang" |
| | | |
| | | // @ts-ignore |
| | | import script from "./scripts/toc.inline" |
| | |
| | | } |
| | | |
| | | return ( |
| | | <div class={`toc ${displayClass ?? ""}`}> |
| | | <div class={classNames(displayClass, "toc")}> |
| | | <button type="button" id="toc" class={fileData.collapseToc ? "collapsed" : ""}> |
| | | <h3>Table of Contents</h3> |
| | | <svg |
| | |
| | | import { pathToRoot, slugTag } from "../util/path" |
| | | import { QuartzComponentConstructor, QuartzComponentProps } from "./types" |
| | | import { classNames } from "../util/lang" |
| | | |
| | | function TagList({ fileData, displayClass }: QuartzComponentProps) { |
| | | const tags = fileData.frontmatter?.tags |
| | | const baseDir = pathToRoot(fileData.slug!) |
| | | if (tags && tags.length > 0) { |
| | | return ( |
| | | <ul class={`tags ${displayClass ?? ""}`}> |
| | | <ul class={classNames(displayClass, "tags")}> |
| | | {tags.map((tag) => { |
| | | const display = `#${tag}` |
| | | const linkDest = baseDir + `/tags/${slugTag(tag)}` |
| | |
| | | export function capitalize(s: string): string { |
| | | return s.substring(0, 1).toUpperCase() + s.substring(1) |
| | | } |
| | | |
| | | export function classNames( |
| | | displayClass?: "mobile-only" | "desktop-only", |
| | | ...classes: string[] |
| | | ): string { |
| | | if (displayClass) { |
| | | classes.push(displayClass) |
| | | } |
| | | return classes.join(" ") |
| | | } |