From f0b18db9dc3d0321fb01677e98f3968b21af36fa Mon Sep 17 00:00:00 2001
From: Ivan Chen <ivan@tagg.id>
Date: Tue, 8 Jun 2021 18:19:19 -0400
Subject: Added comment preview, WIP on mention part types

---
 src/utils/comments.tsx | 41 ++++++++++++++++++++++++++++-------------
 1 file changed, 28 insertions(+), 13 deletions(-)

(limited to 'src/utils/comments.tsx')

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),
     },
   ];
 };
-- 
cgit v1.2.3-70-g09d2

