-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from n0rrman/dev
new commands & code refactor
- Loading branch information
Showing
13 changed files
with
228 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
export enum ActionCode { | ||
NOOP = "noop", | ||
CLEAR = "clear", | ||
REDIRECT = "redirect", | ||
ERROR = "error", | ||
EXIT = "exit", | ||
HELP = "help", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
[ | ||
{ | ||
"cmd": "whoami", | ||
"value": "Hello, World! 👋 I'm \n \n █████ █████ ███ █████ \n░░███ ░░███ ░░░ ░░███ \n ░███ ░███ ██████ ████████ ████████ ████ ░███ █████ \n ░███████████ ███░░███░░███░░███ ░░███░░███░░███ ░███░░███ \n ░███░░░░░███ ░███████ ░███ ░███ ░███ ░░░ ░███ ░██████░ \n ░███ ░███ ░███░░░ ░███ ░███ ░███ ░███ ░███░░███ \n █████ █████░░██████ ████ █████ █████ █████ ████ █████ \n░░░░░ ░░░░░ ░░░░░░ ░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░░ ░░░░░ \n \n ██████ █████ \n░░██████ ░░███ \n ░███░███ ░███ ██████ ████████ ████████ █████████████ ██████ ████████ \n ░███░░███░███ ███░░███░░███░░███░░███░░███░░███░░███░░███ ░░░░░███ ░░███░░███ \n ░███ ░░██████ ░███ ░███ ░███ ░░░ ░███ ░░░ ░███ ░███ ░███ ███████ ░███ ░███ \n ░███ ░░█████ ░███ ░███ ░███ ░███ ░███ ░███ ░███ ███░░███ ░███ ░███ \n █████ ░░█████░░██████ █████ █████ █████░███ █████░░████████ ████ █████\n░░░░░ ░░░░░ ░░░░░░ ░░░░░ ░░░░░ ░░░░░ ░░░ ░░░░░ ░░░░░░░░ ░░░░ ░░░░░ \n \na software engineer based in Stockholm, Sweden 🇸🇪 \n", | ||
"actionCode": "noop" | ||
}, | ||
{ | ||
"cmd": "clear", | ||
"value": "Clearning terminal...", | ||
"actionCode": "clear" | ||
}, | ||
{ | ||
"cmd": "github", | ||
"value": "https://github.com/n0rrman", | ||
"actionCode": "redirect" | ||
}, | ||
{ | ||
"cmd": "source code", | ||
"value": "https://github.com/n0rrman/henriknorrman.com", | ||
"actionCode": "redirect" | ||
}, | ||
{ | ||
"cmd": "exit", | ||
"value": "\nSaving session...completed.", | ||
"actionCode": "exit" | ||
}, | ||
{ | ||
"cmd": "help", | ||
"value": "These shell commands are defined internally. Type `help' to see this list.\n\twhoami\t\t\tdisplay effective user\n\tclear\t\t\tclear the terminal screen\n\tgithub\t\t\topen my github\n\tsource code\t\topen the source code repository\n\thelp\t\t\tlist available commands\n\texit\t\t\texit the terminal", | ||
"actionCode": "help" | ||
} | ||
] |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,15 @@ | ||
import Image from "next/image"; | ||
|
||
import background from "/public/background.svg"; | ||
import logo from "/public/logo.svg"; | ||
import Terminal from "@/components/terminal"; | ||
|
||
export default function LandingPage() { | ||
return ( | ||
<div className="flex flex-col gap-5 justify-start items-center bg-blue-100"> | ||
<div className="relative w-52 h-52"> | ||
<Image src={logo.src} fill alt="" priority loading="eager" /> | ||
</div> | ||
<div className="absolute inset-0 w-full z-0"> | ||
{/* <div className="h-[200vh] w-full relative opacity-75"> | ||
<Image src={background} fill alt="" /> | ||
</div> */} | ||
</div> | ||
<div className="z-50"> | ||
<Terminal /> | ||
<div className="flex flex-col items-center justify-start bg-gradient-to-b from-blue-100 to-slate-300 w-full min-h-[70vh]"> | ||
<div className="relative w-48 h-48 select-none pointer-events-none"> | ||
<Image src={logo} fill alt="" priority loading="eager" /> | ||
</div> | ||
<Terminal /> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
import Image from "next/image"; | ||
|
||
import screenImg from "/public/screen.svg"; | ||
import { courier } from "../app/fonts"; | ||
import { CommandAction } from "@/actions"; | ||
|
||
interface TerminalScreenProps { | ||
prompt: React.ReactElement; | ||
outputs: CommandAction[]; | ||
inputRef: React.RefObject<HTMLInputElement>; | ||
formRef: React.RefObject<HTMLFormElement>; | ||
submitHandler: (event: React.FormEvent<HTMLFormElement>) => void; | ||
} | ||
|
||
export default function TerminalScreen({ | ||
prompt, | ||
outputs, | ||
inputRef, | ||
formRef, | ||
submitHandler, | ||
}: TerminalScreenProps) { | ||
const renderedOutputs = outputs.map( | ||
({ id, input, output }: CommandAction) => { | ||
return ( | ||
<div | ||
className={`flex flex-col gap-y-0.5 font-thin ${courier.className}`} | ||
key={id} | ||
> | ||
<p> | ||
{prompt} | ||
{input} | ||
</p> | ||
{output !== "" && <p className="">{output}</p>} | ||
</div> | ||
); | ||
} | ||
); | ||
|
||
return ( | ||
<div | ||
className="flex justify-center items-center text-[1.77vw] sm:text-xs lg:text-sm w-full py-0 sm:py-7" | ||
onClick={() => { | ||
inputRef!.current!.focus(); | ||
}} | ||
> | ||
<div className="flex z-50 justify-center items-center absolute overflow-hidden pointer-events-none"> | ||
<div className="hidden sm:block relative w-[93.5ch] aspect-[1.25] pointer-events-none select-none"> | ||
<Image alt="" src={screenImg} fill></Image> | ||
</div> | ||
</div> | ||
<div | ||
className={`${courier.className} z-40 px-[1.5ch] py-[0.5ch] mb-[13ch] bg-slate-800 text-slate-200 flex items-end w-full sm:w-[90ch] leading-snug tracking-wide overflow-hidden h-[57ch]`} | ||
> | ||
<form ref={formRef} onSubmit={submitHandler} className="select-text"> | ||
<pre className="space-y-[0.25ch]">{renderedOutputs}</pre> | ||
<div className="flex flex-row items-end justify-start"> | ||
{prompt} | ||
<input | ||
ref={inputRef} | ||
className="bg-transparent w-[67ch] outline-none mt-[0.25ch]" | ||
name="cmd" | ||
type="text" | ||
/> | ||
</div> | ||
</form> | ||
</div> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.