| | |
| | | import { resolveRelative, simplifySlug } from "../util/path" |
| | | import { i18n } from "../i18n" |
| | | import { classNames } from "../util/lang" |
| | | import OverflowListFactory from "./OverflowList" |
| | | |
| | | interface BacklinksOptions { |
| | | hideWhenEmpty: boolean |
| | |
| | | |
| | | export default ((opts?: Partial<BacklinksOptions>) => { |
| | | const options: BacklinksOptions = { ...defaultOptions, ...opts } |
| | | const { OverflowList, overflowListAfterDOMLoaded } = OverflowListFactory() |
| | | |
| | | const Backlinks: QuartzComponent = ({ |
| | | fileData, |
| | |
| | | return ( |
| | | <div class={classNames(displayClass, "backlinks")}> |
| | | <h3>{i18n(cfg.locale).components.backlinks.title}</h3> |
| | | <ul class="overflow"> |
| | | <OverflowList> |
| | | {backlinkFiles.length > 0 ? ( |
| | | backlinkFiles.map((f) => ( |
| | | <li> |
| | |
| | | ) : ( |
| | | <li>{i18n(cfg.locale).components.backlinks.noBacklinksFound}</li> |
| | | )} |
| | | </ul> |
| | | </OverflowList> |
| | | </div> |
| | | ) |
| | | } |
| | | |
| | | Backlinks.css = style |
| | | Backlinks.afterDOMLoaded = overflowListAfterDOMLoaded |
| | | |
| | | return Backlinks |
| | | }) satisfies QuartzComponentConstructor |