-
Notifications
You must be signed in to change notification settings - Fork 91
/
index.tsx
36 lines (33 loc) · 1.09 KB
/
index.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React, { useEffect } from 'react';
import Layout from '@theme/Layout';
import useDocusaurusContext from '@docusaurus/useDocusaurusContext';
import Home from './home'
import useIsBrowser from '@docusaurus/useIsBrowser';
import "../css/font.css"
import "../css/font-awesome.min.css"
export default function () {
const isBrowser = useIsBrowser();
const { siteConfig } = useDocusaurusContext();
const pathname = isBrowser && location.pathname
useEffect(() => {
if (isBrowser) {
const nav = document.getElementsByTagName('nav')[0];
const classList = nav && nav.classList;
if (!classList) return;
if (pathname === '/' || pathname === '/zh-CN/') {
classList.add('index-nav');
} else {
classList.remove('index-nav');
}
}
}, [isBrowser, pathname])
return (
<Layout
title={siteConfig.title}
description="Description will go into a meta tag in <head />">
<main>
<Home />
</main>
</Layout>
);
}