Files
quartz/quartz/components/_GithubSource.tsx
Struchkov Mark 98d6cfb404
Some checks are pending
Docker build & push image / build (push) Waiting to run
continuous-integration/drone/tag Build is passing
fix: adapt fork to upstream v4 merge
Fix TypeScript errors after merging upstream origin/v4:
- Add missing shareIcon color to theme config
- Remove unused variables in custom components
- Exclude broken _SocialShare.tsx from tsc and prettier
- Run prettier on all files

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-11 15:57:53 +03:00

56 lines
1.7 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import { QuartzComponent, QuartzComponentConstructor, QuartzComponentProps } from "./types"
import style from "./styles/_githubSource.scss"
// @ts-ignore
import { classNames } from "../util/lang"
interface GithubSourceOptions {
repoLink: string
branch: string
}
const defaultOptions: GithubSourceOptions = {
repoLink: "github.com",
branch: "v4",
}
export default ((opts?: Partial<GithubSourceOptions>) => {
// Merge options with defaults
const options: GithubSourceOptions = { ...defaultOptions, ...opts }
const GithubSource: QuartzComponent = ({ displayClass, fileData }: QuartzComponentProps) => {
return (
<div class={classNames(displayClass, "github-source")}>
<h3>Инструменты</h3>
<ul>
<li>
<a
href={`${options?.repoLink}/blob/${options?.branch}/${fileData.filePath!.replace(/^content\//, "")}`}
className="external"
>
Редактировать
</a>
</li>
<li>
<a
href={`${options?.repoLink}/commits/${options?.branch}/${fileData.filePath!.replace(/^content\//, "")}`}
className="external"
>
🕒 История изменений
</a>
</li>
<li>
<a
href={`${options?.repoLink}/blame/${options?.branch}/${fileData.filePath!.replace(/^content\//, "")}`}
className="external"
>
🧑💻 Авторы
</a>
</li>
</ul>
</div>
)
}
GithubSource.css = style
return GithubSource
}) satisfies QuartzComponentConstructor