feat(SW-184): added main components for new header

This commit is contained in:
Erik Tiekstra
2024-08-19 12:52:35 +02:00
parent 70297bec91
commit 08cde7ae2f
31 changed files with 548 additions and 26 deletions

View File

@@ -0,0 +1,16 @@
.avatar {
display: flex;
justify-content: center;
align-items: center;
overflow: hidden;
border-radius: 50%;
width: 2rem;
height: 2rem;
background-color: var(--Main-Grey-40);
}
.initials {
font-size: 0.75rem;
color: var(--Base-Text-Inverted);
background-color: var(--Scandic-Peach-70);
}

View File

@@ -0,0 +1,6 @@
import { ImageProps } from "next/image"
export interface AvatarProps {
image?: ImageProps
initials?: string
}

View File

@@ -0,0 +1,19 @@
import { PersonIcon } from "@/components/Icons"
import Image from "@/components/Image"
import { AvatarProps } from "./avatar"
import styles from "./avatar.module.css"
export default function Avatar({ image, initials }: AvatarProps) {
let classNames = [styles.avatar]
let element = <PersonIcon color="white" />
if (image) {
classNames.push(styles.image)
element = <Image src={image.src} alt={image.alt} width={28} height={28} />
} else if (initials) {
classNames.push(styles.initials)
element = <span>{initials}</span>
}
return <span className={classNames.join(" ")}>{element}</span>
}