mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 12:24:18 +00:00
.vscode
assets
components
auth
cart
common
Avatar
Avatar.tsx
index.ts
FeatureBar
Footer
Head
HomeAllProductsGrid
I18nWidget
Layout
Navbar
Searchbar
UserNav
index.ts
icons
product
ui
wishlist
config
docs
framework
lib
pages
public
.editorconfig
.env.template
.gitignore
.prettierignore
.prettierrc
README.md
codegen.json
commerce.config.json
global.d.ts
license.md
next-env.d.ts
next.config.js
package.json
postcss.config.js
tailwind.config.js
tsconfig.json
yarn.lock
* userAvatar * Avatar background * Changes * Removing unused dependencies * Count Bag small and for bigger numbers * decresed bundle size
25 lines
674 B
TypeScript
25 lines
674 B
TypeScript
import { FC, useRef, useEffect } from 'react'
|
|
import { useUserAvatar } from '@lib/hooks/useUserAvatar'
|
|
|
|
interface Props {
|
|
className?: string
|
|
children?: any
|
|
}
|
|
|
|
const Avatar: FC<Props> = ({}) => {
|
|
let ref = useRef() as React.MutableRefObject<HTMLInputElement>
|
|
let { userAvatar } = useUserAvatar()
|
|
|
|
return (
|
|
<div
|
|
ref={ref}
|
|
style={{ backgroundImage: userAvatar }}
|
|
className="inline-block h-8 w-8 rounded-full border-2 border-primary hover:border-secondary focus:border-secondary transition linear-out duration-150"
|
|
>
|
|
{/* Add an image - We're generating a gradient as placeholder <img></img> */}
|
|
</div>
|
|
)
|
|
}
|
|
|
|
export default Avatar
|