feat: use tailwind-merge

This commit is contained in:
DIYgod
2023-02-27 11:58:11 +00:00
parent 8634e78e50
commit 06a6fe735a
27 changed files with 77 additions and 90 deletions
+2
View File
@@ -97,6 +97,8 @@
"remark-stringify": "10.0.2",
"sharp": "0.31.3",
"sortablejs": "1.15.0",
"tailwind-merge": "^1.10.0",
"tailwindcss-animate": "^1.0.5",
"unidata.js": "0.7.13",
"unified": "10.1.2",
"unist-builder": "3.0.1",
+16 -35
View File
@@ -118,7 +118,9 @@ specifiers:
remark-stringify: 10.0.2
sharp: 0.31.3
sortablejs: 1.15.0
tailwind-merge: ^1.10.0
tailwindcss: 3.2.7
tailwindcss-animate: ^1.0.5
typescript: 4.9.5
unidata.js: 0.7.13
unified: 10.1.2
@@ -211,6 +213,8 @@ dependencies:
remark-stringify: 10.0.2
sharp: 0.31.3
sortablejs: 1.15.0
tailwind-merge: 1.10.0
tailwindcss-animate: 1.0.5_tailwindcss@3.2.7
unidata.js: 0.7.13
unified: 10.1.2
unist-builder: 3.0.1
@@ -3424,12 +3428,10 @@ packages:
dependencies:
'@nodelib/fs.stat': 2.0.5
run-parallel: 1.2.0
dev: true
/@nodelib/fs.stat/2.0.5:
resolution: {integrity: sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==}
engines: {node: '>= 8'}
dev: true
/@nodelib/fs.walk/1.2.8:
resolution: {integrity: sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==}
@@ -3437,7 +3439,6 @@ packages:
dependencies:
'@nodelib/fs.scandir': 2.1.5
fastq: 1.15.0
dev: true
/@pedrouid/environment/1.0.1:
resolution: {integrity: sha512-HaW78NszGzRZd9SeoI3JD11JqY+lubnaOx7Pewj5pfjqWXOEATpeKIFb9Z4t2WBUK2iryiXX3lzWwmYWgUL0Ug==}
@@ -5062,12 +5063,10 @@ packages:
acorn: 7.4.1
acorn-walk: 7.2.0
xtend: 4.0.2
dev: true
/acorn-walk/7.2.0:
resolution: {integrity: sha512-OPdCF6GsMIP+Az+aWfAAOEt2/+iVDKE7oy6lJ098aoe59oAmK76qV6Gw60SbZ8jHuG2wH058GF4pLFbYamYrVA==}
engines: {node: '>=0.4.0'}
dev: true
/acorn-walk/8.2.0:
resolution: {integrity: sha512-k+iyHEuPgSw6SbuDpGQM+06HQUa04DZ3o+F6CSzXMvvI5KMvnaEqXe+YVe555R9nn6GPt404fos4wcgpw12SDA==}
@@ -5077,7 +5076,6 @@ packages:
resolution: {integrity: sha512-nQyp0o1/mNdbTO1PO6kHkwSrmgZ0MT/jCCpNiwbUjGoRN4dlBhqJtoQuCnEOKzgTVwg0ZWiCoQy6SxMebQVh8A==}
engines: {node: '>=0.4.0'}
hasBin: true
dev: true
/acorn/8.8.1:
resolution: {integrity: sha512-7zFpHzhnqYKrkYdUjF1HI1bzd0VygEGX8lFk4k5zVMqHEoES+P+7TKI+EvLO9WVMJ8eekdO0aDEK044xTXwPPA==}
@@ -5251,7 +5249,6 @@ packages:
/arg/5.0.2:
resolution: {integrity: sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==}
dev: true
/argparse/2.0.1:
resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
@@ -5808,7 +5805,6 @@ packages:
/camelcase-css/2.0.1:
resolution: {integrity: sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==}
engines: {node: '>= 6'}
dev: true
/camelcase/5.3.1:
resolution: {integrity: sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==}
@@ -6283,7 +6279,6 @@ packages:
resolution: {integrity: sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==}
engines: {node: '>=4'}
hasBin: true
dev: true
/csstype/3.0.9:
resolution: {integrity: sha512-rpw6JPxK6Rfg1zLOYCSwle2GFOOsnjmDYDaBwEcwoOg4qlsIVCN789VkBZDJAGi4T07gI4YSutR43t9Zz4Lzuw==}
@@ -6446,7 +6441,6 @@ packages:
/defined/1.0.1:
resolution: {integrity: sha512-hsBd2qSVCRE+5PmNdHt1uzyrFu5d3RwmFDKzyNZMFq/EwDNJF7Ee5+D5oEKF0hU6LhtoUF1macFvOe4AskQC1Q==}
dev: true
/defu/6.1.2:
resolution: {integrity: sha512-+uO4+qr7msjNNWKYPHqN/3+Dx3NFkmIzayk2L1MyZQlvgZb/J1A0fo410dpKrN2SnqFjt8n4JL8fDJE0wIgjFQ==}
@@ -6523,11 +6517,9 @@ packages:
acorn-node: 1.8.2
defined: 1.0.1
minimist: 1.2.8
dev: true
/didyoumean/1.2.2:
resolution: {integrity: sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==}
dev: true
/diff/4.0.2:
resolution: {integrity: sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A==}
@@ -6561,7 +6553,6 @@ packages:
/dlv/1.1.3:
resolution: {integrity: sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==}
dev: true
/dns-over-http-resolver/1.2.3:
resolution: {integrity: sha512-miDiVSI6KSNbi4SVifzO/reD8rMnxgrlnkrlkugOLQpWQTe2qMdHsZp5DmfKjxNE+/T3VAAYLQUZMv9SMr6+AA==}
@@ -7420,7 +7411,6 @@ packages:
glob-parent: 5.1.2
merge2: 1.4.1
micromatch: 4.0.5
dev: true
/fast-json-stable-stringify/2.1.0:
resolution: {integrity: sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==}
@@ -7447,7 +7437,6 @@ packages:
resolution: {integrity: sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==}
dependencies:
reusify: 1.0.4
dev: true
/fault/2.0.1:
resolution: {integrity: sha512-WtySTkS4OKev5JtpHXnib4Gxiurzh5NCGvWrFaZ34m6JehfTUhKZvn9njTfw48t6JumVQOmrKqpmGcdwxnhqBQ==}
@@ -7709,7 +7698,6 @@ packages:
engines: {node: '>=10.13.0'}
dependencies:
is-glob: 4.0.3
dev: true
/glob/7.1.7:
resolution: {integrity: sha512-OvD9ENzPLbegENnYP5UUfJIirTg4+XwMWGaQfQTY0JenxNvvIKP3U3/tAQSPIu/lHxXYSZmpXlUHeqAIdKzBLQ==}
@@ -8807,7 +8795,6 @@ packages:
/lilconfig/2.0.6:
resolution: {integrity: sha512-9JROoBW7pobfsx+Sq2JsASvCo6Pfo6WWoUW79HuB1BCoBXD4PLWJPqDF6fNj67pqBYTbAHkE57M1kS/+L1neOg==}
engines: {node: '>=10'}
dev: true
/lines-and-columns/1.2.4:
resolution: {integrity: sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==}
@@ -9235,7 +9222,6 @@ packages:
/merge2/1.4.1:
resolution: {integrity: sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==}
engines: {node: '>= 8'}
dev: true
/micromark-core-commonmark/1.0.6:
resolution: {integrity: sha512-K+PkJTxqjFfSNkfAhp4GB+cZPfQd6dxtTXnf+RjZOV7T4EEXnvgzOcnp+eSTmpGk9d1S9sL6/lqrgSNn/s0HZA==}
@@ -9524,7 +9510,6 @@ packages:
dependencies:
braces: 3.0.2
picomatch: 2.3.1
dev: true
/mime-db/1.52.0:
resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==}
@@ -9592,7 +9577,6 @@ packages:
/minimist/1.2.8:
resolution: {integrity: sha512-2yyAR8qBkN3YuheJanUpWC5U3bb5osDywNB8RzDVlDwDHbocAJveqqj1u8+SVD7jkWT4yvsHCpWqqWqAxb0zCA==}
dev: true
/minipass/3.3.6:
resolution: {integrity: sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==}
@@ -10010,7 +9994,6 @@ packages:
/object-hash/3.0.0:
resolution: {integrity: sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==}
engines: {node: '>= 6'}
dev: true
/object-inspect/1.12.3:
resolution: {integrity: sha512-geUvdk7c+eizMNUDkRpW1wJwgfOiOeHbxBR/hLXK1aT6zmVSO0jsQcs7fj6MGw89jC/cjGfLcNOrtMYtGqm81g==}
@@ -10296,7 +10279,6 @@ packages:
/pify/2.3.0:
resolution: {integrity: sha512-udgsAY+fTnvv7kI7aaxbqwWNb0AHiB0qBO89PZKPkoTmGOgdbrHDKD+0B2X4uTfJ/FT1R09r9gTsjUjNJotuog==}
engines: {node: '>=0.10.0'}
dev: true
/pify/3.0.0:
resolution: {integrity: sha512-C3FsVNH1udSEX48gGX1xfvwTWfsYWj5U+8/uK15BGzIGrKoUpghX8hWZwa/OFnakBiiVNmBvemTJR5mcy7iPcg==}
@@ -10412,7 +10394,6 @@ packages:
postcss-value-parser: 4.2.0
read-cache: 1.0.0
resolve: 1.22.1
dev: true
/postcss-import/15.1.0:
resolution: {integrity: sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==}
@@ -10433,7 +10414,6 @@ packages:
dependencies:
camelcase-css: 2.0.1
postcss: 8.4.21
dev: true
/postcss-load-config/3.1.4_postcss@8.4.21:
resolution: {integrity: sha512-6DiM4E7v4coTE4uzA8U//WhtPwyhiim3eyjEMFCnUpzbrkK9wJHgKDT2mR+HbtSrd/NubVaYTOpSpjUl8NQeRg==}
@@ -10450,7 +10430,6 @@ packages:
lilconfig: 2.0.6
postcss: 8.4.21
yaml: 1.10.2
dev: true
/postcss-nested/6.0.0_postcss@8.4.21:
resolution: {integrity: sha512-0DkamqrPcmkBDsLn+vQDIrtkSbNkv5AD/M322ySo9kqFkCIYklym2xEmWkwo+Y3/qZo34tzEPNUw4y7yMCdv5w==}
@@ -10460,7 +10439,6 @@ packages:
dependencies:
postcss: 8.4.21
postcss-selector-parser: 6.0.11
dev: true
/postcss-selector-parser/6.0.11:
resolution: {integrity: sha512-zbARubNdogI9j7WY4nQJBiNqQf3sLS3wCP4WfOidu+p28LofJqDH1tcXypGrcmMHhDk2t9wGhCsYe/+szLTy1g==}
@@ -10468,11 +10446,9 @@ packages:
dependencies:
cssesc: 3.0.0
util-deprecate: 1.0.2
dev: true
/postcss-value-parser/4.2.0:
resolution: {integrity: sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==}
dev: true
/postcss/8.4.14:
resolution: {integrity: sha512-E398TUmfAYFPBSdzgeieK2Y1+1cpdxJx8yXbK/m57nRhKSmk1GB2tO4lbLBtlkfPQTDKfe4Xqv1ASWPpayPEig==}
@@ -10489,7 +10465,6 @@ packages:
nanoid: 3.3.4
picocolors: 1.0.0
source-map-js: 1.0.2
dev: true
/preact/10.13.0:
resolution: {integrity: sha512-ERdIdUpR6doqdaSIh80hvzebHB7O6JxycOhyzAeLEchqOq/4yueslQbfnPwXaNhAYacFTyCclhwkEbOumT0tHw==}
@@ -10643,7 +10618,6 @@ packages:
/queue-microtask/1.2.3:
resolution: {integrity: sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==}
dev: true
/quick-format-unescaped/4.0.4:
resolution: {integrity: sha512-tYC1Q1hgyRuHgloV/YXs2w15unPVh8qfu/qCTfhTYamaw7fyhumKa2yGpdSo87vY32rIclj+4fWYQXUMs9EHvg==}
@@ -10652,7 +10626,6 @@ packages:
/quick-lru/5.1.1:
resolution: {integrity: sha512-WuyALRjWPDGtt/wzJiadO5AXY+8hZ80hVpe6MyivgraREW751X3SbhRvG3eLKOYN+8VEvqLcf3wdnt44Z4S4SA==}
engines: {node: '>=10'}
dev: true
/randombytes/2.1.0:
resolution: {integrity: sha512-vYl3iOX+4CKUWuxGi9Ukhie6fsqXqS9FE2Zaic4tNFD2N2QQaXOMFbuKK4QmDHC0JO6B1Zp41J0LpT0oR68amQ==}
@@ -10917,7 +10890,6 @@ packages:
resolution: {integrity: sha512-Owdv/Ft7IjOgm/i0xvNDZ1LrRANRfew4b2prF3OWMQLxLfu3bS8FVhCsrSCMK4lR56Y9ya+AThoTpDCTxCmpRA==}
dependencies:
pify: 2.3.0
dev: true
/readable-stream/3.6.0:
resolution: {integrity: sha512-BViHy7LKeTz4oNnkcLJ+lVSL6vpiFeX6/d3oSH8zCW7UxP2onchk+vTGB143xuFjHS3deTgkKoXXymXqymiIdA==}
@@ -11265,7 +11237,6 @@ packages:
/reusify/1.0.4:
resolution: {integrity: sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==}
engines: {iojs: '>=1.0.0', node: '>=0.10.0'}
dev: true
/rfdc/1.3.0:
resolution: {integrity: sha512-V2hovdzFbOi77/WajaSMXk2OLm+xNIeQdMMuB7icj7bk6zi2F8GGAxigcnDFpJHbNyNcgyJDiP+8nOrY5cZGrA==}
@@ -11343,7 +11314,6 @@ packages:
resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
dependencies:
queue-microtask: 1.2.3
dev: true
/rxjs/6.6.7:
resolution: {integrity: sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==}
@@ -11946,6 +11916,18 @@ packages:
resolution: {integrity: sha512-4kl5w+nCB44EVRdO0g/UGoOp3vlwgycUVtkk/7DPyeLZUCuNFFKCFG6/t/DgHLrUPHjrZg6s5tNm+56Q2B0xyg==}
dev: false
/tailwind-merge/1.10.0:
resolution: {integrity: sha512-WFnDXSS4kFTZwjKg5/oZSGzBRU/l+qcbv5NVTzLUQvJ9yovDAP05h0F2+ZFW0Lw9EcgRoc2AfURUdZvnEFrXKg==}
dev: false
/tailwindcss-animate/1.0.5_tailwindcss@3.2.7:
resolution: {integrity: sha512-UU3qrOJ4lFQABY+MVADmBm+0KW3xZyhMdRvejwtXqYOL7YjHYxmuREFAZdmVG5LPe5E9CAst846SLC4j5I3dcw==}
peerDependencies:
tailwindcss: '>=3.0.0 || insiders'
dependencies:
tailwindcss: 3.2.7
dev: false
/tailwindcss/3.2.7:
resolution: {integrity: sha512-B6DLqJzc21x7wntlH/GsZwEXTBttVSl1FtCzC8WP4oBc/NKef7kaax5jeihkkCEWc831/5NDJ9gRNDK6NEioQQ==}
engines: {node: '>=12.13.0'}
@@ -11976,7 +11958,6 @@ packages:
resolve: 1.22.1
transitivePeerDependencies:
- ts-node
dev: true
/tapable/2.2.1:
resolution: {integrity: sha512-GNzQvQTOIP6RyTfE2Qxb8ZVlNmw0n88vp1szwWRimP02mnTsx3Wtn5qRdqY9w2XduFNUgvOwhNnQsjwCp+kqaQ==}
+2 -2
View File
@@ -4,7 +4,7 @@ import { FollowingButton } from "~/components/common/FollowingButton"
import { FollowingCount } from "~/components/common/FollowingCount"
import * as siteModel from "~/models/site.model"
import type { Profile } from "~/lib/types"
import clsx from "clsx"
import { cn } from "~/lib/utils"
import { useDate } from "~/hooks/useDate"
import { useTranslation } from "next-i18next"
@@ -40,7 +40,7 @@ export const CharacterCard: React.FC<{
return (
<span
className={clsx(
className={cn(
"border-gray-100 rounded-lg space-y-2 text-sm block",
style === "flat" ? "" : "p-4 bg-white shadow-xl",
)}
-1
View File
@@ -1,4 +1,3 @@
import clsx from "clsx"
import { Modal } from "~/components/ui/Modal"
import InfiniteScroll from "react-infinite-scroller"
import { Button } from "../ui/Button"
+2 -2
View File
@@ -1,4 +1,4 @@
import clsx from "clsx"
import { cn } from "~/lib/utils"
import { Note } from "~/lib/types"
import { useGetComments } from "~/queries/page"
import { CommentItem } from "~/components/common/CommentItem"
@@ -15,7 +15,7 @@ export const Comment: React.FC<{
const { t } = useTranslation("common")
return (
<div className={clsx("xlog-comment", "comment", className)} id="comments">
<div className={cn("xlog-comment", "comment", className)} id="comments">
<div className="xlog-comment-count border-b pb-2 mb-6">
<span>
{comments.data?.count || "0"}{" "}
+2 -2
View File
@@ -8,7 +8,7 @@ import {
useAccountSites,
} from "~/queries/site"
import { useConnectedAction } from "@crossbell/connect-kit"
import clsx from "clsx"
import { cn } from "~/lib/utils"
import { Profile } from "~/lib/types"
import { useTranslation } from "next-i18next"
@@ -65,7 +65,7 @@ export const FollowingButton: React.FC<{
<Button
variant={variant}
onClick={handleClickSubscribe}
className={clsx(className, "align-middle space-x-1 group")}
className={cn(className, "align-middle space-x-1 group")}
isLoading={
subscription.data
? unsubscribeFromSite.isLoading || subscribeToSite.isLoading
+2 -2
View File
@@ -1,4 +1,4 @@
import clsx from "clsx"
import { cn } from "~/lib/utils"
import { useCodeCopy } from "~/hooks/useCodeCopy"
import { renderPageContent } from "~/markdown"
import { PostToc } from "~/components/site/PostToc"
@@ -36,7 +36,7 @@ export const PageContent: React.FC<{
return (
<div
className={clsx("relative", className)}
className={cn("relative", className)}
onMouseEnter={onMouseEnter}
onScroll={(e) => onScroll?.((e.target as any)?.scrollTop)}
>
+4 -7
View File
@@ -18,7 +18,7 @@ import { Avatar } from "../ui/Avatar"
import { MintIcon } from "~/components/icons/MintIcon"
import { getMints, parsePageId } from "~/models/page.model"
import { CharacterList } from "~/components/common/CharacterList"
import clsx from "clsx"
import { cn } from "~/lib/utils"
import { Tooltip } from "~/components/ui/Tooltip"
import confetti from "canvas-confetti"
import { Trans, useTranslation } from "next-i18next"
@@ -147,14 +147,14 @@ export const Reactions: React.FC<{
return (
<>
<div
className={clsx(
className={cn(
"xlog-reactions flex fill-gray-400 text-gray-500 items-center",
size === "sm" ? "text-sm" : "",
className,
)}
>
<div
className={clsx(
className={cn(
"xlog-reactions-like flex items-center",
size === "sm" ? "mr-3" : "mr-10",
)}
@@ -218,10 +218,7 @@ export const Reactions: React.FC<{
ref={mintRef}
>
<MintIcon
className={clsx(
"mr-2",
size === "sm" ? "w-3 h-3" : "w-8 h-8",
)}
className={cn("mr-2", size === "sm" ? "w-3 h-3" : "w-8 h-8")}
/>
<span>{mints.data?.count || 0}</span>
</Button>
+3 -3
View File
@@ -1,4 +1,4 @@
import clsx from "clsx"
import { cn } from "~/lib/utils"
import { useRouter } from "next/router"
import React, { useEffect } from "react"
@@ -159,7 +159,7 @@ export function DashboardLayout({
<UniLink
href={link.href}
key={link.text}
className={clsx(
className={cn(
`flex px-4 h-12 items-center rounded-md space-x-2 w-full transition-colors`,
active
? `bg-slate-200 font-medium text-slate-800`
@@ -168,7 +168,7 @@ export function DashboardLayout({
)}
onClick={link.onClick}
>
<span className={clsx(link.icon, "text-lg")}></span>
<span className={cn(link.icon, "text-lg")}></span>
{isOpen && <span>{t(link.text)}</span>}
</UniLink>
)
+2 -2
View File
@@ -1,4 +1,4 @@
import clsx from "clsx"
import { cn } from "~/lib/utils"
export const DashboardMain: React.FC<{
children: React.ReactNode
@@ -7,7 +7,7 @@ export const DashboardMain: React.FC<{
return (
<div className="flex-1 overflow-scroll">
<div
className={clsx(
className={cn(
fullWidth
? "relative"
: "max-w-screen-2xl relative px-5 py-5 md:px-10",
+4 -4
View File
@@ -3,7 +3,7 @@ import { getPageVisibility } from "~/lib/page-helpers"
import { useDate } from "~/hooks/useDate"
import { TabItem, Tabs } from "../ui/Tabs"
import { Menu } from "@headlessui/react"
import clsx from "clsx"
import { cn } from "~/lib/utils"
import { PageVisibilityEnum } from "~/lib/types"
import { DashboardMain } from "./DashboardMain"
import { useRouter } from "next/router"
@@ -339,7 +339,7 @@ export const PagesManager: React.FC<{
<h2 className="text-2xl font-bold">{t(title)}</h2>
<div className="flex justify-center items-center space-x-4">
<Button
className={clsx(`space-x-2 inline-flex`)}
className={cn(`space-x-2 inline-flex`)}
onClick={() =>
router.push(
`/dashboard/${subdomain}/editor?type=${
@@ -367,7 +367,7 @@ export const PagesManager: React.FC<{
label={t("Import markdown file with front matter supported")}
placement="bottom"
>
<Button className={clsx(`space-x-2`)} onClick={importFile}>
<Button className={cn(`space-x-2`)} onClick={importFile}>
<span className="i-bxs:duplicate inline-block"></span>
<span>{t("Import")}</span>
</Button>
@@ -423,7 +423,7 @@ export const PagesManager: React.FC<{
<>
<Menu.Button as={Fragment}>
<button
className={clsx(
className={cn(
`text-gray-400 relative z-50 w-8 h-8 rounded inline-flex invisible group-hover:visible justify-center items-center`,
open ? `bg-gray-200` : `hover:bg-gray-200`,
)}
+2 -2
View File
@@ -2,7 +2,7 @@ import { Image } from "~/components/ui/Image"
import { UniLink } from "~/components/ui/UniLink"
import { PlanetIcon } from "~/components/icons/PlanetIcon"
import { Tooltip } from "~/components/ui/Tooltip"
import clsx from "clsx"
import { cn } from "~/lib/utils"
const syncMap: {
[key: string]: {
@@ -85,7 +85,7 @@ export const Platform: React.FC<{
platform = platform.toLowerCase()
return (
<UniLink
className={clsx(
className={cn(
"inline-flex hover:scale-110 transition-transform ease align-middle",
className,
)}
+2 -2
View File
@@ -1,4 +1,4 @@
import clsx from "clsx"
import { cn } from "~/lib/utils"
import { useRouter } from "next/router"
import { CSB_SCAN, CSB_IO, CSB_XCHAR } from "~/lib/env"
import { getUserContentsUrl } from "~/lib/user-contents"
@@ -37,7 +37,7 @@ const HeaderLink: React.FC<{ link: HeaderLinkType }> = ({ link }) => {
<UniLink
href={link.url}
onClick={link.onClick}
className={clsx(
className={cn(
`xlog-site-navigation-item h-10 flex items-center space-x-1 transition-colors relative after:content-[''] hover:after:w-full hover:after:left-0 after:transition-[width,left] after:h-[2px] after:block after:absolute after:bottom-0`,
active
? `text-accent after:w-full after:left-0 after:bg-accent`
+2 -2
View File
@@ -12,7 +12,7 @@ import { IS_PROD } from "~/lib/constants"
import { toGateway } from "~/lib/ipfs-parser"
import { useUserRole } from "~/hooks/useUserRole"
import { useGetSubscription } from "~/queries/site"
import clsx from "clsx"
import { cn } from "~/lib/utils"
import { useCheckLike, useCheckMint } from "~/queries/page"
import { useAccountState } from "@crossbell/connect-kit"
@@ -66,7 +66,7 @@ export const SiteLayout: React.FC<SiteLayoutProps> = ({
return (
<div
className={clsx(
className={cn(
{
"xlog-user": true,
"xlog-user-login": isConnected,
+4 -4
View File
@@ -1,4 +1,4 @@
import clsx from "clsx"
import { cn } from "~/lib/utils"
import React, { useMemo } from "react"
import { toGateway } from "~/lib/ipfs-parser"
import { Image } from "~/components/ui/Image"
@@ -34,7 +34,7 @@ export const Avatar: React.FC<
return (
<span
{...props}
className={clsx(
className={cn(
`inline-flex text-white bg-gray-400 items-center justify-center text-xl font-medium uppercase flex-shrink-0`,
borderRadius,
className,
@@ -53,8 +53,8 @@ export const Avatar: React.FC<
return (
<span
{...props}
className={clsx(
`inline-flex text-zinc-500 bg-gray-400 flex-shrink-0 items-center justify-center text-xl font-medium uppercase overflow-hidden text-[0px]`,
className={cn(
`inline-flex text-zinc-500 flex-shrink-0 items-center justify-center text-xl font-medium uppercase overflow-hidden text-[0px]`,
borderRadius,
className,
)}
+2 -2
View File
@@ -1,4 +1,4 @@
import clsx from "clsx"
import { cn } from "~/lib/utils"
import React from "react"
export const Badge: React.FC<{
@@ -7,7 +7,7 @@ export const Badge: React.FC<{
}> = ({ children, className }) => {
return (
<span
className={clsx(
className={cn(
`relative rounded uppercase bg-yellow-400 text-white h-5 inline-flex items-center px-1 font-semibold text-xs`,
className,
)}
+2 -2
View File
@@ -1,5 +1,5 @@
import React from "react"
import clsx from "clsx"
import { cn } from "~/lib/utils"
export const ButtonGroup: React.FC<{ children: React.ReactNode }> = ({
children,
@@ -52,7 +52,7 @@ export const Button = React.forwardRef<
ref={ref}
type={type || "button"}
disabled={isDisabled || isLoading}
className={clsx(
className={cn(
className,
"button",
isLoading && "is-loading",
+1 -1
View File
@@ -1,5 +1,5 @@
import { EditorView } from "@codemirror/view"
import clsx from "clsx"
import { cn } from "~/lib/utils"
import { Dispatch, FC, SetStateAction } from "react"
import { ICommand } from "~/editor"
import { Tooltip } from "./Tooltip"
+1 -1
View File
@@ -1,7 +1,7 @@
import React from "react"
import { default as NextImage, ImageProps } from "next/image"
import { toGateway, toIPFS } from "~/lib/ipfs-parser"
import clsx from "clsx"
import { cn } from "~/lib/utils"
export const Image: React.FC<
{
+2 -2
View File
@@ -1,4 +1,4 @@
import clsx from "clsx"
import { cn } from "~/lib/utils"
import React, { ChangeEvent, forwardRef, useEffect } from "react"
import { useState } from "react"
import { useUploadFile } from "~/hooks/useUploadFile"
@@ -82,7 +82,7 @@ export const ImageUploader = forwardRef(function ImageUploader(
return (
<div
className={clsx(
className={cn(
"relative flex-col overflow-hidden border border-gray-100",
className,
)}
+2 -2
View File
@@ -1,4 +1,4 @@
import clsx from "clsx"
import { cn } from "~/lib/utils"
import { forwardRef } from "react"
import { FieldLabel } from "./FieldLabel"
@@ -46,7 +46,7 @@ export const Input = forwardRef(function Input<
<Component
{...inputProps}
ref={ref as any}
className={clsx(
className={cn(
"input",
hasAddon && `has-addon`,
hasPrefix && `has-prefix`,
+3 -3
View File
@@ -1,5 +1,5 @@
import { Dialog } from "@headlessui/react"
import clsx from "clsx"
import { cn } from "~/lib/utils"
import React from "react"
export const Modal: React.FC<{
@@ -21,13 +21,13 @@ export const Modal: React.FC<{
{/* Full-screen container to center the panel */}
<div
className={clsx(
className={cn(
`fixed inset-0 flex items-center justify-center p-4 z-40`,
)}
>
{/* The actual dialog panel */}
<Dialog.Panel
className={clsx(
className={cn(
`mx-auto rounded-lg bg-white w-full shadow-modal max-h-full overflow-y-auto flex flex-col`,
size === "md"
+2 -2
View File
@@ -1,4 +1,4 @@
import clsx from "clsx"
import { cn } from "~/lib/utils"
import React from "react"
import { UniLink } from "./UniLink"
import { useTranslation } from "next-i18next"
@@ -24,7 +24,7 @@ export const Tabs: React.FC<{ items: TabItem[] }> = ({ items }) => {
href={item.href}
onClick={item.onClick}
key={item.text}
className={clsx(
className={cn(
`border-b-2 inline-flex items-center h-10 whitespace-nowrap`,
item.active
? `border-accent text-black font-medium`
+2 -2
View File
@@ -13,7 +13,7 @@ import {
useDismiss,
useTransitionStyles,
} from "@floating-ui/react"
import clsx from "clsx"
import { cn } from "~/lib/utils"
interface Props {
label: string
@@ -61,7 +61,7 @@ export const Tooltip = ({
{isMounted && (
<div
ref={refs.setFloating}
className={clsx(
className={cn(
"bg-zinc-600 text-white rounded-lg shadow-lg px-3 py-1 whitespace-nowrap",
className,
)}
+7
View File
@@ -1,3 +1,6 @@
import { ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"
type Truthy<T> = T extends false | "" | 0 | null | undefined ? never : T // from lodash
export function truthy<T>(value: T): value is Truthy<T> {
@@ -7,3 +10,7 @@ export function truthy<T>(value: T): value is Truthy<T> {
export function stripHTML(html: string) {
return html.replace(/<(?:.|\n)*?>/gm, "")
}
export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
+2 -2
View File
@@ -1,4 +1,4 @@
import clsx from "clsx"
import { cn } from "~/lib/utils"
import { useDate } from "~/hooks/useDate"
import { useRouter } from "next/router"
import {
@@ -413,7 +413,7 @@ export default function SubdomainEditor() {
</div>
<div className="flex items-center space-x-3">
<span
className={clsx(
className={cn(
`text-sm capitalize`,
visibility === PageVisibilityEnum.Draft
? `text-zinc-300`
+2 -1
View File
@@ -1,3 +1,4 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/**/*.tsx"],
theme: {
@@ -60,5 +61,5 @@ module.exports = {
},
},
variants: {},
plugins: [require("@tailwindcss/line-clamp")],
plugins: [require("@tailwindcss/line-clamp"), require("tailwindcss-animate")],
}