Skip to content

Commit f52a8d8

Browse files
committed
Removing unsafe old navbar and doc swizzles, adding authors component
1 parent e4ae35a commit f52a8d8

File tree

12 files changed

+412
-396
lines changed

12 files changed

+412
-396
lines changed

docs/create/windows/index-windows.mdx

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ import Tabs from '@theme/Tabs';
1010
import TabItem from '@theme/TabItem';
1111
import useBaseUrl from '@docusaurus/useBaseUrl';
1212
import RedisCard from '@site/src/theme/RedisCard';
13+
import Authors from '@site/src/theme/Authors';
14+
15+
<Authors frontMatter={frontMatter} />
1316

1417
You can run Redis on Windows 10 using Windows Subsystem for Linux(a.k.a WSL2). WSL2 is a compatibility layer for running Linux binary executables natively on Windows 10 and Windows Server 2019. WSL2 lets developers run a GNU/Linux environment (that includes command-line tools, utilities, and applications) directly on Windows.
1518

@@ -31,7 +34,7 @@ Reboot Windows after making the change — note that you only need to do this on
3134
start ms-windows-store:
3235
```
3336

34-
Then search for Ubuntu, or your preferred distribution of Linux, and download the latest version.
37+
Then search for Ubuntu, or your preferred distribution of Linux, and download the latest version.
3538

3639
### Step 3: Install Redis server
3740

docusaurus.config.js

+142-127
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,22 @@ const path = require('path');
22

33
module.exports = {
44
title: 'The Home of Redis Developers',
5-
tagline: 'Learn all the best practices to get up and running with Redis in no time. Get started and discover the power of Redis, whether on your local machines or in the cloud.',
5+
tagline:
6+
'Learn all the best practices to get up and running with Redis in no time. Get started and discover the power of Redis, whether on your local machines or in the cloud.',
67
url: 'https://developer.redis.com',
78
baseUrl: '/',
89
onBrokenLinks: 'throw',
910
onBrokenMarkdownLinks: 'warn',
1011
favicon: 'img/favicon.ico',
1112
organizationName: 'redis-developer', // Usually your GitHub org/user name.
1213
projectName: 'redis-developer', // Usually your repo name.
14+
// Even if you don't use internalization, you can use this field to set useful
15+
// metadata like html lang. For example, if your site is Chinese, you may want
16+
// to replace "en" with "zh-Hans".
17+
i18n: {
18+
defaultLocale: 'en',
19+
locales: ['en'],
20+
},
1321
customFields: {
1422
authors: {
1523
simon: {
@@ -160,136 +168,143 @@ module.exports = {
160168
},
161169
},
162170
},
163-
themeConfig: {
164-
// ...
165-
googleTagManager: {
166-
trackingID: 'GTM-W8Z6BLQ',
167-
},
168-
prism: {
169-
additionalLanguages: [
170-
'csharp',
171-
'php',
172-
'ruby',
173-
'java',
174-
'rust',
175-
'elixir',
176-
'groovy',
177-
],
178-
},
171+
themeConfig:
172+
/** @type {import('@docusaurus/preset-classic').ThemeConfig} */
173+
({
174+
// ...
175+
googleTagManager: {
176+
trackingID: 'GTM-W8Z6BLQ',
177+
},
178+
prism: {
179+
additionalLanguages: [
180+
'csharp',
181+
'php',
182+
'ruby',
183+
'java',
184+
'rust',
185+
'elixir',
186+
'groovy',
187+
],
188+
},
179189

180-
navbar: {
181-
style: 'dark',
182-
title: null,
183-
logo: {
184-
alt: 'Redis Developer Hub logo',
185-
src: 'img/logo-1.png',
186-
},
187-
hideOnScroll: true,
188-
items: [
189-
{
190-
to: '/create/rediscloud',
191-
activeBasePath: 'docs',
192-
label: 'Get started',
193-
position: 'right',
194-
},
195-
{
196-
href: 'https://launchpad.redis.com',
197-
label: 'Redis Launchpad',
198-
position: 'right',
199-
},
200-
{
201-
href: 'https://redis.com/try-free/',
202-
label: 'Try Free',
203-
position: 'right',
204-
},
205-
],
206-
},
207-
footer: {
208-
style: 'dark',
209-
logo: {
210-
alt: 'Redis logo',
211-
src: 'img/redis_logo_red_white_rgb.svg',
212-
href: 'https://redis.com/',
213-
},
214-
links: [
215-
{
216-
title: 'Get Started',
217-
items: [
218-
{
219-
label: 'Create Database',
220-
to: '/create/rediscloud',
221-
},
222-
{
223-
label: 'Develop',
224-
to: '/develop/',
225-
},
226-
{
227-
label: 'Explore your data',
228-
to: '/explore/redisinsight/',
229-
},
230-
{
231-
label: 'Best Practices',
232-
href: 'https://redis.com/redis-best-practices/introduction/',
233-
},
234-
// {
235-
// label: 'Tutorials',
236-
// to: '#',
237-
// },
238-
// {
239-
// label: 'Samples & Demos',
240-
// to: '#',
241-
// },
242-
{
243-
label: 'Redis Stack',
244-
href: '/create/redis-stack/',
245-
},
246-
],
190+
navbar: {
191+
style: 'dark',
192+
title: null,
193+
logo: {
194+
alt: 'Redis Developer Hub logo',
195+
src: 'img/logo-1.png',
247196
},
248-
{
249-
title: 'Resources',
250-
items: [
251-
{
252-
label: 'Community',
253-
href: 'https://redis.com/community/',
254-
},
255-
{
256-
label: 'Redis University',
257-
href: 'https://university.redis.com',
258-
},
259-
{
260-
label: 'Command Reference',
261-
href: 'https://redis.io/commands',
262-
},
263-
{
264-
label: 'How-tos & tutorials',
265-
to: '/howtos',
266-
},
267-
// label: 'Use Cases',
268-
// href: 'https://redis.com/solutions',
269-
// },
270-
],
197+
hideOnScroll: true,
198+
items: [
199+
{
200+
type: 'search',
201+
position: 'right',
202+
},
203+
{
204+
to: '/create/rediscloud',
205+
activeBasePath: 'docs',
206+
label: 'Get started',
207+
position: 'right',
208+
},
209+
{
210+
href: 'https://launchpad.redis.com',
211+
label: 'Redis Launchpad',
212+
position: 'right',
213+
},
214+
{
215+
href: 'https://redis.com/try-free/',
216+
label: 'Try Free',
217+
position: 'right',
218+
},
219+
],
220+
},
221+
footer: {
222+
style: 'dark',
223+
logo: {
224+
alt: 'Redis logo',
225+
src: 'img/redis_logo_red_white_rgb.svg',
226+
href: 'https://redis.com/',
271227
},
272-
],
273-
copyright: `Copyright: © ${new Date().getFullYear()} Redis. All rights reserved. Redis and the cube logo are registered trademarks of Redis Ltd.`,
274-
},
275-
colorMode: {
276-
// Hides the switch in the navbar
277-
// Useful if you want to support a single color mode
278-
disableSwitch: false,
279-
},
280-
announcementBar: {
281-
id: 'redisconf20201cfp', // Any value that will identify this message.
282-
content:
283-
'<p class="text"> RedisDays Available Now On-Demand. </p> <a href="https://redis.com/redisdays/" target="_blank" rel="noopener" class="btn">Learn More</a>',
284-
// content: '<p class="text"></p> <a href="https://redislabs.com/redisconf/" target="_blank" rel="noopener" class="btn"></a>',
285-
backgroundColor: '#fff', // Defaults to `#fff`.
286-
textColor: '#000', // Defaults to `#000`.
287-
isCloseable: true, // Defaults to `true`.
288-
},
289-
},
228+
links: [
229+
{
230+
title: 'Get Started',
231+
items: [
232+
{
233+
label: 'Create Database',
234+
to: '/create/rediscloud',
235+
},
236+
{
237+
label: 'Develop',
238+
to: '/develop/',
239+
},
240+
{
241+
label: 'Explore your data',
242+
to: '/explore/redisinsight/',
243+
},
244+
{
245+
label: 'Best Practices',
246+
href: 'https://redis.com/redis-best-practices/introduction/',
247+
},
248+
// {
249+
// label: 'Tutorials',
250+
// to: '#',
251+
// },
252+
// {
253+
// label: 'Samples & Demos',
254+
// to: '#',
255+
// },
256+
{
257+
label: 'Redis Stack',
258+
href: '/create/redis-stack/',
259+
},
260+
],
261+
},
262+
{
263+
title: 'Resources',
264+
items: [
265+
{
266+
label: 'Community',
267+
href: 'https://redis.com/community/',
268+
},
269+
{
270+
label: 'Redis University',
271+
href: 'https://university.redis.com',
272+
},
273+
{
274+
label: 'Command Reference',
275+
href: 'https://redis.io/commands',
276+
},
277+
{
278+
label: 'How-tos & tutorials',
279+
to: '/howtos',
280+
},
281+
// label: 'Use Cases',
282+
// href: 'https://redis.com/solutions',
283+
// },
284+
],
285+
},
286+
],
287+
copyright: `Copyright: © ${new Date().getFullYear()} Redis. All rights reserved. Redis and the cube logo are registered trademarks of Redis Ltd.`,
288+
},
289+
colorMode: {
290+
// Hides the switch in the navbar
291+
// Useful if you want to support a single color mode
292+
disableSwitch: false,
293+
},
294+
announcementBar: {
295+
id: 'redisconf20201cfp', // Any value that will identify this message.
296+
content:
297+
'<p class="text"> RedisDays Available Now On-Demand. </p> <a href="https://redis.com/redisdays/" target="_blank" rel="noopener" class="btn">Learn More</a>',
298+
// content: '<p class="text"></p> <a href="https://redislabs.com/redisconf/" target="_blank" rel="noopener" class="btn"></a>',
299+
backgroundColor: '#fff', // Defaults to `#fff`.
300+
textColor: '#000', // Defaults to `#000`.
301+
isCloseable: true, // Defaults to `true`.
302+
},
303+
}),
290304
presets: [
291305
[
292-
'@docusaurus/preset-classic',
306+
'classic',
307+
/** @type {import('@docusaurus/preset-classic').Options} */
293308
{
294309
docs: {
295310
routeBasePath: '/',
@@ -315,7 +330,7 @@ module.exports = {
315330
'**/*.test.{js,jsx,ts,tsx}',
316331
'**/__tests__/**',
317332
],
318-
// mdxPageComponent: '@theme/MDXPage',
333+
mdxPageComponent: '@theme/MDXPage',
319334
remarkPlugins: [],
320335
rehypePlugins: [],
321336
beforeDefaultRemarkPlugins: [],

src/pages/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import Layout from '@docusaurus/theme-classic/lib/theme/Layout';
2+
import Layout from '@theme/Layout';
33

44
import Hero from '@site/src/theme/Hero';
55
import Languages from '@site/src/theme/Languages';
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,28 @@
1-
/**
2-
* Copyright (c) Facebook, Inc. and its affiliates.
3-
*
4-
* This source code is licensed under the MIT license found in the
5-
* LICENSE file in the root directory of this source tree.
6-
*/
7-
81
import React from 'react';
9-
102
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
11-
import DocItem from '@docusaurus/theme-classic/lib/theme/DocItem';
12-
import type { Props } from '@theme/DocItem';
133
import styles from './styles.module.css';
144

15-
function DocItemWrapper(props: Props): JSX.Element {
5+
interface AuthorsProps {
6+
frontMatter: {
7+
authors?: string[];
8+
};
9+
}
10+
11+
function Authors({ frontMatter }: AuthorsProps): JSX.Element {
1612
const { siteConfig } = useDocusaurusContext();
17-
const { content: DocContent } = props;
1813
const authorLookup: Record<
1914
string,
2015
{ link: string; name: string; title: string; image: string }
2116
> = (siteConfig.customFields as any).authors;
2217

2318
return (
2419
<>
25-
{(DocContent.frontMatter as any).authors && (
20+
{frontMatter.authors && (
2621
<div className="docAuthors">
2722
<hr />
28-
{/* eslint-disable-next-line @typescript-eslint/no-unsafe-call */}
29-
{(DocContent.frontMatter as any).authors.map((author: string) => {
23+
{frontMatter.authors.map((author) => {
3024
return (
31-
<div className={styles.authorByline}>
25+
<div key={author} className={styles.authorByline}>
3226
<img
3327
className={styles.authorProfileImage}
3428
src={`/img/${
@@ -53,9 +47,8 @@ function DocItemWrapper(props: Props): JSX.Element {
5347
<hr />
5448
</div>
5549
)}
56-
<DocItem {...props} />
5750
</>
5851
);
5952
}
6053

61-
export default DocItemWrapper;
54+
export default Authors;

0 commit comments

Comments
 (0)