From a9d7f5c7cea2a8ba4f75fa49ba9d0f41c38fa6e1 Mon Sep 17 00:00:00 2001 From: r-freeman Date: Wed, 15 Feb 2023 20:28:09 +0000 Subject: [PATCH] Extracted avatar component --- components/Header.tsx | 37 +------------------------------------ components/ui/Avatar.tsx | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 36 deletions(-) create mode 100644 components/ui/Avatar.tsx diff --git a/components/Header.tsx b/components/Header.tsx index b9edc8d..4d5d1b6 100644 --- a/components/Header.tsx +++ b/components/Header.tsx @@ -1,4 +1,3 @@ -import Image from 'next/image' import Link from 'next/link' import {usePathname} from 'next/navigation' import {Fragment, useEffect, useRef} from 'react' @@ -6,11 +5,11 @@ import {Popover, Transition} from '@headlessui/react' import clsx from 'clsx' import {Container} from './Container' import {MobileNavItem} from './ui/MobileNavItem' +import {Avatar, AvatarContainer} from './ui/Avatar' import {CloseIcon} from './icons/CloseIcon' import {ChevronDownIcon} from './icons/ChevronDownIcon' import {MoonIcon} from './icons/MoonIcon' import {SunIcon} from './icons/SunIcon' -import avatar from '@/public/static/images/avatar.jpg' import type {Props} from 'types' function MobileNavigation(props: Props) { @@ -152,40 +151,6 @@ function clamp(num: number, a: number, b: number) { return Math.min(Math.max(num, min), max) } -function AvatarContainer({className, ...props}: { style?: Object } & Props) { - return ( -
- ) -} - -function Avatar({large = false, className, ...props}: { large?: boolean, style?: Object } & Props) { - return ( - - - - ) -} - export function Header() { const isHomePage = usePathname() === '/' diff --git a/components/ui/Avatar.tsx b/components/ui/Avatar.tsx new file mode 100644 index 0000000..6320932 --- /dev/null +++ b/components/ui/Avatar.tsx @@ -0,0 +1,39 @@ +import {Props} from '@/types' +import clsx from 'clsx' +import Link from 'next/link' +import Image from 'next/image' +import avatar from '@/public/static/images/avatar.jpg' + +export function AvatarContainer({className, ...props}: { style?: Object } & Props) { + return ( +
+ ) +} + +export function Avatar({large = false, className, ...props}: { large?: boolean, style?: Object } & Props) { + return ( + + + + ) +} \ No newline at end of file