This repository has been archived by the owner on Apr 9, 2023. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: move user description highlights to github user organism (#68)
This removes all references of GitHub from the user molecule.
- Loading branch information
Showing
8 changed files
with
87 additions
and
27 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,22 @@ | ||
import styled from 'styled-components/macro'; | ||
|
||
/** | ||
* This element styles a mention in the user description, which links to this organization or user. | ||
*/ | ||
export const GithubUserMentionHighlight = styled.a` | ||
text-decoration: none; | ||
color: #24292e; | ||
font-weight: 600; | ||
&:hover { | ||
text-decoration: underline; | ||
} | ||
`; | ||
|
||
/** | ||
* This element styles a particular keyword, starting with a character, in the user description. | ||
*/ | ||
export const GithubUserKeywordHighlight = styled.strong` | ||
color: #24292e; | ||
font-weight: 600; | ||
`; |
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,7 @@ | ||
import KeywordHighlight from './keyword'; | ||
import MentionHighlight from './mention'; | ||
|
||
export default { | ||
...KeywordHighlight.decorator, | ||
...MentionHighlight.decorator, | ||
}; |
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,20 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { GithubUserKeywordHighlight } from '../elements'; | ||
|
||
export default function GithubUserOrganismKeyword(props) { | ||
return ( | ||
<GithubUserKeywordHighlight> | ||
{props.children} | ||
</GithubUserKeywordHighlight> | ||
); | ||
} | ||
|
||
GithubUserOrganismKeyword.decorator = { | ||
'#': (match, text, key) => <GithubUserOrganismKeyword key={key} label={text} />, | ||
} | ||
|
||
GithubUserOrganismKeyword.propTypes = { | ||
/** The text to show for this keyword. */ | ||
label: PropTypes.string.isRequired, | ||
}; |
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,32 @@ | ||
import React from 'react'; | ||
import PropTypes from 'prop-types'; | ||
import { GithubUserMentionHighlight } from '../elements'; | ||
|
||
export default function GithubUserOrganismMention(props) { | ||
return ( | ||
<GithubUserMentionHighlight | ||
href={`https://github.com/${props.username}`} | ||
target='_blank' | ||
rel='noopener noreferrer' | ||
> | ||
{props.label} | ||
</GithubUserMentionHighlight> | ||
); | ||
} | ||
|
||
GithubUserOrganismMention.decorator = { | ||
'@': (match, text, key) => ( | ||
<GithubUserOrganismMention | ||
key={key} | ||
label={match} | ||
username={text} | ||
/> | ||
), | ||
}; | ||
|
||
GithubUserOrganismMention.propTypes = { | ||
/** The text to show for this link or mention. */ | ||
label: PropTypes.string.isRequired, | ||
/** The GitHub username to use in the external link. */ | ||
username: PropTypes.string.isRequired, | ||
}; |