Lint
This commit is contained in:
parent
d6bd11f65e
commit
92e32e0674
@ -1,7 +1,7 @@
|
|||||||
import type { NextPage } from "next";
|
import type { NextPage } from "next";
|
||||||
import React from "react"
|
import React from "react";
|
||||||
import { commandCompletion } from "../lib/commands"
|
import { commandCompletion } from "../lib/commands";
|
||||||
import styles from "../styles/REPLInput.module.css"
|
import styles from "../styles/REPLInput.module.css";
|
||||||
|
|
||||||
const REPLInput: NextPage = () => {
|
const REPLInput: NextPage = () => {
|
||||||
const typed = React.createRef<HTMLSpanElement>();
|
const typed = React.createRef<HTMLSpanElement>();
|
||||||
@ -14,7 +14,7 @@ const REPLInput: NextPage = () => {
|
|||||||
setCurrentCmd(suggest);
|
setCurrentCmd(suggest);
|
||||||
if (typed.current) typed.current.innerHTML = currentInput;
|
if (typed.current) typed.current.innerHTML = currentInput;
|
||||||
if (completion.current) completion.current.innerHTML = suggest.substring(currentInput.length);
|
if (completion.current) completion.current.innerHTML = suggest.substring(currentInput.length);
|
||||||
}
|
};
|
||||||
|
|
||||||
const tabComplete = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
const tabComplete = (e: React.KeyboardEvent<HTMLInputElement>) => {
|
||||||
if (e.key === "Tab" && currentCmd !== "") {
|
if (e.key === "Tab" && currentCmd !== "") {
|
||||||
@ -24,12 +24,12 @@ const REPLInput: NextPage = () => {
|
|||||||
if(completion.current) completion.current.innerHTML = "";
|
if(completion.current) completion.current.innerHTML = "";
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
};
|
||||||
|
|
||||||
return <div className={styles.wrapper}>
|
return <div className={styles.wrapper}>
|
||||||
<input className={styles.in} type={"text"} onChange={replinOnChange} onKeyDown={tabComplete} spellCheck={"false"} />
|
<input className={styles.in} type={"text"} onChange={replinOnChange} onKeyDown={tabComplete} spellCheck={"false"} />
|
||||||
<span className={styles.completionWrapper}><span ref={typed} className={styles.typed}></span><span ref={completion} className={styles.completion}></span></span>
|
<span className={styles.completionWrapper}><span ref={typed} className={styles.typed}></span><span ref={completion} className={styles.completion}></span></span>
|
||||||
</div>
|
</div>;
|
||||||
}
|
};
|
||||||
|
|
||||||
export default REPLInput;
|
export default REPLInput;
|
@ -1,4 +1,4 @@
|
|||||||
const commandList = ["about", "navigate", "external", "help", "ed", "nano"]
|
const commandList = ["about", "navigate", "external", "help", "ed", "nano"];
|
||||||
|
|
||||||
export function commandCompletion(input: string): string {
|
export function commandCompletion(input: string): string {
|
||||||
if (input === "") return "";
|
if (input === "") return "";
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
import type { AppProps } from 'next/app'
|
import type { AppProps } from "next/app";
|
||||||
import "../styles/globals.css"
|
import "../styles/globals.css";
|
||||||
|
|
||||||
function MyApp({ Component, pageProps }: AppProps) {
|
function MyApp({ Component, pageProps }: AppProps) {
|
||||||
return <Component {...pageProps} />
|
return <Component {...pageProps} />;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default MyApp
|
export default MyApp;
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||||
import type { NextApiRequest, NextApiResponse } from 'next'
|
import type { NextApiRequest, NextApiResponse } from "next";
|
||||||
|
|
||||||
type Data = {
|
type Data = {
|
||||||
name: string
|
name: string
|
||||||
@ -9,5 +9,5 @@ export default function handler(
|
|||||||
req: NextApiRequest,
|
req: NextApiRequest,
|
||||||
res: NextApiResponse<Data>
|
res: NextApiResponse<Data>
|
||||||
) {
|
) {
|
||||||
res.status(200).json({ name: 'John Doe' })
|
res.status(200).json({ name: "John Doe" });
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
import type { NextPage } from 'next'
|
import type { NextPage } from "next";
|
||||||
import REPLInput from '../components/REPLInput'
|
import REPLInput from "../components/REPLInput";
|
||||||
|
|
||||||
const Home: NextPage = () => {
|
const Home: NextPage = () => {
|
||||||
return (
|
return (
|
||||||
<REPLInput />
|
<REPLInput />
|
||||||
)
|
);
|
||||||
}
|
};
|
||||||
|
|
||||||
export default Home
|
export default Home;
|
||||||
|
Loading…
Reference in New Issue
Block a user