feat(Username): add Username component (#DS-5240)#428
Open
NikGurev wants to merge 2 commits into
Open
Conversation
|
Visit the preview URL for this PR (updated for commit 5304a6d): https://react-koobiq-next--prs-428-cpntbs4g.web.app (expires Mon, 27 Jul 2026 15:27:36 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: fc29847d4a9e5cb1adf458c76a9b681c76e2eeff |
There was a problem hiding this comment.
Pull request overview
Adds a new Username component to @koobiq/react-components for rendering user identity strings (full name, login, site) with multiple layout modes and formatting helpers, and wires it into Storybook + the public API extractor pipeline.
Changes:
- Introduces
Usernameplus slot subcomponents (UsernamePrimary,UsernameSecondary,UsernameSecondaryHint) and associated CSS Modules styling. - Adds name-formatting utilities (
formatUsername,formatUsernameCustom) and a plain-text builder (buildUsernameText). - Adds Storybook docs/stories, unit tests, and updates API Extractor config + generated API report.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/public_api_guard/components/Username.api.md | New API Extractor report for the Username public surface. |
| tools/api-extractor/config.json | Registers Username for API extraction/report generation. |
| packages/components/src/components/Username/utils.ts | Adds formatting + plain-text helper utilities for Username rendering. |
| packages/components/src/components/Username/UsernameSecondaryHint.tsx | Adds the “hint” slot component for site rendering. |
| packages/components/src/components/Username/UsernameSecondary.tsx | Adds the “secondary” slot component for login + hint rendering. |
| packages/components/src/components/Username/UsernamePrimary.tsx | Adds the “primary” slot component for the main name/login. |
| packages/components/src/components/Username/Username.tsx | Implements the Username component and its rendering logic. |
| packages/components/src/components/Username/Username.test.tsx | Adds Vitest/RTL coverage for component behavior and utilities. |
| packages/components/src/components/Username/Username.stories.tsx | Adds Storybook stories showcasing modes, types, compact, custom view, etc. |
| packages/components/src/components/Username/Username.module.css | Adds styles for layout modes, visual types, and slot elements. |
| packages/components/src/components/Username/Username.mdx | Adds Storybook documentation for usage, props, and formatting helpers. |
| packages/components/src/components/Username/types.ts | Defines public types and prop unions for Username. |
| packages/components/src/components/Username/index.ts | Exports the component, slots, types, and utils from the feature folder. |
| packages/components/src/components/index.ts | Re-exports Username from the components entrypoint. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+22
to
+25
| export type UsernameBaseProps = { | ||
| /** User profile data. Not required when children (custom view) is provided. */ | ||
| userInfo?: UsernameUserInfo; | ||
| /** |
Comment on lines
+72
to
+84
| return ( | ||
| <span {...rootProps}> | ||
| {hasFullName && <UsernamePrimary>{name}</UsernamePrimary>} | ||
| {isNotNil(userInfo?.login) && ( | ||
| <UsernameSecondary> | ||
| {userInfo!.login} | ||
| {isNotNil(userInfo?.site) && ( | ||
| <UsernameSecondaryHint> ({userInfo!.site})</UsernameSecondaryHint> | ||
| )} | ||
| </UsernameSecondary> | ||
| )} | ||
| </span> | ||
| ); |
Comment on lines
+64
to
+66
| {isNotNil(userInfo?.site) && ( | ||
| <UsernameSecondaryHint> ({userInfo!.site})</UsernameSecondaryHint> | ||
| )} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.