From 990d7d83fef9331b78c797b3dbc8871d45649254 Mon Sep 17 00:00:00 2001 From: Steven Date: Sun, 19 Mar 2023 21:25:51 +0800 Subject: [PATCH] feat: add message renderer style --- components/ChatView/MessageView.tsx | 9 +++++---- package.json | 1 + pnpm-lock.yaml | 30 +++++++++++++++++++++++++++++ tailwind.config.js | 2 +- 4 files changed, 37 insertions(+), 5 deletions(-) diff --git a/components/ChatView/MessageView.tsx b/components/ChatView/MessageView.tsx index 4c6caba..268c41d 100644 --- a/components/ChatView/MessageView.tsx +++ b/components/ChatView/MessageView.tsx @@ -1,7 +1,6 @@ import { marked } from "marked"; import { useUserStore } from "../../store"; import { Message } from "../../types"; -import "highlight.js/styles/github.css"; interface Props { message: Message; @@ -14,12 +13,14 @@ const MessageView = (props: Props) => { const isCurrentUser = message.creatorId === currentUser.id; return ( -
+
{isCurrentUser ? ( -
{message.content}
+
+ {message.content} +
) : (
)} diff --git a/package.json b/package.json index f8972a3..0932740 100644 --- a/package.json +++ b/package.json @@ -24,6 +24,7 @@ "zustand": "^4.3.6" }, "devDependencies": { + "@tailwindcss/typography": "^0.5.9", "@types/marked": "^4.0.8", "@types/node": "^18.11.18", "@types/react": "^18.0.26", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7240468..54bf3c2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -2,6 +2,7 @@ lockfileVersion: 5.4 specifiers: '@headlessui/react': ^1.7.13 + '@tailwindcss/typography': ^0.5.9 '@types/marked': ^4.0.8 '@types/node': ^18.11.18 '@types/react': ^18.0.26 @@ -45,6 +46,7 @@ dependencies: zustand: 4.3.6_react@18.2.0 devDependencies: + '@tailwindcss/typography': 0.5.9_tailwindcss@3.2.7 '@types/marked': 4.0.8 '@types/node': 18.15.3 '@types/react': 18.0.28 @@ -266,6 +268,18 @@ packages: tslib: 2.5.0 dev: false + /@tailwindcss/typography/0.5.9_tailwindcss@3.2.7: + resolution: {integrity: sha512-t8Sg3DyynFysV9f4JDOVISGsjazNb48AeIYQwcL+Bsq5uf4RYL75C1giZ43KISjeDGBaTN3Kxh7Xj/vRSMJUUg==} + peerDependencies: + tailwindcss: '>=3.0.0 || insiders' + dependencies: + lodash.castarray: 4.4.0 + lodash.isplainobject: 4.0.6 + lodash.merge: 4.6.2 + postcss-selector-parser: 6.0.10 + tailwindcss: 3.2.7_postcss@8.4.21 + dev: true + /@types/json5/0.0.29: resolution: {integrity: sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==} dev: true @@ -1661,6 +1675,14 @@ packages: engines: {node: '>=10'} dev: true + /lodash.castarray/4.4.0: + resolution: {integrity: sha512-aVx8ztPv7/2ULbArGJ2Y42bG1mEQ5mGjpdvrbJcJFU3TbYybe+QlLS4pst9zV52ymy2in1KpFPiZnAOATxD4+Q==} + dev: true + + /lodash.isplainobject/4.0.6: + resolution: {integrity: sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==} + dev: true + /lodash.merge/4.6.2: resolution: {integrity: sha512-0KpjqXRVvrYyCsX1swR/XTK0va6VQkQM6MNo7PqW77ByjAhoARA8EfrP1N4+KlKj8YS0ZUCtRT/YUuhyYDujIQ==} dev: true @@ -1983,6 +2005,14 @@ packages: postcss-selector-parser: 6.0.11 dev: true + /postcss-selector-parser/6.0.10: + resolution: {integrity: sha512-IQ7TZdoaqbT+LCpShg46jnZVlhWD2w6iQYAcYXfHARZ7X1t/UGhhceQDs5X0cGqKvYlHNOuv7Oa1xmb0oQuA3w==} + engines: {node: '>=4'} + dependencies: + cssesc: 3.0.0 + util-deprecate: 1.0.2 + dev: true + /postcss-selector-parser/6.0.11: resolution: {integrity: sha512-zbARubNdogI9j7WY4nQJBiNqQf3sLS3wCP4WfOidu+p28LofJqDH1tcXypGrcmMHhDk2t9wGhCsYe/+szLTy1g==} engines: {node: '>=4'} diff --git a/tailwind.config.js b/tailwind.config.js index b852cdd..740f555 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -8,5 +8,5 @@ module.exports = { }, }, }, - plugins: [], + plugins: [require("@tailwindcss/typography")], };