-
-
- {type === 'ERROR' && (
-

- )}
-
{message}
+>(function ConversationBubble(
+ { message, type, className, feedback, handleFeedback },
+ ref,
+) {
+ const [showFeedback, setShowFeedback] = useState(false);
+ const [overriddenFeedback, setOverriddenFeedback] = useState<
+ FEEDBACK | undefined
+ >(undefined);
+ const effectiveFeedback = overriddenFeedback ?? feedback;
+ let bubble;
+
+ if (type === 'QUESTION') {
+ bubble = (
+
-
- );
+ );
+ } else {
+ bubble = (
+
setShowFeedback(true)}
+ onMouseLeave={() => setShowFeedback(false)}
+ >
+
+
+ {type === 'ERROR' && (
+

+ )}
+
{message}
+
+
+ setOverriddenFeedback('LIKE')}
+ >
+
+
+ setOverriddenFeedback('DISLIKE')}
+ >
+
+
+ );
+ }
+ return bubble;
});
export default ConversationBubble;
-
-// TODO : split question and answer into two diff JSX
diff --git a/frontend/svg.d.ts b/frontend/svg.d.ts
new file mode 100644
index 00000000..6326494c
--- /dev/null
+++ b/frontend/svg.d.ts
@@ -0,0 +1,7 @@
+declare module '*.svg' {
+ import * as React from 'react';
+
+ export const ReactComponent: React.FunctionComponent<
+ React.SVGProps
& { title?: string }
+ >;
+}
diff --git a/frontend/tailwind.config.cjs b/frontend/tailwind.config.cjs
index 703d3c4f..2c44007a 100644
--- a/frontend/tailwind.config.cjs
+++ b/frontend/tailwind.config.cjs
@@ -15,6 +15,7 @@ module.exports = {
'gray-1000': '#F6F6F6',
'gray-2000': 'rgba(0, 0, 0, 0.5)',
'gray-3000': 'rgba(243, 243, 243, 1)',
+ 'gray-4000': '#949494',
'red-1000': 'rgb(254, 202, 202)',
'red-2000': '#F44336',
'red-3000': '#621B16',
diff --git a/frontend/tsconfig.json b/frontend/tsconfig.json
index 3d0a51a8..c4d54426 100644
--- a/frontend/tsconfig.json
+++ b/frontend/tsconfig.json
@@ -16,6 +16,6 @@
"noEmit": true,
"jsx": "react-jsx"
},
- "include": ["src"],
+ "include": ["src", "svg.d.ts"],
"references": [{ "path": "./tsconfig.node.json" }]
}
diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts
index 627a3196..c129badf 100644
--- a/frontend/vite.config.ts
+++ b/frontend/vite.config.ts
@@ -1,7 +1,8 @@
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react';
+import svgr from 'vite-plugin-svgr';
// https://vitejs.dev/config/
export default defineConfig({
- plugins: [react()],
+ plugins: [react(), svgr()],
});