1
mirror of https://github.com/jakejarvis/jarv.is.git synced 2026-01-11 03:22:57 -05:00

extract fake DOS terminal into a separate component

This commit is contained in:
2022-01-31 15:47:54 -05:00
parent 7933c9ba02
commit 2e65d0ef4a
5 changed files with 74 additions and 44 deletions

View File

@@ -0,0 +1,28 @@
.terminal {
width: 100%;
height: 100%;
padding: 1em;
background-color: #000000;
color: #cccccc;
font-size: 0.925em;
font-weight: 500;
line-height: 2;
white-space: pre-wrap;
user-select: none;
}
.blink {
display: inline-block;
vertical-align: text-bottom;
width: 10px;
border-bottom: 2px solid #cccccc;
animation: blink 1s step-end infinite;
}
@keyframes blink {
50% {
opacity: 0;
}
}

View File

@@ -0,0 +1,18 @@
import { forwardRef } from "react";
import classNames from "classnames";
import type { Ref, HTMLAttributes } from "react";
import styles from "./Terminal.module.css";
type Props = HTMLAttributes<HTMLDivElement>;
// a DOS-style terminal box with dynamic text
const Terminal = forwardRef(function Terminal({ className, ...rest }: Props, ref: Ref<HTMLSpanElement>) {
return (
<div className={classNames("monospace", className, styles.terminal)} {...rest}>
<span ref={ref} /> <span className={styles.blink} />
</div>
);
});
export default Terminal;