mirror of
https://github.com/dsoaress/link-free.git
synced 2026-08-16 22:46:04 +01:00
feat: add avatar component
This commit is contained in:
BIN
public/avatar.jpeg
Normal file
BIN
public/avatar.jpeg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 22 KiB |
11
src/components/Avatar/index.tsx
Normal file
11
src/components/Avatar/index.tsx
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
import { ImageProps } from 'next/image'
|
||||||
|
|
||||||
|
import { Wrapper } from './styles'
|
||||||
|
|
||||||
|
type AvatarProps = ImageProps & {
|
||||||
|
src?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
export function Avatar({ src, ...rest }: AvatarProps) {
|
||||||
|
return !!src ? <Wrapper src={src} width={84} height={84} quality={100} {...rest} /> : null
|
||||||
|
}
|
||||||
10
src/components/Avatar/styles.ts
Normal file
10
src/components/Avatar/styles.ts
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
import Image from 'next/image'
|
||||||
|
|
||||||
|
import { styled } from '../../styles/stitches.config'
|
||||||
|
|
||||||
|
export const Wrapper = styled(Image, {
|
||||||
|
borderRadius: '9999px',
|
||||||
|
objectFit: 'cover',
|
||||||
|
width: '84px',
|
||||||
|
height: '84px'
|
||||||
|
})
|
||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import { Avatar } from '../components/Avatar'
|
||||||
import { Button } from '../components/Button'
|
import { Button } from '../components/Button'
|
||||||
|
|
||||||
export default function Home() {
|
export default function Home() {
|
||||||
@@ -17,14 +18,20 @@ export default function Home() {
|
|||||||
]
|
]
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div
|
||||||
|
style={{
|
||||||
|
display: 'flex',
|
||||||
|
flexDirection: 'column',
|
||||||
|
alignItems: 'center',
|
||||||
|
height: '100vh',
|
||||||
|
gap: '1rem'
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<Avatar src="/avatar.jpeg" />
|
||||||
{links.map(link => (
|
{links.map(link => (
|
||||||
<>
|
<Button color="sky" schema="rounded" outline key={link.href}>
|
||||||
<Button color="sky" schema="rounded" outline key={link.href}>
|
{link.label}
|
||||||
{link.label}
|
</Button>
|
||||||
</Button>
|
|
||||||
<br />
|
|
||||||
</>
|
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user