Skip to content

Commit

Permalink
fixed cursor
Browse files Browse the repository at this point in the history
  • Loading branch information
BergerAPI committed Apr 12, 2021
1 parent 9dec2de commit 57e2af2
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions components/input/Input.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,19 +292,25 @@ export class Input extends React.Component {
let remaining = [];

for (let i = 0; i < this.state.fullText.length; i++)
remaining.push(
<a className={styles.remaining}>{this.state.remainingText[i]}</a>
);
if (i !== 0)
remaining.push(
<a className={styles.remaining}>{this.state.remainingText[i]}</a>
);
else
remaining.push(
<a
style={{ "background-color": "rgb(100, 100, 100)" }}
className={styles.remaining}
>
{this.state.remainingText[i]}
</a>
);

for (let i = 0; i < this.state.typedText.length; i++) {
let value = this.state.typedText[i];
if (value !== this.state.fullText[i])
typed.push(<a className={styles.wrong}>{this.state.fullText[i]}</a>);
else {
if (this.state.index - 1 === i)
typed.push(<a style={{ "background-color": "grey" }}>{value}</a>);
else typed.push(<a>{value}</a>);
}
else typed.push(<a>{value}</a>);
}

return (
Expand Down

1 comment on commit 57e2af2

@vercel
Copy link

@vercel vercel bot commented on 57e2af2 Apr 12, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.