|
| 1 | +import React from "react"; |
| 2 | +import { navigate } from "gatsby"; |
| 3 | +import { useLocation } from "@reach/router"; |
| 4 | +import { SistentLayout } from "../../sistent-layout"; |
| 5 | +import TabButton from "../../../../../reusecore/Button"; |
| 6 | +const Guidance = () => { |
| 7 | + const location = useLocation(); |
| 8 | + return ( |
| 9 | + <SistentLayout title="Avatar"> |
| 10 | + <div className="content"> |
| 11 | + <h2>Avatar Usage Guidelines</h2> |
| 12 | + <p> |
| 13 | + The Avatar component represents a user using an image, initials, or an |
| 14 | + icon. It is a crucial UI element for providing visual identity across |
| 15 | + digital platforms. |
| 16 | + </p> |
| 17 | + |
| 18 | + <div className="filterBtns"> |
| 19 | + <TabButton |
| 20 | + className={ |
| 21 | + location.pathname === |
| 22 | + "/projects/sistent/components/avatar/overview" |
| 23 | + ? "active" |
| 24 | + : "" |
| 25 | + } |
| 26 | + onClick={() => |
| 27 | + navigate("/projects/sistent/components/avatar/overview") |
| 28 | + } |
| 29 | + title="Overview" |
| 30 | + /> |
| 31 | + <TabButton |
| 32 | + className={ |
| 33 | + location.pathname === |
| 34 | + "/projects/sistent/components/avatar/guidance" |
| 35 | + ? "active" |
| 36 | + : "" |
| 37 | + } |
| 38 | + onClick={() => |
| 39 | + navigate("/projects/sistent/components/avatar/guidance") |
| 40 | + } |
| 41 | + title="Guidance" |
| 42 | + /> |
| 43 | + <TabButton |
| 44 | + className={ |
| 45 | + location.pathname === "/projects/sistent/components/avatar/code" |
| 46 | + ? "active" |
| 47 | + : "" |
| 48 | + } |
| 49 | + onClick={() => navigate("/projects/sistent/components/avatar/code")} |
| 50 | + title="Code" |
| 51 | + /> |
| 52 | + </div> |
| 53 | + |
| 54 | + <div className="main-content"> |
| 55 | + <h3>Best Practices</h3> |
| 56 | + |
| 57 | + <ul> |
| 58 | + <li> |
| 59 | + <strong>Visual Representation:</strong> Choose clear, recognizable |
| 60 | + images that authentically represent the user or entity. |
| 61 | + </li> |
| 62 | + <li> |
| 63 | + <strong>Fallback Mechanisms:</strong> Implement robust fallback |
| 64 | + strategies: |
| 65 | + <code> |
| 66 | + { |
| 67 | + "<Avatar src={userImage} alt={userName} fallback={<Avatar>{userInitials}</Avatar>}/>" |
| 68 | + } |
| 69 | + </code> |
| 70 | + </li> |
| 71 | + <li> |
| 72 | + Maintain consistent avatar sizing and style across the |
| 73 | + application. |
| 74 | + </li> |
| 75 | + <li>Optimize image resolution for performance and clarity.</li> |
| 76 | + </ul> |
| 77 | + |
| 78 | + <h3>Accessibility Considerations</h3> |
| 79 | + <ul> |
| 80 | + <li> |
| 81 | + Mandatory <code>alt</code> text for screen reader compatibility. |
| 82 | + </li> |
| 83 | + <li>Ensure 4.5:1 color contrast ratio for initials and icons.</li> |
| 84 | + <li>Add meaningful aria labels for context.</li> |
| 85 | + </ul> |
| 86 | + |
| 87 | + <h3>Performance Optimization</h3> |
| 88 | + <ul> |
| 89 | + <li>Use image compression techniques.</li> |
| 90 | + <li>Implement lazy loading for avatar images.</li> |
| 91 | + <li>Cache avatar images to reduce network requests.</li> |
| 92 | + <li> |
| 93 | + Example lazy loading implementation: |
| 94 | + <code> |
| 95 | + {'<Avatar loading="lazy" src="/path/to/optimized/image.jpg"/>'} |
| 96 | + </code> |
| 97 | + </li> |
| 98 | + </ul> |
| 99 | + |
| 100 | + <h3>Advanced Customization</h3> |
| 101 | + <ul> |
| 102 | + <li>Theme-aware color generation for initial avatars.</li> |
| 103 | + <li>Status indicators (online/offline/away).</li> |
| 104 | + <li> |
| 105 | + Example status badge: |
| 106 | + <code> |
| 107 | + { |
| 108 | + "<Avatar src={userImage} status=\"online\" statusProps={{ color: 'green', position: 'bottom-right' }}/>" |
| 109 | + } |
| 110 | + </code> |
| 111 | + </li> |
| 112 | + </ul> |
| 113 | + |
| 114 | + <h3>Common Integration Patterns</h3> |
| 115 | + <ul> |
| 116 | + <li>User profile headers</li> |
| 117 | + <li>Team member lists</li> |
| 118 | + <li>Comment and messaging interfaces</li> |
| 119 | + <li>Collaboration platform user representations</li> |
| 120 | + </ul> |
| 121 | + </div> |
| 122 | + </div> |
| 123 | + </SistentLayout> |
| 124 | + ); |
| 125 | +}; |
| 126 | + |
| 127 | +export default Guidance; |
0 commit comments