diff --git a/.changeset/config.json b/.changeset/config.json index 743b65c..621748a 100644 --- a/.changeset/config.json +++ b/.changeset/config.json @@ -5,7 +5,6 @@ "fixed": [], "linked": [ [ - "@fuma-comment/kysely-adapter", "@fuma-comment/prisma-adapter", "@fuma-comment/server", "@fuma-comment/react", diff --git a/.changeset/lazy-berries-yell.md b/.changeset/lazy-berries-yell.md new file mode 100644 index 0000000..9244603 --- /dev/null +++ b/.changeset/lazy-berries-yell.md @@ -0,0 +1,5 @@ +--- +"@fuma-comment/react": minor +--- + +Support Tailwind CSS presets diff --git a/apps/docs/app/(demo)/layout.tsx b/apps/docs/app/(demo)/layout.tsx index 56daac8..9aedf2d 100644 --- a/apps/docs/app/(demo)/layout.tsx +++ b/apps/docs/app/(demo)/layout.tsx @@ -1,5 +1,3 @@ -import "@fuma-comment/react/style.css"; -import "../globals.css"; import { AuthProvider } from "./layout.client"; export default function RootLayout({ diff --git a/apps/docs/tailwind.config.js b/apps/docs/tailwind.config.js index 4a1cbee..b3deacc 100644 --- a/apps/docs/tailwind.config.js +++ b/apps/docs/tailwind.config.js @@ -1,12 +1,13 @@ -import { createPreset } from 'fumadocs-ui/tailwind-plugin'; +import { createPreset as createCommentPreset } from "@fuma-comment/react/theme"; +import { createPreset as createDocsPreset } from "fumadocs-ui/tailwind-plugin"; /** @type {import('tailwindcss').Config} */ export default { - darkMode: 'class', - presets: [createPreset()], + darkMode: "class", + presets: [createCommentPreset(), createDocsPreset()], content: [ - './node_modules/fumadocs-ui/dist/**/*.js', - + "./node_modules/fumadocs-ui/dist/**/*.js", + "./node_modules/@fuma-comment/react/dist/**/*.js", "./app/**/*.{js,ts,jsx,tsx,mdx}", "./components/**/*.{js,ts,jsx,tsx,mdx}", "./content/**/*.{js,ts,jsx,tsx,mdx}", @@ -24,6 +25,6 @@ export default { "2xl": "1400px", }, }, - } - } -}; \ No newline at end of file + }, + }, +}; diff --git a/packages/react/css/styles.css b/packages/react/css/styles.css index 0768ab1..b5c61c9 100644 --- a/packages/react/css/styles.css +++ b/packages/react/css/styles.css @@ -1,59 +1,3 @@ @tailwind base; @tailwind components; @tailwind utilities; - -:root { - --fc-background: 0 0% 100%; - --fc-foreground: 0 0% 3.9%; - --fc-muted: 0 0% 96.1%; - --fc-muted-foreground: 0 0% 45.1%; - --fc-popover: 0 0% 100%; - --fc-popover-foreground: 0 0% 15.1%; - --fc-card: 0 0% 96.7%; - --fc-card-foreground: 0 0% 3.9%; - --fc-border: 0 0% 89.8%; - --fc-primary: 0 0% 9%; - --fc-primary-foreground: 0 0% 98%; - --fc-accent: 0 0% 94.1%; - --fc-accent-foreground: 0 0% 9%; - --fc-danger: 3 99% 55%; - --fc-ring: 0 0% 63.9%; -} - -.dark { - --fc-background: 0 0% 3.9%; - --fc-foreground: 0 0% 98%; - --fc-muted: 0 0% 14.9%; - --fc-muted-foreground: 0 0% 60.9%; - --fc-popover: 0 0% 7%; - --fc-popover-foreground: 0 0% 88%; - --fc-card: 0 0% 8%; - --fc-card-foreground: 0 0% 98%; - --fc-border: 0 0% 18%; - --fc-primary: 0 0% 98%; - --fc-primary-foreground: 0 0% 9%; - --fc-accent: 0 0% 14.9%; - --fc-accent-foreground: 0 0% 98%; - --fc-ring: 0 0% 14.9%; - --fc-danger: 3 95% 64%; -} - -.tiptap p.is-editor-empty:first-child::before { - content: attr(data-placeholder); - float: left; - height: 0; - pointer-events: none; - @apply fc-text-muted-foreground; -} - -.tiptap img { - @apply fc-rounded-lg fc-max-w-full fc-w-auto fc-max-h-60; -} - -.tiptap img.ProseMirror-selectednode { - @apply fc-ring-2 fc-ring-primary; -} - -.tiptap a { - @apply fc-font-medium fc-underline; -} diff --git a/packages/react/package.json b/packages/react/package.json index 0c0cd52..f285e9b 100644 --- a/packages/react/package.json +++ b/packages/react/package.json @@ -2,7 +2,7 @@ "name": "@fuma-comment/react", "version": "0.1.1", "main": "./dist/index.js", - "types": "./dist/index.d.mts", + "types": "./dist/index.d.ts", "author": "Fuma Nama", "homepage": "https://fuma-comment.vercel.app", "repository": "https://github.com/fuma-nama/fuma-comment", @@ -10,18 +10,30 @@ "./dist" ], "license": "MIT", + "type": "module", "exports": { - ".": "./dist/index.js", + ".": { + "import": "./dist/index.js", + "types": "./dist/index.d.ts" + }, "./style.css": "./dist/style.css", "./atom": { "import": "./dist/atom.js", - "types": "./dist/atom.d.mts" + "types": "./dist/atom.d.ts" + }, + "./theme": { + "import": "./dist/theme/index.js", + "require": "./dist/theme/index.js", + "types": "./dist/theme/index.d.ts" } }, "typesVersions": { "*": { "atom": [ - "./dist/atom.d.mts" + "./dist/atom.d.ts" + ], + "theme": [ + "./dist/theme/index.d.ts" ] } }, diff --git a/packages/react/postcss.config.js b/packages/react/postcss.config.js index 0b26cdd..d9a89b6 100644 --- a/packages/react/postcss.config.js +++ b/packages/react/postcss.config.js @@ -1,4 +1,4 @@ -module.exports = { +export default { plugins: { "tailwindcss/nesting": {}, tailwindcss: {}, diff --git a/packages/react/src/atom.tsx b/packages/react/src/atom.tsx index 659ea65..ca2f589 100644 --- a/packages/react/src/atom.tsx +++ b/packages/react/src/atom.tsx @@ -1,3 +1,5 @@ +"use client"; + import { useMemo, type ReactNode, @@ -48,11 +50,7 @@ export const CommentsPost = forwardRef< const auth = useAuthContext(); return ( -
+
No comments
)} diff --git a/packages/react/src/comments.tsx b/packages/react/src/comments.tsx index 9d78681..f613529 100644 --- a/packages/react/src/comments.tsx +++ b/packages/react/src/comments.tsx @@ -18,14 +18,14 @@ export const Comments = forwardRef