Skip to content

docs use layout #1983

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 1 commit into from
Jan 31, 2024
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
15 changes: 1 addition & 14 deletions website/src/app/docs/[version]/[type]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { DocHeader } from '../../../../DocHeader';
import { ImmutableConsole } from '../../../../ImmutableConsole';
import { getSidebarLinks } from '../../../../getSidebarLinks';
import { getTypeDefs } from '../../../../static/getTypeDefs';
import { getVersions } from '../../../../static/getVersions';
Expand Down Expand Up @@ -47,7 +45,6 @@ export default function TypeDocPage({
// sidebarLinks,
params,
}: Props) {
const versions = getVersions();
const version = getVersionFromParams(params);
const defs = getTypeDefs(version);

Expand All @@ -58,15 +55,5 @@ export default function TypeDocPage({
}

const sidebarLinks = getSidebarLinks(defs);
return (
<div>
<ImmutableConsole version={version} />
<DocHeader versions={versions} currentVersion={version} />
<div className="pageBody">
<div className="contents">
<TypeDocumentation def={def} sidebarLinks={sidebarLinks} />
</div>
</div>
</div>
);
return <TypeDocumentation def={def} sidebarLinks={sidebarLinks} />;
}
23 changes: 7 additions & 16 deletions website/src/app/docs/[version]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
import { Metadata } from 'next';
import { getVersions } from '../../../static/getVersions';
import { getTypeDefs } from '../../../static/getTypeDefs';
import { DocHeader } from '../../../DocHeader';
import { DocOverview, getOverviewData } from '../../../DocOverview';
import { DocSearch } from '../../../DocSearch';
import { ImmutableConsole } from '../../../ImmutableConsole';
import { SideBar } from '../../../Sidebar';
import { getSidebarLinks } from '../../../getSidebarLinks';
import { getVersionFromParams } from '../../getVersionFromParams';
Expand All @@ -30,26 +28,19 @@ export async function generateMetadata({ params }: Props): Promise<Metadata> {
}

export default function OverviewDocPage({ params }: Props) {
const versions = getVersions();
const version = getVersionFromParams(params);
const defs = getTypeDefs(version);
const overviewData = getOverviewData(defs);
const sidebarLinks = getSidebarLinks(defs);

return (
<div>
<ImmutableConsole version={version} />
<DocHeader versions={versions} currentVersion={version} />
<div className="pageBody">
<div className="contents">
<SideBar links={sidebarLinks} />
<div key="Overview" className="docContents">
<DocSearch />
<h1>Immutable.js ({version})</h1>
<DocOverview data={overviewData} />
</div>
</div>
<>
<SideBar links={sidebarLinks} />
<div key="Overview" className="docContents">
<DocSearch />
<h1>Immutable.js ({version})</h1>
<DocOverview data={overviewData} />
</div>
</div>
</>
);
}
6 changes: 5 additions & 1 deletion website/src/app/getVersionFromParams.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
export function getVersionFromParams(params: { version: string }): string {
type Params = {
version: string;
};

export function getVersionFromParams(params: Params): string {
return params.version.replace('%40', '@');
}