@@ -4,142 +4,104 @@ import { useLocation } from "@reach/router";
4
4
import { SistentLayout } from "../../sistent-layout" ;
5
5
import TabButton from "../../../../../reusecore/Button" ;
6
6
7
-
8
7
const Guidance = ( ) => {
9
8
const location = useLocation ( ) ;
10
9
10
+ const tabs = [
11
+ { title : "Overview" , path : "/projects/sistent/components/avatar/overview" } ,
12
+ { title : "Guidance" , path : "/projects/sistent/components/avatar/guidance" } ,
13
+ { title : "Code" , path : "/projects/sistent/components/avatar/code" }
14
+ ] ;
11
15
12
16
return (
13
17
< SistentLayout title = "Avatar" >
14
18
< div className = "content" >
15
- < a id = "identity" >
16
- < h2 > Avatar Usage Guidelines</ h2 >
17
- </ a >
19
+ < h2 id = "identity" > Avatar Usage Guidelines</ h2 >
18
20
< p >
19
- The Avatar component represents a user using an image, initials, or an icon.
20
- It is a crucial UI element for providing visual identity across digital platforms.
21
+ The Avatar component visually represents a user through an image, initials, or an icon.
22
+ It enhances recognition and identity across digital platforms.
21
23
</ p >
22
24
23
-
24
25
< div className = "filterBtns" >
25
- < TabButton
26
- className = { location . pathname === "/projects/sistent/components/avatar/overview" ? "active" : "" }
27
- onClick = { ( ) => navigate ( "/projects/sistent/components/avatar/overview" ) }
28
- title = "Overview"
29
- />
30
- < TabButton
31
- className = { location . pathname === "/projects/sistent/components/avatar/guidance" ? "active" : "" }
32
- onClick = { ( ) => navigate ( "/projects/sistent/components/avatar/guidance" ) }
33
- title = "Guidance"
34
- />
35
- < TabButton
36
- className = { location . pathname === "/projects/sistent/components/avatar/code" ? "active" : "" }
37
- onClick = { ( ) => navigate ( "/projects/sistent/components/avatar/code" ) }
38
- title = "Code"
39
- />
26
+ { tabs . map ( ( tab ) => (
27
+ < TabButton
28
+ key = { tab . title }
29
+ className = { location . pathname === tab . path ? "active" : "" }
30
+ onClick = { ( ) => navigate ( tab . path ) }
31
+ title = { tab . title }
32
+ />
33
+ ) ) }
40
34
</ div >
41
35
42
-
43
- < div className = "main-content" >
44
- < a id = "BestPractices" >
45
- < h3 > Best Practices</ h3 >
46
- </ a >
36
+ < section >
37
+ < h3 id = "BestPractices" > Best Practices</ h3 >
47
38
< ul >
48
- < li >
49
- < strong > Visual Representation:</ strong > Choose clear, recognizable images that authentically represent the user or entity.
50
- </ li >
51
- < li >
52
- < strong > Fallback Mechanisms:</ strong > Implement robust fallback strategies:
53
- < code >
54
- { "<Avatar src={userImage} alt={userName} fallback={<Avatar>{userInitials}</Avatar>}/>" }
55
- </ code >
56
- </ li >
57
- < li > Maintain consistent avatar sizing and style across the application.</ li >
58
- < li > Optimize image resolution for performance and clarity.</ li >
39
+ < li > < strong > Visual Clarity:</ strong > Use clear, recognizable images for representation.</ li >
40
+ < li > < strong > Fallback Mechanisms:</ strong > Implement alternative displays when an image is unavailable.</ li >
41
+ < li > < strong > Consistency:</ strong > Maintain uniform avatar sizes and styles across your UI.</ li >
42
+ < li > < strong > Performance:</ strong > Optimize image resolution for better loading times.</ li >
59
43
</ ul >
44
+ </ section >
60
45
61
-
62
- < a id = "Accessibility" >
63
- < h3 > Accessibility Considerations</ h3 >
64
- </ a >
46
+ < section >
47
+ < h3 id = "Accessibility" > Accessibility Considerations</ h3 >
65
48
< ul >
66
- < li > Mandatory < code > alt</ code > text for screen reader compatibility .</ li >
67
- < li > Ensure 4.5:1 color contrast ratio for initials and icons.</ li >
68
- < li > Add meaningful aria labels for context.</ li >
49
+ < li > Ensure meaningful < code > alt</ code > text for screen readers .</ li >
50
+ < li > Maintain a 4.5:1 color contrast ratio for initials/ icons.</ li >
51
+ < li > Use ARIA labels to provide additional context.</ li >
69
52
</ ul >
53
+ </ section >
70
54
71
-
72
- < a id = "PerformanceOptimization" >
73
- < h3 > Performance Optimization</ h3 >
74
- </ a >
55
+ < section >
56
+ < h3 id = "PerformanceOptimization" > Performance Optimization</ h3 >
75
57
< ul >
76
- < li > Use image compression techniques.</ li >
77
- < li > Implement lazy loading for avatar images.</ li >
78
- < li > Cache avatar images to reduce network requests.</ li >
79
- < li >
80
- Example lazy loading implementation:
81
- < code >
82
- { "<Avatar loading=\"lazy\" src=\"/path/to/optimized/image.jpg\"/>" }
83
- </ code >
84
- </ li >
58
+ < li > Utilize image compression techniques to reduce file sizes.</ li >
59
+ < li > Implement lazy loading to enhance page speed.</ li >
60
+ < li > Cache frequently used avatars to minimize network requests.</ li >
85
61
</ ul >
62
+ </ section >
86
63
87
-
88
- < a id = "AdvancedCustomization" >
89
- < h3 > Advanced Customization</ h3 >
90
- </ a >
64
+ < section >
65
+ < h3 id = "AdvancedCustomization" > Advanced Customization</ h3 >
91
66
< ul >
92
- < li > Theme-aware color generation for initial avatars.</ li >
93
- < li > Status indicators (online/offline/away).</ li >
94
- < li >
95
- Example status badge:
96
- < code >
97
- { "<Avatar src={userImage} status=\"online\" statusProps={{ color: 'green', position: 'bottom-right' }}/>" }
98
- </ code >
99
- </ li >
67
+ < li > Enable theme-aware color generation for text-based avatars.</ li >
68
+ < li > Support user status indicators (online, offline, away).</ li >
100
69
</ ul >
70
+ </ section >
101
71
102
-
103
- < a id = "IntegrationPatterns" >
104
- < h3 > Common Integration Patterns</ h3 >
105
- </ a >
72
+ < section >
73
+ < h3 id = "IntegrationPatterns" > Common Integration Patterns</ h3 >
106
74
< ul >
107
- < li > User profile headers</ li >
108
- < li > Team member lists </ li >
109
- < li > Comment and messaging interfaces </ li >
110
- < li > Collaboration platform user representations </ li >
75
+ < li > Profile headers</ li >
76
+ < li > Team directories </ li >
77
+ < li > Comment sections </ li >
78
+ < li > Messaging applications </ li >
111
79
</ ul >
80
+ </ section >
112
81
113
-
114
- < a id = "CodeSnippets" >
115
- < h3 > Code Snippet: Flexible Avatar Usage</ h3 >
116
- </ a >
117
- < pre > < code >
118
- { `// Image Avatar
82
+ < section >
83
+ < h3 id = "CodeSnippets" > Code Snippet: Flexible Avatar Usage</ h3 >
84
+ < pre > < code > { `
85
+ // Image Avatar
119
86
<Avatar src="/user-profile.jpg" alt="John Doe" />
120
87
121
-
122
88
// Initials Avatar
123
89
<Avatar>JD</Avatar>
124
90
125
-
126
91
// Icon Avatar
127
92
<Avatar>
128
93
<UserIcon />
129
94
</Avatar>
130
95
131
-
132
96
// Sized Avatars
133
97
<Avatar size="small" />
134
98
<Avatar size="medium" />
135
99
<Avatar size="large" />
136
- ` }
137
- </ code > </ pre >
138
- </ div >
100
+ ` } </ code > </ pre >
101
+ </ section >
139
102
</ div >
140
103
</ SistentLayout >
141
104
) ;
142
105
} ;
143
106
144
-
145
- export default Guidance ;
107
+ export default Guidance ;
0 commit comments