-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Button): add
link.bare
variant, enable style override and styl…
…e combination - Add text.bare variant to IButtonVariant type - Add special case in getButtonViewStyle for text.bare that removes padding and decorations - Keep existing button variants and their styling intact - Use text.bare variant in Profile screen's Edit button This allows for buttons without padding while maintaining the existing button system.
- Loading branch information
Showing
6 changed files
with
194 additions
and
79 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import { formatUsername } from "../formatUsername"; | ||
|
||
describe("formatUsername", () => { | ||
it("should return undefined when no username provided", () => { | ||
const result = formatUsername(undefined); | ||
expect(result).toBeUndefined(); | ||
}); | ||
|
||
it("should format .conversedev.eth username by extracting first part and adding @ prefix", () => { | ||
const result = formatUsername("louisdev.conversedev.eth"); | ||
expect(result).toBe("@louisdev"); | ||
}); | ||
|
||
it("should format .converse.xyz username by extracting first part and adding @ prefix", () => { | ||
const result = formatUsername("louisdev.converse.xyz"); | ||
expect(result).toBe("@louisdev"); | ||
}); | ||
|
||
it("should return undefined for non-Converse usernames", () => { | ||
expect(formatUsername("louisdev.eth")).toBeUndefined(); | ||
expect(formatUsername("louisdev")).toBeUndefined(); | ||
expect(formatUsername("@louisdev")).toBeUndefined(); | ||
}); | ||
|
||
it("should return undefined for empty string", () => { | ||
const result = formatUsername(""); | ||
expect(result).toBeUndefined(); | ||
}); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/** | ||
* Formats usernames from Converse domains by extracting the username part and adding @ prefix | ||
* Returns undefined for non-Converse usernames | ||
* @param username - The username to format | ||
* @returns The formatted username with @ prefix if it's a Converse username, undefined otherwise | ||
*/ | ||
export function formatUsername( | ||
username: string | undefined | ||
): string | undefined { | ||
if (!username) return undefined; | ||
|
||
// Check if it's a Converse username (either domain) | ||
if ( | ||
username.endsWith(".conversedev.eth") || | ||
username.endsWith(".converse.xyz") | ||
) { | ||
// Extract everything before the domain | ||
const cleanUsername = username | ||
.replace(/\.conversedev\.eth$/, "") | ||
.replace(/\.converse\.xyz$/, ""); | ||
return `@${cleanUsername}`; | ||
} | ||
|
||
// Return undefined for non-Converse usernames | ||
return undefined; | ||
} |
Oops, something went wrong.