Overview
TheHeader component renders the top navigation bar of GitScope, displaying the application branding, GitHub API rate limit status, theme toggle button, and token management interface.
Location in UI: Fixed at the top of the application viewport
Source: ~/workspace/source/src/components/Header.jsx
Props
Current theme mode. Expected values:
'light' or 'dark'Callback function to toggle between light and dark themes. Called when the theme button is clicked.
GitHub API rate limit information. Contains
remaining, limit, and reset properties.Callback function invoked when the “Token API” button or rate limit indicator is clicked. Opens the token management modal.
Usage Example
FromApp.jsx:75-80:
Key Features
Brand Identity
Displays the GitScope logo with GitHub icon and tagline:Rate Limit Indicator
Displays API rate limit with color-coded status:- Green: > 50% remaining
- Yellow: 20-50% remaining
- Red: < 20% remaining
Theme Toggle
Switches between light and dark modes using icon indicators:Token Management
Provides access to the GitHub token configuration:Implementation Details
Icons
Uses Lucide React icons:Github- Brand logoMoon/Sun- Theme indicatorsZap- Rate limit indicator
Rate Limit Reset Time
Converts Unix timestamp to localized time string:Styling
Imports modular CSS fromHeader.module.css for component-scoped styles.
Accessibility
The theme toggle button includes anaria-label for screen readers: