-
Notifications
You must be signed in to change notification settings - Fork 487
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Integrate chat with completions and history
- Loading branch information
Showing
10 changed files
with
504 additions
and
479 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,19 @@ | ||
import { FC } from "react" | ||
|
||
const Avatar: FC = () => { | ||
return <div className="bg-red-500 rounded h-8 w-8"></div> | ||
interface Props { | ||
name: string | ||
} | ||
|
||
const Avatar: FC<Props> = ({name}) => { | ||
const colors = ["pink", "purple", "red", "yellow", "blue", "gray", "green", "indigo"]; | ||
const hashCode = (s:string) => s.split('').reduce((a,b) => (((a << 5) - a) + b.charCodeAt(0))|0, 0); | ||
const color = colors[hashCode(name) % colors.length]; | ||
return ( | ||
<div | ||
className={`bg-${color}-500 rounded h-8 w-8 flex-shrink-0`} | ||
title={name} | ||
/> | ||
) | ||
} | ||
|
||
export default Avatar |
Oops, something went wrong.