Skip to content

Commit

Permalink
Merge pull request #3 from priyanshtiwari001/dynamic-input
Browse files Browse the repository at this point in the history
added dynamic-input
  • Loading branch information
siiddhantt authored Oct 15, 2023
2 parents 6332d44 + 9b1db22 commit 3fa826a
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/components/Home.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useState } from "react";
import { useState, useEffect } from "react";
import { TypeAnimation } from "react-type-animation";
import { TTS_API } from "../api";

Expand Down Expand Up @@ -28,6 +28,24 @@ function Home() {
console.error("An error occurred:", error);
}
};

useEffect(() => {
adjustWidth();
});

const adjustWidth = () => {
if (flag) {
const inputField = document.querySelector(".name-field");
let width = name.length;
console.log(width);
if (width < 1) {
inputField.style.width = "initail";
} else {
inputField.style.width = width + "ch";
}
}
};

return (
<>
<div className="head">
Expand Down

0 comments on commit 3fa826a

Please sign in to comment.