aboutsummaryrefslogtreecommitdiff
path: root/src/utils/comments.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/comments.tsx')
-rw-r--r--src/utils/comments.tsx41
1 files changed, 28 insertions, 13 deletions
diff --git a/src/utils/comments.tsx b/src/utils/comments.tsx
index 5c17cefe..e700da88 100644
--- a/src/utils/comments.tsx
+++ b/src/utils/comments.tsx
@@ -79,26 +79,41 @@ export const renderTextWithMentions: React.FC<RenderProps> = ({
);
};
-export const mentionPartTypes: (style: 'blue' | 'white') => PartType[] = (
- style,
+const textStyle: (theme: 'blue' | 'white' | 'commentPreview') => PartType = (
+ theme,
) => {
+ switch (theme) {
+ case 'blue':
+ return {
+ color: TAGG_LIGHT_BLUE,
+ top: normalize(3),
+ };
+ case 'commentPreview':
+ return {
+ color: 'white',
+ fontWeight: '800',
+ top: normalize(3),
+ };
+ case 'white':
+ default:
+ return {
+ color: 'white',
+ fontWeight: '800',
+ top: normalize(7.5),
+ };
+ }
+};
+
+export const mentionPartTypes: (
+ theme: 'blue' | 'white' | 'commentPreview',
+) => PartType[] = (theme) => {
return [
{
trigger: '@',
renderSuggestions: (props) => <TaggTypeahead {...props} />,
allowedSpacesCount: 0,
isInsertSpaceAfterMention: true,
- textStyle:
- style === 'blue'
- ? {
- color: TAGG_LIGHT_BLUE,
- top: normalize(3),
- }
- : {
- color: 'white',
- fontWeight: '800',
- top: normalize(7.5),
- },
+ textStyle: textStyle(theme),
},
];
};