Skip to content

[CT-3782] chore: replace readme not available message #120

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions components/PackageReadMePlaceholder.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import Html from './Html';

type Props = {
packageName: string,
version: string,
title: string,
description: string
}

export default function PackageReadMePlaceholder(data: Props) {
const {
packageName,
version,
title,
description
} = data;

return (
<div
>
<div className="max-w-screen-lg mt-8 md:mt-12">
<div className="mt-2 prose-sm prose sm:prose max-w-none sm:max-w-none">
<header>
<h1>
<Html>{`${packageName} (version ${version})`}</Html>
</h1>
</header>
{
title
&&
(
<section>
<h2 className="text-xl text-gray-500">{title}</h2>
</section>
)
}
{
description
&&
(
<section>
<h2>Description</h2>
<Html>{description}</Html>
</section>
)
}
</div>
</div>
</div>
);
}
12 changes: 12 additions & 0 deletions pages/packages/[package]/versions/[version].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Link from 'next/link';
import Layout from '../../../../components/Layout';
import PackageFunctionList from '../../../../components/PackageFunctionList';
import PackageReadme from '../../../../components/PackageReadme';
import PackageReadMePlaceholder from '../../../../components/PackageReadMePlaceholder';
import PackageSidebar from '../../../../components/PackageSidebar';
import { getMonthlyDownloads } from '../../../../lib/downloads';
import {
Expand Down Expand Up @@ -112,7 +113,18 @@ export default function PackageVersionPage({
</Link>
</div>
)}
{
metadata.readmemd
?
<PackageReadme readme={metadata.readmemd} />
:
<PackageReadMePlaceholder
packageName = {metadata.package_name}
version = {metadata.version}
title = {metadata.title}
description = {metadata.description}
/>
}
</div>
<div className="w-full pt-8 border-t lg:border-t-0 lg:w-1/3 lg:pt-0 lg:pl-8 lg:border-l">
<PackageSidebar
Expand Down