Skip to content

Commit

Permalink
Add loader
Browse files Browse the repository at this point in the history
  • Loading branch information
fjosue4 committed Jan 24, 2024
1 parent 3503e53 commit e39686a
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/components/LoadingLine/LoadingLine.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
.loader-line {
width: 40%;
min-height: 3px;
max-height: 3px;
position: relative;
overflow: hidden;
background-color: #fff;
margin: auto;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;

&:before {
content: "";
position: absolute;
left: -50%;
height: 3px;
width: 40%;
background-color: #096EFF;
-webkit-animation: lineAnim 1s linear infinite;
-moz-animation: lineAnim 1s linear infinite;
animation: lineAnim 1s linear infinite;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
}
}

@keyframes lineAnim {
0% {
left: -40%;
}

50% {
left: 20%;
width: 80%;
}

100% {
left: 100%;
width: 100%;
}
}
9 changes: 9 additions & 0 deletions src/components/LoadingLine/LoadingLine.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import './LoadingLine.scss'

function LoadingLine() {
return (
<div className='loader-line'></div>
)
}

export default LoadingLine
1 change: 1 addition & 0 deletions src/components/LoadingLine/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { default } from './LoadingLine'
2 changes: 2 additions & 0 deletions src/pages/Chat/PromptGenerator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import ReactMarkdown from 'react-markdown'
import Button from '@components/Button'
import { usePromptGenerator } from './hooks'
import { useRef, useEffect } from 'react'
import LoadingLine from '@components/LoadingLine'

function PromptGenerator() {
const { handlePromptChange, handleSendPrompt, handleKeyDown, data, prompt, textareaRef, loading } = usePromptGenerator()
Expand All @@ -28,6 +29,7 @@ function PromptGenerator() {
)}
</div>
))}
{loading && <LoadingLine />}
</div>
<div className='message-input-container'>
<textarea
Expand Down

0 comments on commit e39686a

Please sign in to comment.