@djangocfg/layouts 2.1.268 → 2.1.271

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@djangocfg/layouts",
3
- "version": "2.1.268",
3
+ "version": "2.1.271",
4
4
  "description": "Simple, straightforward layout components for Next.js - import and use with props",
5
5
  "keywords": [
6
6
  "layouts",
@@ -74,14 +74,14 @@
74
74
  "check": "tsc --noEmit"
75
75
  },
76
76
  "peerDependencies": {
77
- "@djangocfg/api": "^2.1.268",
78
- "@djangocfg/centrifugo": "^2.1.268",
79
- "@djangocfg/debuger": "^2.1.268",
80
- "@djangocfg/i18n": "^2.1.268",
81
- "@djangocfg/monitor": "^2.1.268",
82
- "@djangocfg/ui-core": "^2.1.268",
83
- "@djangocfg/ui-nextjs": "^2.1.268",
84
- "@djangocfg/ui-tools": "^2.1.268",
77
+ "@djangocfg/api": "^2.1.271",
78
+ "@djangocfg/centrifugo": "^2.1.271",
79
+ "@djangocfg/debuger": "^2.1.271",
80
+ "@djangocfg/i18n": "^2.1.271",
81
+ "@djangocfg/monitor": "^2.1.271",
82
+ "@djangocfg/ui-core": "^2.1.271",
83
+ "@djangocfg/ui-nextjs": "^2.1.271",
84
+ "@djangocfg/ui-tools": "^2.1.271",
85
85
  "@hookform/resolvers": "^5.2.2",
86
86
  "consola": "^3.4.2",
87
87
  "lucide-react": "^0.545.0",
@@ -110,15 +110,15 @@
110
110
  "uuid": "^11.1.0"
111
111
  },
112
112
  "devDependencies": {
113
- "@djangocfg/api": "^2.1.268",
114
- "@djangocfg/centrifugo": "^2.1.268",
115
- "@djangocfg/debuger": "^2.1.268",
116
- "@djangocfg/i18n": "^2.1.268",
117
- "@djangocfg/monitor": "^2.1.268",
118
- "@djangocfg/typescript-config": "^2.1.268",
119
- "@djangocfg/ui-core": "^2.1.268",
120
- "@djangocfg/ui-nextjs": "^2.1.268",
121
- "@djangocfg/ui-tools": "^2.1.268",
113
+ "@djangocfg/api": "^2.1.271",
114
+ "@djangocfg/centrifugo": "^2.1.271",
115
+ "@djangocfg/debuger": "^2.1.271",
116
+ "@djangocfg/i18n": "^2.1.271",
117
+ "@djangocfg/monitor": "^2.1.271",
118
+ "@djangocfg/typescript-config": "^2.1.271",
119
+ "@djangocfg/ui-core": "^2.1.271",
120
+ "@djangocfg/ui-nextjs": "^2.1.271",
121
+ "@djangocfg/ui-tools": "^2.1.271",
122
122
  "@types/node": "^24.7.2",
123
123
  "@types/react": "^19.1.0",
124
124
  "@types/react-dom": "^19.1.0",
@@ -0,0 +1,48 @@
1
+ 'use client';
2
+
3
+ import React from 'react';
4
+
5
+ import {
6
+ Avatar,
7
+ AvatarFallback,
8
+ AvatarImage,
9
+ } from '@djangocfg/ui-core/components';
10
+ import { cn } from '@djangocfg/ui-core/lib';
11
+
12
+ export interface UserAvatarProps {
13
+ src?: string;
14
+ name: string;
15
+ /** 'sm' = 32px (navbar), 'md' = 44px (drawer header). Defaults to 'sm'. */
16
+ size?: 'sm' | 'md';
17
+ className?: string;
18
+ }
19
+
20
+ const SIZE = {
21
+ sm: { avatar: 'h-8 w-8', text: 'text-sm' },
22
+ md: { avatar: 'h-11 w-11', text: 'text-base' },
23
+ } as const;
24
+
25
+ export function UserAvatar({ src, name, size = 'sm', className }: UserAvatarProps) {
26
+ const initial = name.charAt(0).toUpperCase();
27
+ const s = SIZE[size];
28
+
29
+ return (
30
+ <Avatar
31
+ className={cn(
32
+ s.avatar,
33
+ 'ring-2 ring-border/60 hover:ring-primary/70 transition-all shrink-0',
34
+ className,
35
+ )}
36
+ >
37
+ <AvatarImage src={src} alt={name} />
38
+ <AvatarFallback
39
+ className={cn(
40
+ 'bg-primary text-primary-foreground font-semibold',
41
+ s.text,
42
+ )}
43
+ >
44
+ {initial}
45
+ </AvatarFallback>
46
+ </Avatar>
47
+ );
48
+ }
@@ -39,9 +39,6 @@ import { useAppT } from '@djangocfg/i18n';
39
39
 
40
40
  import { useLogout } from '../../hooks';
41
41
  import {
42
- Avatar,
43
- AvatarFallback,
44
- AvatarImage,
45
42
  Button,
46
43
  DropdownMenu,
47
44
  DropdownMenuContent,
@@ -57,6 +54,7 @@ import {
57
54
  } from '@djangocfg/ui-core/components';
58
55
 
59
56
  import { LOCALE_LABELS } from './LocaleSwitcher';
57
+ import { UserAvatar } from './UserAvatar';
60
58
 
61
59
  import type { UserMenuGroup, UserMenuLocaleConfig } from '../types';
62
60
 
@@ -163,13 +161,10 @@ export function UserMenu({
163
161
  if (variant === 'mobile') {
164
162
  return (
165
163
  <div className="space-y-3">
166
- <div className="flex items-center gap-3 px-4 py-3">
167
- <Avatar className="h-10 w-10">
168
- <AvatarImage src={userAvatar} alt={displayName} />
169
- <AvatarFallback>{userInitial}</AvatarFallback>
170
- </Avatar>
164
+ <div className="flex items-center gap-3 px-4 py-3 rounded-xl bg-accent/30">
165
+ <UserAvatar src={userAvatar} name={displayName} size="md" />
171
166
  <div className="flex-1 min-w-0">
172
- <p className="text-sm font-medium text-foreground truncate">
167
+ <p className="text-sm font-semibold text-foreground truncate">
173
168
  {displayName}
174
169
  </p>
175
170
  <p className="text-xs text-muted-foreground truncate">
@@ -269,11 +264,8 @@ export function UserMenu({
269
264
  return (
270
265
  <DropdownMenu>
271
266
  <DropdownMenuTrigger asChild>
272
- <Button variant="ghost" size="icon" className="rounded-full">
273
- <Avatar className="h-8 w-8">
274
- <AvatarImage src={userAvatar} alt={displayName} />
275
- <AvatarFallback>{userInitial}</AvatarFallback>
276
- </Avatar>
267
+ <Button variant="ghost" size="icon" className="rounded-full p-0">
268
+ <UserAvatar src={userAvatar} name={displayName} size="sm" />
277
269
  <span className="sr-only">{labels.userMenu}</span>
278
270
  </Button>
279
271
  </DropdownMenuTrigger>
@@ -8,3 +8,6 @@ export type { LocaleSwitcherProps } from './LocaleSwitcher';
8
8
  export { UserMenu } from './UserMenu';
9
9
  export type { UserMenuProps } from './UserMenu';
10
10
 
11
+ export { UserAvatar } from './UserAvatar';
12
+ export type { UserAvatarProps } from './UserAvatar';
13
+