aboutsummaryrefslogtreecommitdiff
path: root/src/utils/comments.tsx
diff options
context:
space:
mode:
authorIvan Chen <ivan@tagg.id>2021-06-08 18:19:19 -0400
committerIvan Chen <ivan@tagg.id>2021-06-08 18:19:19 -0400
commitf0b18db9dc3d0321fb01677e98f3968b21af36fa (patch)
tree5d96f6732c9cfd0c08258e321afc2b785c999d7a /src/utils/comments.tsx
parent18770a692d03fb68267b51ef05cd4b58917b0e62 (diff)
Added comment preview, WIP on mention part types
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),
},
];
};