Cleanup imports and unused variables
parent
7cc8f0cc57
commit
bce0c8598a
21
src/App.js
21
src/App.js
|
@ -1,19 +1,17 @@
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
|
import axios from "axios";
|
||||||
|
import Fuse from "fuse.js";
|
||||||
|
import { useCookies } from "react-cookie";
|
||||||
|
import queryString from "query-string";
|
||||||
|
|
||||||
import LangFilters from "./components/LangFilters";
|
import LangFilters from "./components/LangFilters";
|
||||||
import SearchBar from "./components/SearchBar";
|
import SearchBar from "./components/SearchBar";
|
||||||
import SearchResult from "./components/SearchResult";
|
import SearchResult from "./components/SearchResult";
|
||||||
import axios from "axios";
|
import MarkdownParser from "./components/MarkdownParser";
|
||||||
import Fuse from "fuse.js";
|
|
||||||
import { ThemeContext, themes, swapMode } from "./darkMode";
|
|
||||||
import { useCookies } from "react-cookie";
|
|
||||||
|
|
||||||
import Default from "./components/Default";
|
|
||||||
|
|
||||||
import SunImg from "./img/sun.png";
|
import SunImg from "./img/sun.png";
|
||||||
import MoonImg from "./img/moon.png";
|
import MoonImg from "./img/moon.png";
|
||||||
import MarkdownParser from "./components/MarkdownParser";
|
import { ThemeContext, themes, swapMode } from "./darkMode";
|
||||||
const queryString = require("query-string");
|
|
||||||
|
|
||||||
|
|
||||||
function jsonToArray(json) {
|
function jsonToArray(json) {
|
||||||
// list of all books
|
// list of all books
|
||||||
|
@ -71,10 +69,7 @@ function App() {
|
||||||
const [searchParams, setSearchParams] = useState({ searchTerm: defaultSearch, "lang.code": "" });
|
const [searchParams, setSearchParams] = useState({ searchTerm: defaultSearch, "lang.code": "" });
|
||||||
// array of all search results
|
// array of all search results
|
||||||
const [searchResults, setSearchResults] = useState([]);
|
const [searchResults, setSearchResults] = useState([]);
|
||||||
// array of the topics the search results fall under
|
const [cookies, setCookie, ] = useCookies(["lightMode"]);
|
||||||
const [sectionResults, setSectionResults] = useState([]);
|
|
||||||
// eslint-disable-next-line
|
|
||||||
const [cookies, setCookie, removeCookie] = useCookies(["lightMode"]);
|
|
||||||
const [queries, setQueries] = useState({ lang: "", subject: "" });
|
const [queries, setQueries] = useState({ lang: "", subject: "" });
|
||||||
|
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { useState, useEffect } from "react";
|
import { useState, useEffect } from "react";
|
||||||
const queryString = require("query-string");
|
import queryString from "query-string";
|
||||||
|
|
||||||
function LangFilters({ changeParameter, data, langCode }) {
|
function LangFilters({ changeParameter, data, langCode }) {
|
||||||
const [languages, setLanguages] = useState([]);
|
const [languages, setLanguages] = useState([]);
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
import ReactMarkdown from "react-markdown";
|
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
|
|
||||||
|
import ReactMarkdown from "react-markdown";
|
||||||
import rehypeSlug from "rehype-slug";
|
import rehypeSlug from "rehype-slug";
|
||||||
import rehypeRaw from "rehype-raw";
|
import rehypeRaw from "rehype-raw";
|
||||||
|
|
||||||
import ParsedLink from "./ParsedLink";
|
import ParsedLink from "./ParsedLink";
|
||||||
|
|
||||||
function MarkdownParser({ file, sect }) {
|
function MarkdownParser({ file, sect }) {
|
||||||
|
@ -58,7 +60,7 @@ function MarkdownParser({ file, sect }) {
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return <ParsedLink node={node} children={children} className={className} sect={sect} props={props} />;
|
return <ParsedLink children={children} className={className} sect={sect} props={props} />;
|
||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import React, { useState, useEffect } from "react";
|
import React, { useState, useEffect } from "react";
|
||||||
|
|
||||||
function ParsedLink({ node, children, className, sect, props }) {
|
function ParsedLink({ children, sect, props }) {
|
||||||
const [folder, setFolder] = useState(null);
|
const [folder, setFolder] = useState(null);
|
||||||
const [file, setFile] = useState(null);
|
const [file, setFile] = useState(null);
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ function ParsedLink({ node, children, className, sect, props }) {
|
||||||
// If there is only one entry then the folder is the root directory and the entry is the file
|
// If there is only one entry then the folder is the root directory and the entry is the file
|
||||||
let hrefSplit = props.href.split("/");
|
let hrefSplit = props.href.split("/");
|
||||||
|
|
||||||
if (hrefSplit.length == 2) {
|
if (hrefSplit.length === 2) {
|
||||||
// Case when the
|
// Case when the
|
||||||
// Some docs reference back to the root directory which would give the folder ".."
|
// Some docs reference back to the root directory which would give the folder ".."
|
||||||
// When that happens, skip setting the folder as it should stay null.
|
// When that happens, skip setting the folder as it should stay null.
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
import React, {useEffect} from "react";
|
import React, {useEffect} from "react";
|
||||||
const queryString = require("query-string");
|
|
||||||
|
|
||||||
function SearchBar(props) {
|
function SearchBar(props) {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
|
Loading…
Reference in New Issue