Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #41 from neynarxyz/ds/neyn-3445-fix-profile-card-b…
Browse files Browse the repository at this point in the history
…io-spacing

fix: ensure there is spacing between a channel mention and the rest of the span
  • Loading branch information
manan19 authored Oct 21, 2024
2 parents 6a58d58 + 7d3105a commit 73c1cc0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@neynar/react",
"version": "0.9.5",
"version": "0.9.6",
"description": "Farcaster frontend component library powered by Neynar",
"main": "dist/bundle.cjs.js",
"module": "dist/bundle.es.js",
Expand Down
13 changes: 10 additions & 3 deletions src/components/organisms/NeynarProfileCard/hooks/useLinkifyBio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ const generateUrl = (match: string): string => {

const StyledLink = styled.a(({ theme }) => ({
textDecoration: "underline",
color: theme.vars.colors.primary,
color: theme.vars.colors.primary
}));

export const useLinkifyBio = (text: string | undefined): React.ReactNode[] => {
if (!text) return [];

const elements: React.ReactNode[] = [];
let lastIndex = 0;

Expand All @@ -41,8 +41,15 @@ export const useLinkifyBio = (text: string | undefined): React.ReactNode[] => {
}

const url = generateUrl(match[0]);
const isChannel = (match[0].trim()).startsWith('/');

elements.push(
<StyledLink key={matchIndex} href={url} target="_blank">
<StyledLink
key={matchIndex}
href={url}
target="_blank"
style={isChannel ? { marginLeft: 3.5 } : {}}
>
{match[0].trim()}
</StyledLink>
);
Expand Down

0 comments on commit 73c1cc0

Please sign in to comment.