Skip to content
This repository was archived by the owner on Apr 9, 2023. It is now read-only.

Commit 0a0cb92

Browse files
johnaniserebyCedric
authored andcommitted
feature: implement mention link in user molecule (#65)
* feature: implement mention link * style: revert avatar atom changes * style: revert highlight atom changes * style: revert user molecule double quotes * style: revert highlight atom trailing comma removal * refactor: revert user molecule highlight weight The 600 weight matches GitHub's version. * style: use single quotes in user molecule * fixup! style: use single quote in user molecule * fixup! style: use single quotes in user molecule * refactor: use match from decorator for github link * fixup! refactor: use match from decorator for github link * style: fix indentation and add trailing comma in user molecule * style: use proper order of styling in user molecule
1 parent 14d6efa commit 0a0cb92

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/molecules/user/elements.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ export const UserDescription = styled.div`
6565
/**
6666
* The user's description highlights styles keywords within this description.
6767
*/
68-
export const UserDescriptionHighlight = styled.strong`
68+
export const UserDescriptionHighlight = styled.a`
69+
text-decoration: none;
6970
color: #24292e;
7071
font-weight: 600;
7172
`;

src/molecules/user/user.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,19 @@ import {
1414
} from './elements';
1515

1616
const decorators = {
17-
'@': (segment, match, key) => <UserDescriptionHighlight key={key}>{segment}</UserDescriptionHighlight>,
18-
'#': (segment, match, key) => <UserDescriptionHighlight key={key}>{match}</UserDescriptionHighlight>,
17+
'@': (segment, match, key) => (
18+
<UserDescriptionHighlight
19+
key={key}
20+
href={`https://github.com/${match}`}
21+
target='_blank'
22+
rel='noopener noreferrer'
23+
>
24+
{segment}
25+
</UserDescriptionHighlight>
26+
),
27+
'#': (segment, match, key) => (
28+
<UserDescriptionHighlight key={key}>{match}</UserDescriptionHighlight>
29+
)
1930
};
2031

2132
export default function UserMolecule(props) {

0 commit comments

Comments
 (0)