Skip to content

Commit

Permalink
wip: move old theme config to new
Browse files Browse the repository at this point in the history
  • Loading branch information
OzakIOne committed Dec 21, 2023
1 parent 9e8768c commit 67056e9
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,10 @@ import IconExternalLink from '@theme/Icon/ExternalLink';
import type {Props} from '@theme/Footer/LinkItem';

export default function FooterLinkItem({item}: Props): JSX.Element {
const {to, href, label, prependBaseUrlToHref, node, ...props} = item;
const {to, href, label, prependBaseUrlToHref, ...props} = item;
const toUrl = useBaseUrl(to);
const normalizedHref = useBaseUrl(href, {forcePrependBaseUrl: true});

if (node) {
const NodeElement = node as React.ElementType;
return <NodeElement />;
}

return (
<Link
className="footer__link-item"
Expand Down
1 change: 0 additions & 1 deletion website/docusaurus.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ export default async function createConfigAsync() {
],
],
themeConfig: {
metadata: [{name: 'twitter:card', content: 'summary'}],
algolia: {
appId: 'X1Z85QJPUV',
apiKey: 'bf7211c161e8205da2f933a02534105a',
Expand Down
79 changes: 34 additions & 45 deletions website/docusaurus.theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,29 @@ import VersionsArchived from './versionsArchived.json';
import PrismLight from './src/utils/prismLight';
import PrismDark from './src/utils/prismDark';
import type * as Preset from '@docusaurus/preset-classic';
// TODO remove this eslint ruse
// TODO PrismDark and PrismLight types
// TODO `satisfies Preset.ThemeConfig` `satisfies Config`
// results Expected ';', got 'satisfies'
/* eslint-disable @docusaurus/no-untranslated-text */

const ArchivedVersionsDropdownItems = Object.entries(VersionsArchived).splice(
0,
5,
);
const isDev = process.env.NODE_ENV === 'development';
// const isDeployPreview =
// !!process.env.NETLIFY && process.env.CONTEXT === 'deploy-preview';

export default {
metadata: [{name: 'twitter:card', content: 'summary'}],
// algolia: {
// appId: 'X1Z85QJPUV',
// apiKey: 'bf7211c161e8205da2f933a02534105a',
// indexName: 'docusaurus-2',
// replaceSearchResultPathname:
// isDev || isDeployPreview
// ? {
// from: /^\/docs\/next/g.source,
// to: '/docs',
// }
// : undefined,
// },
announcementBar: {
id: 'announcementBar-3', // Increment on change
content: function AnnouncementBarContent(): ReactNode {
Expand Down Expand Up @@ -92,25 +103,16 @@ export default {
title: 'Learn',
items: [
{
node: (): ReactNode => (
<Link to="/docs" className="footer__link-item">
Introduction
</Link>
),
label: 'Introduction',
to: 'docs',
},
{
node: (): ReactNode => (
<Link to="/docs/installation" className="footer__link-item">
Installation
</Link>
),
label: 'Installation',
to: 'docs/installation',
},
{
node: (): ReactNode => (
<Link to="/docs/migration" className="footer__link-item">
Migration from v1 to v2
</Link>
),
label: 'Migration from v1 to v2',
to: 'docs/migration',
},
],
},
Expand All @@ -122,41 +124,29 @@ export default {
href: 'https://stackoverflow.com/questions/tagged/docusaurus',
},
{
node: (): ReactNode => (
<Link to="/feature-requests" className="footer__link-item">
Feature Requests
</Link>
),
label: 'Feature Requests',
to: '/feature-requests',
},
{
label: 'Discord',
href: 'https://discordapp.com/invite/docusaurus',
},
{
node: (): ReactNode => (
<Link to="/community/support" className="footer__link-item">
Help
</Link>
),
label: 'Help',
to: '/community/support',
},
],
},
{
title: 'More',
items: [
{
node: (): ReactNode => (
<Link to="/blog" className="footer__link-item">
Blog
</Link>
),
label: 'Blog',
to: 'blog',
},
{
node: (): ReactNode => (
<Link to="/changelog" className="footer__link-item">
Changelog
</Link>
),
label: 'Changelog',
to: '/changelog',
},
{
label: 'GitHub',
Expand All @@ -168,10 +158,10 @@ export default {
},
{
html: `
<a href="https://www.netlify.com" target="_blank" rel="noreferrer noopener" aria-label="Deploys by Netlify">
<img src="https://www.netlify.com/img/global/badges/netlify-color-accent.svg" alt="Deploys by Netlify" width="114" height="51" />
</a>
`,
<a href="https://www.netlify.com" target="_blank" rel="noreferrer noopener" aria-label="Deploys by Netlify">
<img src="https://www.netlify.com/img/global/badges/netlify-color-accent.svg" alt="Deploys by Netlify" width="114" height="51" />
</a>
`,
},
],
},
Expand Down Expand Up @@ -306,4 +296,3 @@ export default {
.filter(Boolean) as NonNullable<Preset.ThemeConfig['navbar']>['items'],
},
};
// satisfies Preset.ThemeConfig;

0 comments on commit 67056e9

Please sign in to comment.