add boolean for edit on github

This commit is contained in:
2025-05-10 19:30:43 +07:00
parent cd77ef10aa
commit cf9e1a6cf0
9 changed files with 1003 additions and 7159 deletions

View File

@@ -1,3 +1,16 @@
## [1.8.5] - 2025-05-10
> Add sponsor card on single docs page
### Added
- boolean show/hide `edit on github`
### Improved
- adjusment docu.json
- adjustment navbar, footer and components
## [1.8.0] - 2025-03-01 ## [1.8.0] - 2025-03-01
> Now looks more modern and clean which is a big change in layout and design > Now looks more modern and clean which is a big change in layout and design

View File

@@ -87,14 +87,18 @@ export default async function DocsPage({ params: { slug = [] } }: PageProps) {
<h1 className="text-3xl !-mt-0.5">{title}</h1> <h1 className="text-3xl !-mt-0.5">{title}</h1>
<p className="-mt-4 text-muted-foreground text-[16.5px]">{description}</p> <p className="-mt-4 text-muted-foreground text-[16.5px]">{description}</p>
<div>{res.content}</div> <div>{res.content}</div>
<div className="my-8 flex justify-between items-center border-b-2 border-x-muted-foreground"> <div
className={`my-8 flex items-center border-b-2 border-x-muted-foreground ${
docuConfig.repository?.editLink ? "justify-between" : "justify-end"
}`}
>
{docuConfig.repository?.editLink && <EditThisPage filePath={filePath} />}
{date && ( {date && (
<p className="text-[13px] text-muted-foreground"> <p className="text-[13px] text-muted-foreground">
Published on {formatDate2(date)} Published on {formatDate2(date)}
</p> </p>
)} )}
<EditThisPage filePath={filePath} /> </div>
</div>
<Pagination pathname={pathName} /> <Pagination pathname={pathName} />
</Typography> </Typography>
<ScrollToTop /> <ScrollToTop />

View File

@@ -25,7 +25,7 @@ export default function Home() {
)} )}
> >
<AnimatedShinyText className="inline-flex items-center justify-center px-4 py-1 transition ease-out hover:text-neutral-100 hover:duration-300 hover:dark:text-neutral-200"> <AnimatedShinyText className="inline-flex items-center justify-center px-4 py-1 transition ease-out hover:text-neutral-100 hover:duration-300 hover:dark:text-neutral-200">
<span>🚀 New Version - Release v.1.8.0</span> <span>🚀 New Version - Release v1.8.5</span>
<ArrowRightIcon className="ml-1 size-3 transition-transform duration-300 ease-in-out group-hover:translate-x-0.5" /> <ArrowRightIcon className="ml-1 size-3 transition-transform duration-300 ease-in-out group-hover:translate-x-0.5" />
</AnimatedShinyText> </AnimatedShinyText>
</div> </div>

View File

@@ -9,24 +9,22 @@ interface EditThisPageProps {
const EditThisPage: React.FC<EditThisPageProps> = ({ filePath }) => { const EditThisPage: React.FC<EditThisPageProps> = ({ filePath }) => {
const { repository } = docuConfig; const { repository } = docuConfig;
if (!repository?.editLink || !repository.url || !repository.editPathTemplate) return null;
const editUrl = `${repository.url}${repository.editPathTemplate.replace("{filePath}", filePath)}`; const editUrl = `${repository.url}${repository.editPathTemplate.replace("{filePath}", filePath)}`;
return ( return (
<div style={{ textAlign: 'right' }}> <div className="text-right">
<Link <Link
href={editUrl} href={editUrl}
target='_blank' target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
style={{ aria-label="Edit this page on Git"
display: 'inline-flex', className="inline-flex items-center gap-2 text-sm font-medium text-muted-foreground no-underline"
alignItems: 'center',
gap: '0.5rem',
textDecoration: 'none',
fontWeight: 'bold',
}}
> >
<span className='text-primary text-sm max-[480px]:hidden'>Edit this page</span> <span className="flex justify-start items-center gap-1">Edit this page
<SquarePenIcon className="w-4 h-4 text-primary" /> <SquarePenIcon className="w-4 h-4" /></span>
</Link> </Link>
</div> </div>
); );

View File

@@ -16,7 +16,7 @@ export function Footer() {
<FooterButtons /> <FooterButtons />
</div> </div>
</div> </div>
<div className="flex flex-col items-start justify-center w-full gap-4 mt-4 xl:items-end lg:w-2/5"> <div className="flex flex-col items-center justify-center w-full gap-4 mt-4 lg:items-end lg:w-2/5">
<p className="text-center text-muted-foreground"> <p className="text-center text-muted-foreground">
Copyright © {new Date().getFullYear()} {footer.copyright} - <MadeWith /> Copyright © {new Date().getFullYear()} {footer.copyright} - <MadeWith />
</p> </p>

View File

@@ -13,7 +13,7 @@ DocuBook is proudly **open-source**! 🎉 We believe in creating an accessible,
<Note title="Contribute"> <Note title="Contribute">
Interested in helping us improve? Check out our [GitHub Interested in helping us improve? Check out our [GitHub
repository](https://github.com/mywildancloud/docubook) to get started! From repository](https://github.com/gitfromwildan/docubook) to get started! From
feature suggestions to bug fixes, all contributions are welcome. feature suggestions to bug fixes, all contributions are welcome.
</Note> </Note>

View File

@@ -50,7 +50,8 @@
}, },
"repository": { "repository": {
"url": "https://gitlab.com/mywildancloud/docubook", "url": "https://gitlab.com/mywildancloud/docubook",
"editPathTemplate": "/blob/main/{filePath}" "editPathTemplate": "/blob/main/{filePath}",
"editLink": true
}, },
"routes": [ "routes": [
{ {

1562
package-lock.json generated

File diff suppressed because it is too large Load Diff

6544
pnpm-lock.yaml generated

File diff suppressed because it is too large Load Diff