avatar component

This commit is contained in:
Ishaan Dey 2024-04-30 23:34:44 -04:00
parent 260de4f3b5
commit ed23617b23
3 changed files with 28 additions and 3 deletions

View File

@ -11,6 +11,7 @@ import {
import Image from "next/image" import Image from "next/image"
import Button from "../ui/customButton" import Button from "../ui/customButton"
import { ChevronRight } from "lucide-react" import { ChevronRight } from "lucide-react"
import Avatar from "../ui/avatar"
export default function DashboardSharedWithMe({ export default function DashboardSharedWithMe({
sandboxes, sandboxes,
@ -51,7 +52,7 @@ export default function DashboardSharedWithMe({
</TableCell> </TableCell>
<TableCell> <TableCell>
<div className="flex items-center"> <div className="flex items-center">
<div className="h-5 w-5 bg-red-500 rounded-full mr-2" /> <Avatar name="Ishaan Dey" className="mr-2" />
Ishaan Dey Ishaan Dey
</div> </div>
</TableCell> </TableCell>

View File

@ -33,6 +33,7 @@ import { Loader2, UserPlus, X } from "lucide-react"
import { useState } from "react" import { useState } from "react"
import { Sandbox } from "@/lib/types" import { Sandbox } from "@/lib/types"
import { Button } from "@/components/ui/button" import { Button } from "@/components/ui/button"
import Avatar from "@/components/ui/avatar"
const formSchema = z.object({ const formSchema = z.object({
email: z.string().email(), email: z.string().email(),
@ -107,12 +108,12 @@ export default function ShareSandboxModal({
<div className="w-full h-[1px] bg-border" /> <div className="w-full h-[1px] bg-border" />
<div className="p-6 pt-3"> <div className="p-6 pt-3">
<DialogHeader className="mb-6"> <DialogHeader className="mb-6">
<DialogTitle>Share Sandbox</DialogTitle> <DialogTitle>Manage Access</DialogTitle>
</DialogHeader> </DialogHeader>
<div className="space-y-2"> <div className="space-y-2">
<div className="flex items-center justify-between"> <div className="flex items-center justify-between">
<div className="flex items-center"> <div className="flex items-center">
<div className="h-5 w-5 bg-red-500 rounded-full mr-2" /> <Avatar name="Ishaan Dey" className="mr-2" />
Ishaan Dey Ishaan Dey
</div> </div>
<Button variant="ghost" size="smIcon"> <Button variant="ghost" size="smIcon">

View File

@ -0,0 +1,23 @@
import { cn } from "@/lib/utils"
export default function Avatar({
name,
className,
}: {
name: string
className?: string
}) {
return (
<div
className={cn(
className,
"w-5 h-5 font-mono rounded-full overflow-hidden bg-gradient-to-t from-neutral-800 to-neutral-600 flex items-center justify-center text-[0.5rem] font-medium"
)}
>
{name
.split(" ")
.slice(0, 2)
.map((letter) => letter[0].toUpperCase())}
</div>
)
}