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:
28
components/Terminal/Terminal.module.css
Normal file
28
components/Terminal/Terminal.module.css
Normal 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;
|
||||
}
|
||||
}
|
||||
18
components/Terminal/Terminal.tsx
Normal file
18
components/Terminal/Terminal.tsx
Normal 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;
|
||||
Reference in New Issue
Block a user