Skip to main content

bash窗口

typedjs首页效果

image-20250430205220526

reactjs

import React, { useState, useRef, useEffect, forwardRef, useImperativeHandle, useMemo } from "react";

import "./style.css";
import Typed from "typed.js";

export default function App() {
const typedInstance = useRef<Typed>(null);

useEffect(() => {
if (!typedInstance.current) {
typedInstance.current = new Typed("#typed", {
strings: ["Full stack developer", "Front-end developer", "React Developer"],
startDelay: 300,
typeSpeed: 80,
backSpeed: 80,
backDelay: 6000,
loop: true,
});
} else {
typedInstance.current.reset();
}

return () => {
if (typedInstance.current) typedInstance.current.destroy();
};
});

return (
<div className={["text-editor-wrap"].join(" ")}>
<div className={["title-bar"].join(" ")}>
<span className={["title"].join(" ")}>
typed.js — bash — 80x<span className={["terminal-height"].join(" ")}>10</span>
</span>
</div>
<div className={["text-body"].join(" ")}>
$ <span id="typed"></span>
</div>
</div>
);
}

style.css

.text-editor-wrap {
padding: 0;
display: block;
margin: auto;
min-width: 550px;
border-radius: 10px;
/* box-shadow: rgba(0, 0, 0, 0.8) 0px 20px 70px; */
clear: both;
overflow: hidden;
unicode-bidi: isolate;
transition: all 0.5s ease-out;
}

.title-bar {
padding: 5px 0;
font-family: "Lucida Grande", sans-serif;
font-size: 0.75em;
text-align: center;
text-shadow: rgba(255, 255, 255, 0.8) 0px 1px 0px;
background-color: #f8f8f8;
background-image: linear-gradient(top, #e8e8e8, #bcbbbc);
box-shadow: inset rgba(255, 255, 255, 0.7) 0px 1px 1px;
border-bottom: #6a6a6a 1px solid;
transition: all 0.5s ease-out;
}

.text-body {
min-height: 400px;
background-color: rgba(0, 0, 0, 0.85);
padding: 10px;
color: #f0f0f0;
text-shadow: #000 0px 1px 0px;
font-family: "Consolas", "Courier New", "Courier";
font-size: 1.45em;
line-height: 1.4em;
font-weight: 500;
text-align: left;
overflow: hidden;
transition: all 0.5s ease-out;
}

.typed-cursor {
opacity: 1;
font-weight: 100;
animation: blink 1.2s infinite;
}

@keyframes blink {
0% {
opacity: 1;
}
50% {
opacity: 0;
}
100% {
opacity: 1;
}
}