Skip to content

Commit

Permalink
typewriter-component-V1
Browse files Browse the repository at this point in the history
  • Loading branch information
AB10110F committed Jul 19, 2023
1 parent 00cae22 commit 57ddd37
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 11 deletions.
3 changes: 1 addition & 2 deletions src/app/page.module.css
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
.main {
display: flex;
flex-direction: column;
justify-content: space-between;
justify-content: space-around;
align-items: center;
padding: 4rem;
min-height: 100vh;
font-size: 50px;
color: white;
Expand Down
3 changes: 2 additions & 1 deletion src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@ import Image from 'next/image'
import styles from './page.module.css'
import { Metadata } from 'next'
import Terminal from '@/components/Terminal'
import Typewriter from '@/components/Typewriter'
import localFont from 'next/font/local'

const dotFont = localFont({ src: './e-dot-digital-7.ttf' })

export default function Home() {
return (
<main className={styles.main}>
<h1 className={dotFont.className}>Front-End Developer</h1>
<Typewriter text={' Front-End Developer'}/> {/* TODO What is wrong with the position 1? */}
<Terminal/>
</main>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/Dots.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const Dots = () => {

useEffect(() => {
const dotSize:number = 4;
const spacing:number = dotSize * 8;
const spacing:number = dotSize * 10;
const minTvalue:number = 50;
const areaAffected:number = 50;
let mouseIsMoving:boolean = false;
Expand Down
10 changes: 5 additions & 5 deletions src/components/Terminal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ const Terminal = () => {
"",
"You can also check my social media:",
"",
"GitHub: AB10110F CodePen: AB10110F",
"Twitter: AB10110F Reddit: AB10110F",
"GitHub CodePen",
"Twitter Reddit",
"",
"Type \"help\" to view the available commands"
]
Expand All @@ -34,11 +34,11 @@ const Terminal = () => {
]

const skills = [
"CSS [██████████████████▁▁▁▁▁▁] C++ [████████████████████▁▁▁▁]",
"CSS [██████████████████▁▁▁▁▁▁] C++ [████████████████████▁▁▁▁]",
"",
"Typescript [█████████████▁▁▁▁▁▁▁▁▁▁] PHP [██████████████▁▁▁▁▁▁▁▁▁]",
"Typescript [█████████████▁▁▁▁▁▁▁▁▁▁] PHP [██████████████▁▁▁▁▁▁▁▁▁]",
"",
"React [███████████▁▁▁▁▁▁▁▁▁▁▁▁] Git [██████████████████▁▁▁▁▁▁]",
"React [███████████▁▁▁▁▁▁▁▁▁▁▁▁] Git [██████████████████▁▁▁▁▁▁]",

]

Expand Down
21 changes: 21 additions & 0 deletions src/components/Typewriter.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"use client"
import React, {useState, useEffect, useRef} from 'react';
import localFont from 'next/font/local'

const dotFont = localFont({ src: '../app/e-dot-digital-7.ttf' })

const Typewriter = ({ text }: { text:string }) => {
const index = useRef(0);
const [currentText, setCurrentText] = useState('');

useEffect(()=>{
setTimeout(()=>{
setCurrentText((value) => value + text.charAt(index.current));
index.current++;
}, 80);
}, [currentText]);

return <h1 className={dotFont.className}>&gt;{currentText}|</h1>
};

export default Typewriter;
4 changes: 2 additions & 2 deletions src/css/terminal.module.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
.terminal
{
height: 400px;
width: 70%;
background-color: rgb(39, 39, 39);
width: 800px;
background-color: rgb(31, 31, 31);
color: white;
box-sizing: border-box;
font-size: 15px;
Expand Down

0 comments on commit 57ddd37

Please sign in to comment.