@lark-apaas/coding-templates 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (262) hide show
  1. package/package.json +2 -3
  2. package/template-html/README.md +1 -1
  3. package/template-vite-react/_gitignore +24 -0
  4. package/template-vite-react/client/index.html +13 -0
  5. package/template-vite-react/client/public/favicon.svg +1 -0
  6. package/template-vite-react/client/public/icons.svg +24 -0
  7. package/template-vite-react/client/src/api/index.ts +7 -0
  8. package/template-vite-react/client/src/app.tsx +17 -0
  9. package/{template-nextjs-static → template-vite-react/client}/src/components/header.tsx +5 -13
  10. package/template-vite-react/client/src/components/layout.tsx +13 -0
  11. package/template-vite-react/client/src/components/theme-provider.tsx +45 -0
  12. package/template-vite-react/client/src/components/ui/accordion.tsx +72 -0
  13. package/template-vite-react/client/src/components/ui/alert-dialog.tsx +187 -0
  14. package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/alert.tsx +15 -10
  15. package/template-vite-react/client/src/components/ui/aspect-ratio.tsx +22 -0
  16. package/template-vite-react/client/src/components/ui/avatar.tsx +109 -0
  17. package/template-vite-react/client/src/components/ui/badge.tsx +52 -0
  18. package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/breadcrumb.tsx +39 -23
  19. package/template-vite-react/client/src/components/ui/button.tsx +58 -0
  20. package/{template-nextjs-static → template-vite-react/client}/src/components/ui/calendar.tsx +43 -37
  21. package/template-vite-react/client/src/components/ui/card.tsx +103 -0
  22. package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/carousel.tsx +8 -7
  23. package/{template-nextjs-static → template-vite-react/client}/src/components/ui/chart.tsx +49 -35
  24. package/template-vite-react/client/src/components/ui/checkbox.tsx +29 -0
  25. package/template-vite-react/client/src/components/ui/collapsible.tsx +19 -0
  26. package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/command.tsx +40 -52
  27. package/template-vite-react/client/src/components/ui/context-menu.tsx +271 -0
  28. package/template-vite-react/client/src/components/ui/dialog.tsx +158 -0
  29. package/{template-nextjs-static → template-vite-react/client}/src/components/ui/drawer.tsx +9 -12
  30. package/template-vite-react/client/src/components/ui/dropdown-menu.tsx +268 -0
  31. package/template-vite-react/client/src/components/ui/hover-card.tsx +49 -0
  32. package/template-vite-react/client/src/components/ui/input-group.tsx +156 -0
  33. package/{template-nextjs-static → template-vite-react/client}/src/components/ui/input-otp.tsx +17 -7
  34. package/template-vite-react/client/src/components/ui/input.tsx +20 -0
  35. package/template-vite-react/client/src/components/ui/label.tsx +18 -0
  36. package/template-vite-react/client/src/components/ui/menubar.tsx +280 -0
  37. package/template-vite-react/client/src/components/ui/navigation-menu.tsx +168 -0
  38. package/{template-nextjs-static → template-vite-react/client}/src/components/ui/pagination.tsx +35 -32
  39. package/template-vite-react/client/src/components/ui/popover.tsx +90 -0
  40. package/template-vite-react/client/src/components/ui/progress.tsx +81 -0
  41. package/template-vite-react/client/src/components/ui/radio-group.tsx +38 -0
  42. package/template-vite-react/client/src/components/ui/resizable.tsx +48 -0
  43. package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/scroll-area.tsx +10 -13
  44. package/template-vite-react/client/src/components/ui/select.tsx +199 -0
  45. package/template-vite-react/client/src/components/ui/separator.tsx +25 -0
  46. package/template-vite-react/client/src/components/ui/sheet.tsx +138 -0
  47. package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/sidebar.tsx +156 -162
  48. package/{template-nextjs-static → template-vite-react/client}/src/components/ui/skeleton.tsx +1 -1
  49. package/template-vite-react/client/src/components/ui/slider.tsx +57 -0
  50. package/template-vite-react/client/src/components/ui/sonner.tsx +49 -0
  51. package/template-vite-react/client/src/components/ui/switch.tsx +30 -0
  52. package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/table.tsx +5 -5
  53. package/template-vite-react/client/src/components/ui/tabs.tsx +80 -0
  54. package/template-vite-react/client/src/components/ui/textarea.tsx +18 -0
  55. package/template-vite-react/client/src/components/ui/toggle-group.tsx +89 -0
  56. package/template-vite-react/client/src/components/ui/toggle.tsx +44 -0
  57. package/template-vite-react/client/src/components/ui/tooltip.tsx +64 -0
  58. package/template-vite-react/client/src/index.css +1 -0
  59. package/template-vite-react/client/src/main.tsx +13 -0
  60. package/template-vite-react/client/src/pages/home/index.tsx +12 -0
  61. package/template-vite-react/client/src/pages/not-found/index.tsx +11 -0
  62. package/template-vite-react/client/src/types/index.ts +1 -0
  63. package/{template-nextjs-static → template-vite-react}/components.json +2 -2
  64. package/template-vite-react/eslint.config.js +23 -0
  65. package/template-vite-react/package.json +58 -0
  66. package/template-vite-react/scripts/build.sh +40 -0
  67. package/template-vite-react/shared/types.ts +1 -0
  68. package/template-vite-react/tsconfig.app.json +33 -0
  69. package/template-vite-react/tsconfig.json +14 -0
  70. package/template-vite-react/tsconfig.node.json +26 -0
  71. package/template-vite-react/vite.config.ts +17 -0
  72. package/template-nextjs-fullstack/README.md +0 -169
  73. package/template-nextjs-fullstack/_env.local.example +0 -1
  74. package/template-nextjs-fullstack/_gitignore +0 -41
  75. package/template-nextjs-fullstack/components.json +0 -25
  76. package/template-nextjs-fullstack/drizzle.config.ts +0 -10
  77. package/template-nextjs-fullstack/eslint.config.js +0 -15
  78. package/template-nextjs-fullstack/next.config.ts +0 -5
  79. package/template-nextjs-fullstack/package.json +0 -85
  80. package/template-nextjs-fullstack/postcss.config.js +0 -8
  81. package/template-nextjs-fullstack/scripts/build.sh +0 -37
  82. package/template-nextjs-fullstack/src/app/favicon.ico +0 -0
  83. package/template-nextjs-fullstack/src/app/globals.css +0 -130
  84. package/template-nextjs-fullstack/src/app/layout.tsx +0 -24
  85. package/template-nextjs-fullstack/src/app/page.tsx +0 -69
  86. package/template-nextjs-fullstack/src/app/todos/actions.ts +0 -37
  87. package/template-nextjs-fullstack/src/app/todos/page.tsx +0 -26
  88. package/template-nextjs-fullstack/src/app/todos/todo-form.tsx +0 -27
  89. package/template-nextjs-fullstack/src/app/todos/todo-list.tsx +0 -44
  90. package/template-nextjs-fullstack/src/components/header.tsx +0 -32
  91. package/template-nextjs-fullstack/src/components/theme-provider.tsx +0 -8
  92. package/template-nextjs-fullstack/src/components/ui/README.md +0 -134
  93. package/template-nextjs-fullstack/src/components/ui/accordion.tsx +0 -66
  94. package/template-nextjs-fullstack/src/components/ui/alert-dialog.tsx +0 -157
  95. package/template-nextjs-fullstack/src/components/ui/aspect-ratio.tsx +0 -11
  96. package/template-nextjs-fullstack/src/components/ui/avatar.tsx +0 -53
  97. package/template-nextjs-fullstack/src/components/ui/badge.tsx +0 -42
  98. package/template-nextjs-fullstack/src/components/ui/button.tsx +0 -69
  99. package/template-nextjs-fullstack/src/components/ui/calendar.tsx +0 -213
  100. package/template-nextjs-fullstack/src/components/ui/card.tsx +0 -82
  101. package/template-nextjs-fullstack/src/components/ui/chart.tsx +0 -357
  102. package/template-nextjs-fullstack/src/components/ui/checkbox.tsx +0 -32
  103. package/template-nextjs-fullstack/src/components/ui/collapsible.tsx +0 -33
  104. package/template-nextjs-fullstack/src/components/ui/context-menu.tsx +0 -324
  105. package/template-nextjs-fullstack/src/components/ui/dialog.tsx +0 -143
  106. package/template-nextjs-fullstack/src/components/ui/drawer.tsx +0 -135
  107. package/template-nextjs-fullstack/src/components/ui/dropdown-menu.tsx +0 -329
  108. package/template-nextjs-fullstack/src/components/ui/hover-card.tsx +0 -44
  109. package/template-nextjs-fullstack/src/components/ui/input-group.tsx +0 -166
  110. package/template-nextjs-fullstack/src/components/ui/input-otp.tsx +0 -77
  111. package/template-nextjs-fullstack/src/components/ui/input.tsx +0 -21
  112. package/template-nextjs-fullstack/src/components/ui/label.tsx +0 -24
  113. package/template-nextjs-fullstack/src/components/ui/menubar.tsx +0 -348
  114. package/template-nextjs-fullstack/src/components/ui/navigation-menu.tsx +0 -168
  115. package/template-nextjs-fullstack/src/components/ui/pagination.tsx +0 -127
  116. package/template-nextjs-fullstack/src/components/ui/popover.tsx +0 -48
  117. package/template-nextjs-fullstack/src/components/ui/progress.tsx +0 -31
  118. package/template-nextjs-fullstack/src/components/ui/radio-group.tsx +0 -45
  119. package/template-nextjs-fullstack/src/components/ui/resizable.tsx +0 -56
  120. package/template-nextjs-fullstack/src/components/ui/select.tsx +0 -243
  121. package/template-nextjs-fullstack/src/components/ui/separator.tsx +0 -28
  122. package/template-nextjs-fullstack/src/components/ui/sheet.tsx +0 -139
  123. package/template-nextjs-fullstack/src/components/ui/skeleton.tsx +0 -13
  124. package/template-nextjs-fullstack/src/components/ui/slider.tsx +0 -87
  125. package/template-nextjs-fullstack/src/components/ui/sonner.tsx +0 -67
  126. package/template-nextjs-fullstack/src/components/ui/switch.tsx +0 -31
  127. package/template-nextjs-fullstack/src/components/ui/tabs.tsx +0 -66
  128. package/template-nextjs-fullstack/src/components/ui/textarea.tsx +0 -18
  129. package/template-nextjs-fullstack/src/components/ui/toggle-group.tsx +0 -83
  130. package/template-nextjs-fullstack/src/components/ui/toggle.tsx +0 -47
  131. package/template-nextjs-fullstack/src/components/ui/tooltip.tsx +0 -61
  132. package/template-nextjs-fullstack/src/db/index.ts +0 -8
  133. package/template-nextjs-fullstack/src/db/schema.ts +0 -11
  134. package/template-nextjs-fullstack/tailwind.config.ts +0 -10
  135. package/template-nextjs-fullstack/tsconfig.json +0 -34
  136. package/template-nextjs-static/README.md +0 -80
  137. package/template-nextjs-static/_gitignore +0 -41
  138. package/template-nextjs-static/eslint.config.js +0 -15
  139. package/template-nextjs-static/next.config.ts +0 -8
  140. package/template-nextjs-static/package.json +0 -77
  141. package/template-nextjs-static/postcss.config.js +0 -8
  142. package/template-nextjs-static/public/favicon.ico +0 -0
  143. package/template-nextjs-static/scripts/build.sh +0 -36
  144. package/template-nextjs-static/src/components/theme-provider.tsx +0 -6
  145. package/template-nextjs-static/src/components/ui/README.md +0 -134
  146. package/template-nextjs-static/src/components/ui/accordion.tsx +0 -66
  147. package/template-nextjs-static/src/components/ui/alert-dialog.tsx +0 -157
  148. package/template-nextjs-static/src/components/ui/alert.tsx +0 -71
  149. package/template-nextjs-static/src/components/ui/aspect-ratio.tsx +0 -11
  150. package/template-nextjs-static/src/components/ui/avatar.tsx +0 -53
  151. package/template-nextjs-static/src/components/ui/badge.tsx +0 -42
  152. package/template-nextjs-static/src/components/ui/breadcrumb.tsx +0 -109
  153. package/template-nextjs-static/src/components/ui/button-group.tsx +0 -83
  154. package/template-nextjs-static/src/components/ui/button.tsx +0 -69
  155. package/template-nextjs-static/src/components/ui/card.tsx +0 -82
  156. package/template-nextjs-static/src/components/ui/carousel.tsx +0 -241
  157. package/template-nextjs-static/src/components/ui/checkbox.tsx +0 -32
  158. package/template-nextjs-static/src/components/ui/collapsible.tsx +0 -33
  159. package/template-nextjs-static/src/components/ui/command.tsx +0 -208
  160. package/template-nextjs-static/src/components/ui/context-menu.tsx +0 -324
  161. package/template-nextjs-static/src/components/ui/dialog.tsx +0 -143
  162. package/template-nextjs-static/src/components/ui/dropdown-menu.tsx +0 -329
  163. package/template-nextjs-static/src/components/ui/empty.tsx +0 -104
  164. package/template-nextjs-static/src/components/ui/field.tsx +0 -248
  165. package/template-nextjs-static/src/components/ui/form.tsx +0 -167
  166. package/template-nextjs-static/src/components/ui/hover-card.tsx +0 -44
  167. package/template-nextjs-static/src/components/ui/icons/file-ae-colorful-icon.tsx +0 -21
  168. package/template-nextjs-static/src/components/ui/icons/file-ai-colorful-icon.tsx +0 -36
  169. package/template-nextjs-static/src/components/ui/icons/file-android-colorful-icon.tsx +0 -33
  170. package/template-nextjs-static/src/components/ui/icons/file-audio-colorful-icon.tsx +0 -21
  171. package/template-nextjs-static/src/components/ui/icons/file-code-colorful-icon.tsx +0 -28
  172. package/template-nextjs-static/src/components/ui/icons/file-csv-colorful-icon.tsx +0 -21
  173. package/template-nextjs-static/src/components/ui/icons/file-eml-colorful-icon.tsx +0 -29
  174. package/template-nextjs-static/src/components/ui/icons/file-ios-colorful-icon.tsx +0 -25
  175. package/template-nextjs-static/src/components/ui/icons/file-keynote-colorful-icon.tsx +0 -29
  176. package/template-nextjs-static/src/components/ui/icons/file-pages-colorful-icon.tsx +0 -29
  177. package/template-nextjs-static/src/components/ui/icons/file-ps-colorful-icon.tsx +0 -21
  178. package/template-nextjs-static/src/components/ui/icons/file-sketch-colorful-icon.tsx +0 -21
  179. package/template-nextjs-static/src/components/ui/icons/file-slide-colorful-icon.tsx +0 -21
  180. package/template-nextjs-static/src/components/ui/icons/file-vcf-colorful-icon.tsx +0 -29
  181. package/template-nextjs-static/src/components/ui/icons/file-wiki-excel-colorful-icon.tsx +0 -23
  182. package/template-nextjs-static/src/components/ui/icons/file-wiki-image-colorful-icon.tsx +0 -27
  183. package/template-nextjs-static/src/components/ui/icons/file-wiki-pdf-colorful-icon.tsx +0 -20
  184. package/template-nextjs-static/src/components/ui/icons/file-wiki-ppt-colorful-icon.tsx +0 -21
  185. package/template-nextjs-static/src/components/ui/icons/file-wiki-text-colorful-icon.tsx +0 -12
  186. package/template-nextjs-static/src/components/ui/icons/file-wiki-unknown-colorful-icon.tsx +0 -14
  187. package/template-nextjs-static/src/components/ui/icons/file-wiki-video-colorful-icon.tsx +0 -23
  188. package/template-nextjs-static/src/components/ui/icons/file-wiki-word-colorful-icon.tsx +0 -38
  189. package/template-nextjs-static/src/components/ui/icons/file-wiki-zip-colorful-icon.tsx +0 -21
  190. package/template-nextjs-static/src/components/ui/image.tsx +0 -183
  191. package/template-nextjs-static/src/components/ui/input-group.tsx +0 -166
  192. package/template-nextjs-static/src/components/ui/input.tsx +0 -21
  193. package/template-nextjs-static/src/components/ui/item.tsx +0 -193
  194. package/template-nextjs-static/src/components/ui/kbd.tsx +0 -28
  195. package/template-nextjs-static/src/components/ui/label.tsx +0 -24
  196. package/template-nextjs-static/src/components/ui/menubar.tsx +0 -348
  197. package/template-nextjs-static/src/components/ui/native-select.tsx +0 -48
  198. package/template-nextjs-static/src/components/ui/navigation-menu.tsx +0 -168
  199. package/template-nextjs-static/src/components/ui/popover.tsx +0 -48
  200. package/template-nextjs-static/src/components/ui/progress.tsx +0 -31
  201. package/template-nextjs-static/src/components/ui/radio-group.tsx +0 -45
  202. package/template-nextjs-static/src/components/ui/resizable.tsx +0 -56
  203. package/template-nextjs-static/src/components/ui/scroll-area.tsx +0 -58
  204. package/template-nextjs-static/src/components/ui/select.tsx +0 -243
  205. package/template-nextjs-static/src/components/ui/separator.tsx +0 -28
  206. package/template-nextjs-static/src/components/ui/sheet.tsx +0 -139
  207. package/template-nextjs-static/src/components/ui/sidebar.tsx +0 -727
  208. package/template-nextjs-static/src/components/ui/slider.tsx +0 -87
  209. package/template-nextjs-static/src/components/ui/sonner.tsx +0 -67
  210. package/template-nextjs-static/src/components/ui/spinner.tsx +0 -16
  211. package/template-nextjs-static/src/components/ui/streamdown.tsx +0 -186
  212. package/template-nextjs-static/src/components/ui/switch.tsx +0 -31
  213. package/template-nextjs-static/src/components/ui/table.tsx +0 -116
  214. package/template-nextjs-static/src/components/ui/tabs.tsx +0 -66
  215. package/template-nextjs-static/src/components/ui/textarea.tsx +0 -18
  216. package/template-nextjs-static/src/components/ui/toggle-group.tsx +0 -83
  217. package/template-nextjs-static/src/components/ui/toggle.tsx +0 -47
  218. package/template-nextjs-static/src/components/ui/tooltip.tsx +0 -61
  219. package/template-nextjs-static/src/hooks/use-mobile.ts +0 -19
  220. package/template-nextjs-static/src/lib/utils.ts +0 -6
  221. package/template-nextjs-static/src/pages/_app.tsx +0 -11
  222. package/template-nextjs-static/src/pages/_document.tsx +0 -13
  223. package/template-nextjs-static/src/pages/hello.tsx +0 -32
  224. package/template-nextjs-static/src/pages/index.tsx +0 -76
  225. package/template-nextjs-static/src/styles/globals.css +0 -143
  226. package/template-nextjs-static/tailwind.config.ts +0 -10
  227. package/template-nextjs-static/tsconfig.json +0 -34
  228. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/button-group.tsx +0 -0
  229. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/empty.tsx +0 -0
  230. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/field.tsx +0 -0
  231. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/form.tsx +0 -0
  232. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-ae-colorful-icon.tsx +0 -0
  233. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-ai-colorful-icon.tsx +0 -0
  234. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-android-colorful-icon.tsx +0 -0
  235. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-audio-colorful-icon.tsx +0 -0
  236. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-code-colorful-icon.tsx +0 -0
  237. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-csv-colorful-icon.tsx +0 -0
  238. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-eml-colorful-icon.tsx +0 -0
  239. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-ios-colorful-icon.tsx +0 -0
  240. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-keynote-colorful-icon.tsx +0 -0
  241. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-pages-colorful-icon.tsx +0 -0
  242. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-ps-colorful-icon.tsx +0 -0
  243. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-sketch-colorful-icon.tsx +0 -0
  244. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-slide-colorful-icon.tsx +0 -0
  245. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-vcf-colorful-icon.tsx +0 -0
  246. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-excel-colorful-icon.tsx +0 -0
  247. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-image-colorful-icon.tsx +0 -0
  248. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-pdf-colorful-icon.tsx +0 -0
  249. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-ppt-colorful-icon.tsx +0 -0
  250. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-text-colorful-icon.tsx +0 -0
  251. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-unknown-colorful-icon.tsx +0 -0
  252. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-video-colorful-icon.tsx +0 -0
  253. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-word-colorful-icon.tsx +0 -0
  254. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/icons/file-wiki-zip-colorful-icon.tsx +0 -0
  255. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/image.tsx +0 -0
  256. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/item.tsx +0 -0
  257. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/kbd.tsx +0 -0
  258. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/native-select.tsx +0 -0
  259. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/spinner.tsx +0 -0
  260. /package/{template-nextjs-fullstack → template-vite-react/client}/src/components/ui/streamdown.tsx +0 -0
  261. /package/{template-nextjs-fullstack → template-vite-react/client}/src/hooks/use-mobile.ts +0 -0
  262. /package/{template-nextjs-fullstack → template-vite-react/client}/src/lib/utils.ts +0 -0
@@ -1,26 +0,0 @@
1
- import { db } from "@/db";
2
- import { todos } from "@/db/schema";
3
- import { desc } from "drizzle-orm";
4
- import { Header } from "@/components/header";
5
- import { TodoList } from "./todo-list";
6
- import { TodoForm } from "./todo-form";
7
-
8
- export const dynamic = "force-dynamic";
9
-
10
- export default async function TodosPage() {
11
- const allTodos = await db.select().from(todos).orderBy(desc(todos.createdAt));
12
-
13
- return (
14
- <div className="min-h-screen bg-background">
15
- <Header />
16
- <main className="container mx-auto px-4 py-8 max-w-2xl">
17
- <h1 className="text-3xl font-bold mb-8">Todos 示例</h1>
18
- <p className="text-muted-foreground mb-6">
19
- 完整的 CRUD 示例,使用 Server Actions + Drizzle ORM + PostgreSQL。
20
- </p>
21
- <TodoForm />
22
- <TodoList todos={allTodos} />
23
- </main>
24
- </div>
25
- );
26
- }
@@ -1,27 +0,0 @@
1
- "use client";
2
-
3
- import { useRef } from "react";
4
- import { Button } from "@/components/ui/button";
5
- import { Input } from "@/components/ui/input";
6
- import { createTodo } from "./actions";
7
- import { Plus } from "lucide-react";
8
-
9
- export function TodoForm() {
10
- const formRef = useRef<HTMLFormElement>(null);
11
-
12
- return (
13
- <form
14
- ref={formRef}
15
- action={async (formData) => {
16
- await createTodo(formData);
17
- formRef.current?.reset();
18
- }}
19
- className="flex gap-2 mb-6"
20
- >
21
- <Input name="title" placeholder="添加新的待办事项..." className="flex-1" />
22
- <Button type="submit" size="icon">
23
- <Plus className="h-4 w-4" />
24
- </Button>
25
- </form>
26
- );
27
- }
@@ -1,44 +0,0 @@
1
- "use client";
2
-
3
- import { Card, CardContent } from "@/components/ui/card";
4
- import { Button } from "@/components/ui/button";
5
- import { toggleTodo, deleteTodo } from "./actions";
6
- import { Trash2, Check } from "lucide-react";
7
- import type { Todo } from "@/db/schema";
8
-
9
- export function TodoList({ todos }: { todos: Todo[] }) {
10
- if (todos.length === 0) {
11
- return (
12
- <p className="text-center text-muted-foreground py-8">
13
- 还没有待办事项,添加一个吧!
14
- </p>
15
- );
16
- }
17
-
18
- return (
19
- <div className="space-y-2">
20
- {todos.map((todo) => (
21
- <Card key={todo.id}>
22
- <CardContent className="flex items-center justify-between p-4">
23
- <div className="flex items-center gap-3">
24
- <Button
25
- variant={todo.completed ? "default" : "outline"}
26
- size="icon"
27
- className="h-6 w-6 rounded-full"
28
- onClick={() => toggleTodo(todo.id)}
29
- >
30
- {todo.completed && <Check className="h-3 w-3" />}
31
- </Button>
32
- <span className={todo.completed ? "line-through text-muted-foreground" : ""}>
33
- {todo.title}
34
- </span>
35
- </div>
36
- <Button variant="ghost" size="icon" onClick={() => deleteTodo(todo.id)}>
37
- <Trash2 className="h-4 w-4" />
38
- </Button>
39
- </CardContent>
40
- </Card>
41
- ))}
42
- </div>
43
- );
44
- }
@@ -1,32 +0,0 @@
1
- "use client";
2
-
3
- import { Moon, Sun } from "lucide-react";
4
- import { useTheme } from "next-themes";
5
- import { Button } from "@/components/ui/button";
6
- import Link from "next/link";
7
-
8
- export function Header() {
9
- const { theme, setTheme } = useTheme();
10
-
11
- return (
12
- <header className="sticky top-0 z-50 w-full border-b bg-background/95 backdrop-blur supports-[backdrop-filter]:bg-background/60">
13
- <div className="container flex h-14 items-center justify-between mx-auto px-4">
14
- <div className="flex items-center gap-6">
15
- <Link href="/" className="font-semibold">OpenClaw</Link>
16
- <nav className="flex items-center gap-4 text-sm">
17
- <Link href="/todos" className="text-muted-foreground hover:text-foreground transition-colors">Todos 示例</Link>
18
- </nav>
19
- </div>
20
- <Button
21
- variant="ghost"
22
- size="icon"
23
- onClick={() => setTheme(theme === "dark" ? "light" : "dark")}
24
- >
25
- <Sun className="h-5 w-5 rotate-0 scale-100 transition-all dark:-rotate-90 dark:scale-0" />
26
- <Moon className="absolute h-5 w-5 rotate-90 scale-0 transition-all dark:rotate-0 dark:scale-100" />
27
- <span className="sr-only">切换主题</span>
28
- </Button>
29
- </div>
30
- </header>
31
- );
32
- }
@@ -1,8 +0,0 @@
1
- "use client";
2
-
3
- import * as React from "react";
4
- import { ThemeProvider as NextThemesProvider } from "next-themes";
5
-
6
- export function ThemeProvider({ children, ...props }: React.ComponentProps<typeof NextThemesProvider>) {
7
- return <NextThemesProvider {...props}>{children}</NextThemesProvider>;
8
- }
@@ -1,134 +0,0 @@
1
- # shadcn/ui 组件开发指南
2
-
3
- ## 核心原则
4
-
5
- - 组件位置:`/client/src/components/ui/`
6
- - 图标库:必须使用 `lucide-react`,禁用 Emoji
7
- - 查阅源码实现:直接读取组件源码了解最新组件实现
8
- - 交互系统:Button、Badge 使用 elevate 遮罩系统处理 hover/active 状态(通过 `::after` 伪元素叠加 `--elevate-1` / `--elevate-2`)
9
-
10
- ## 关键组件规范
11
-
12
- #### 1. Button 组件
13
-
14
- **导入路径**:`import { Button } from '@/components/ui/button'`
15
-
16
- **Props**:
17
- - `variant`: `"link" | "default" | "destructive" | "outline" | "secondary" | "ghost"` - 按钮样式变体
18
-
19
- ```tsx
20
- // ✅ 使用变体
21
- <Button variant="secondary">标准按钮</Button>
22
-
23
- // ✅ 自定义颜色时必须配对前景色
24
- <Button className="bg-primary text-primary-foreground">自定义按钮</Button>
25
- ```
26
-
27
- #### 2. Badge 组件
28
-
29
- **导入路径**:`import { Badge } from '@/components/ui/badge'`
30
-
31
- **Props**:
32
- - `variant`: `"default" | "destructive" | "outline" | "secondary"` - 样式变体
33
-
34
- ```tsx
35
- // ✅ 使用变体
36
- <Badge>默认</Badge>
37
- <Badge variant="secondary">次要</Badge>
38
- <Badge variant="outline">边框</Badge>
39
- <Badge variant="destructive">危险</Badge>
40
- ```
41
-
42
- #### 3. Alert 组件
43
-
44
- **导入路径**:`import { Alert, AlertTitle, AlertDescription, AlertAction } from '@/components/ui/alert'`
45
-
46
- **Props**:
47
- - `variant`: `"default" | "destructive" | "success" | "warning"` - 样式变体
48
-
49
- ```tsx
50
- // ✅ default / destructive / success / warning 四种变体
51
- <Alert variant="success">
52
- <CheckCircle className="size-4" />
53
- <AlertTitle>操作成功</AlertTitle>
54
- <AlertDescription>您的更改已保存</AlertDescription>
55
- </Alert>
56
-
57
- <Alert variant="warning">
58
- <AlertTriangle className="size-4" />
59
- <AlertTitle>警告</AlertTitle>
60
- <AlertDescription>请注意检查</AlertDescription>
61
- </Alert>
62
-
63
- ```
64
-
65
- #### 4. Empty 组件
66
-
67
- **导入路径**:`import { Empty, EmptyHeader, EmptyMedia, EmptyTitle, EmptyDescription, EmptyContent } from '@/components/ui/empty'`
68
-
69
- **子组件 Props**:
70
- - `EmptyMedia` 组件的 `variant`: `"default" | "icon"` - 媒体展示方式
71
-
72
- ```tsx
73
- // 标准结构:EmptyHeader 包含 EmptyMedia + EmptyTitle + EmptyDescription
74
- <Empty>
75
- <EmptyHeader>
76
- <EmptyMedia variant="icon">
77
- <SearchIcon className="size-6" />
78
- </EmptyMedia>
79
- <EmptyTitle>暂无数据</EmptyTitle>
80
- <EmptyDescription>当前没有找到相关内容</EmptyDescription>
81
- </EmptyHeader>
82
- <EmptyContent>
83
- <Button>添加数据</Button>
84
- </EmptyContent>
85
- </Empty>
86
- ```
87
-
88
- #### 5. Card Padding 系统
89
-
90
- **导入路径**:`import { CardHeader, CardContent, CardFooter } from '@/components/ui/card'`
91
-
92
- - `CardHeader`: `p-6` (24px 全方向)
93
- - `CardContent`: `p-6 pt-0` (与 header 无缝衔接)
94
- - `CardFooter`: `p-6 pt-0` (与 content 无缝衔接)
95
-
96
- #### 6. Dialog 组件
97
-
98
- **导入路径**:`import { Dialog, DialogContent } from '@/components/ui/dialog'`
99
-
100
- Dialog 默认提供了右上角的close能力,同时也提供了自定义关闭按钮的能力,即通过设置showCloseButton为false来关闭默认的关闭按钮。所以当默认存在close时,禁止在内容区域提供自定义的关闭按钮。
101
-
102
- #### 7. Image 组件
103
-
104
- **导入路径**:`import { Image } from '@/components/ui/image'`
105
-
106
- **Props**:支持原生 `<img>` 标签所有属性。
107
-
108
- ```typescript
109
- interface ImageProps extends React.ImgHTMLAttributes<HTMLImageElement>
110
- ```
111
-
112
- **使用规范**:
113
-
114
- 1. **响应式图片场景**:当图片尺寸需要根据视口宽度变化时,必须设置 `sizes` 属性
115
- 2. **固定尺寸图片场景**:当图片有固定尺寸时,必须设置 `width` 属性(number 类型)
116
- 3. **必须提供有意义的 `alt` 属性**
117
-
118
- ```tsx
119
- // ✅ 响应式图片
120
- <Image
121
- src="/path/to/image.jpg"
122
- alt="描述文字"
123
- sizes="(max-width: 768px) 100vw, 50vw"
124
- />
125
-
126
- // ✅ 固定尺寸图片(width/height 使用 number)
127
- <Image
128
- src="/path/to/image.jpg"
129
- alt="描述文字"
130
- width={300}
131
- height={200}
132
- />
133
-
134
- ```
@@ -1,66 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as AccordionPrimitive from "@radix-ui/react-accordion"
5
- import { ChevronDownIcon } from "lucide-react"
6
-
7
- import { cn } from "@/lib/utils"
8
-
9
- function Accordion({
10
- ...props
11
- }: React.ComponentProps<typeof AccordionPrimitive.Root>) {
12
- return <AccordionPrimitive.Root data-slot="accordion" {...props} />
13
- }
14
-
15
- function AccordionItem({
16
- className,
17
- ...props
18
- }: React.ComponentProps<typeof AccordionPrimitive.Item>) {
19
- return (
20
- <AccordionPrimitive.Item
21
- data-slot="accordion-item"
22
- className={cn("border-b last:border-b-0", className)}
23
- {...props}
24
- />
25
- )
26
- }
27
-
28
- function AccordionTrigger({
29
- className,
30
- children,
31
- ...props
32
- }: React.ComponentProps<typeof AccordionPrimitive.Trigger>) {
33
- return (
34
- <AccordionPrimitive.Header className="flex">
35
- <AccordionPrimitive.Trigger
36
- data-slot="accordion-trigger"
37
- className={cn(
38
- "focus-visible:border-ring focus-visible:ring-ring/20 flex flex-1 items-start justify-between gap-4 rounded-md py-4 text-left text-sm font-medium transition-all outline-none enabled:hover:underline focus-visible:ring-[3px] disabled:cursor-not-allowed disabled:opacity-50 [&[data-state=open]>svg]:rotate-180",
39
- className
40
- )}
41
- {...props}
42
- >
43
- {children}
44
- <ChevronDownIcon className="text-muted-foreground pointer-events-none size-4 shrink-0 translate-y-0.5 transition-transform duration-200" />
45
- </AccordionPrimitive.Trigger>
46
- </AccordionPrimitive.Header>
47
- )
48
- }
49
-
50
- function AccordionContent({
51
- className,
52
- children,
53
- ...props
54
- }: React.ComponentProps<typeof AccordionPrimitive.Content>) {
55
- return (
56
- <AccordionPrimitive.Content
57
- data-slot="accordion-content"
58
- className="data-[state=closed]:animate-accordion-up data-[state=open]:animate-accordion-down overflow-hidden text-sm"
59
- {...props}
60
- >
61
- <div className={cn("pt-0 pb-4", className)}>{children}</div>
62
- </AccordionPrimitive.Content>
63
- )
64
- }
65
-
66
- export { Accordion, AccordionItem, AccordionTrigger, AccordionContent }
@@ -1,157 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as AlertDialogPrimitive from "@radix-ui/react-alert-dialog"
5
-
6
- import { cn } from "@/lib/utils"
7
- import { buttonVariants } from "@/components/ui/button"
8
-
9
- function AlertDialog({
10
- ...props
11
- }: React.ComponentProps<typeof AlertDialogPrimitive.Root>) {
12
- return <AlertDialogPrimitive.Root data-slot="alert-dialog" {...props} />
13
- }
14
-
15
- function AlertDialogTrigger({
16
- ...props
17
- }: React.ComponentProps<typeof AlertDialogPrimitive.Trigger>) {
18
- return (
19
- <AlertDialogPrimitive.Trigger data-slot="alert-dialog-trigger" {...props} />
20
- )
21
- }
22
-
23
- function AlertDialogPortal({
24
- ...props
25
- }: React.ComponentProps<typeof AlertDialogPrimitive.Portal>) {
26
- return (
27
- <AlertDialogPrimitive.Portal data-slot="alert-dialog-portal" {...props} />
28
- )
29
- }
30
-
31
- function AlertDialogOverlay({
32
- className,
33
- ...props
34
- }: React.ComponentProps<typeof AlertDialogPrimitive.Overlay>) {
35
- return (
36
- <AlertDialogPrimitive.Overlay
37
- data-slot="alert-dialog-overlay"
38
- className={cn(
39
- "data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 fixed inset-0 z-50 bg-black/50",
40
- className
41
- )}
42
- {...props}
43
- />
44
- )
45
- }
46
-
47
- function AlertDialogContent({
48
- className,
49
- ...props
50
- }: React.ComponentProps<typeof AlertDialogPrimitive.Content>) {
51
- return (
52
- <AlertDialogPortal>
53
- <AlertDialogOverlay />
54
- <AlertDialogPrimitive.Content
55
- data-slot="alert-dialog-content"
56
- className={cn(
57
- "bg-background data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 fixed top-[50%] left-[50%] z-50 grid w-full max-sm:max-w-[calc(100%-2rem)] translate-x-[-50%] translate-y-[-50%] gap-4 rounded-lg border p-6 shadow-lg duration-200 max-w-lg",
58
- className
59
- )}
60
- {...props}
61
- />
62
- </AlertDialogPortal>
63
- )
64
- }
65
-
66
- function AlertDialogHeader({
67
- className,
68
- ...props
69
- }: React.ComponentProps<"div">) {
70
- return (
71
- <div
72
- data-slot="alert-dialog-header"
73
- className={cn("flex flex-col gap-2 text-center sm:text-left", className)}
74
- {...props}
75
- />
76
- )
77
- }
78
-
79
- function AlertDialogFooter({
80
- className,
81
- ...props
82
- }: React.ComponentProps<"div">) {
83
- return (
84
- <div
85
- data-slot="alert-dialog-footer"
86
- className={cn(
87
- "flex flex-col-reverse gap-2 sm:flex-row sm:justify-end",
88
- className
89
- )}
90
- {...props}
91
- />
92
- )
93
- }
94
-
95
- function AlertDialogTitle({
96
- className,
97
- ...props
98
- }: React.ComponentProps<typeof AlertDialogPrimitive.Title>) {
99
- return (
100
- <AlertDialogPrimitive.Title
101
- data-slot="alert-dialog-title"
102
- className={cn("text-lg font-semibold", className)}
103
- {...props}
104
- />
105
- )
106
- }
107
-
108
- function AlertDialogDescription({
109
- className,
110
- ...props
111
- }: React.ComponentProps<typeof AlertDialogPrimitive.Description>) {
112
- return (
113
- <AlertDialogPrimitive.Description
114
- data-slot="alert-dialog-description"
115
- className={cn("text-muted-foreground text-sm", className)}
116
- {...props}
117
- />
118
- )
119
- }
120
-
121
- function AlertDialogAction({
122
- className,
123
- ...props
124
- }: React.ComponentProps<typeof AlertDialogPrimitive.Action>) {
125
- return (
126
- <AlertDialogPrimitive.Action
127
- className={cn(buttonVariants(), className)}
128
- {...props}
129
- />
130
- )
131
- }
132
-
133
- function AlertDialogCancel({
134
- className,
135
- ...props
136
- }: React.ComponentProps<typeof AlertDialogPrimitive.Cancel>) {
137
- return (
138
- <AlertDialogPrimitive.Cancel
139
- className={cn(buttonVariants({ variant: "outline" }), className)}
140
- {...props}
141
- />
142
- )
143
- }
144
-
145
- export {
146
- AlertDialog,
147
- AlertDialogPortal,
148
- AlertDialogOverlay,
149
- AlertDialogTrigger,
150
- AlertDialogContent,
151
- AlertDialogHeader,
152
- AlertDialogFooter,
153
- AlertDialogTitle,
154
- AlertDialogDescription,
155
- AlertDialogAction,
156
- AlertDialogCancel,
157
- }
@@ -1,11 +0,0 @@
1
- "use client"
2
-
3
- import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio"
4
-
5
- function AspectRatio({
6
- ...props
7
- }: React.ComponentProps<typeof AspectRatioPrimitive.Root>) {
8
- return <AspectRatioPrimitive.Root data-slot="aspect-ratio" {...props} />
9
- }
10
-
11
- export { AspectRatio }
@@ -1,53 +0,0 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import * as AvatarPrimitive from "@radix-ui/react-avatar"
5
-
6
- import { cn } from "@/lib/utils"
7
-
8
- function Avatar({
9
- className,
10
- ...props
11
- }: React.ComponentProps<typeof AvatarPrimitive.Root>) {
12
- return (
13
- <AvatarPrimitive.Root
14
- data-slot="avatar"
15
- className={cn(
16
- "relative flex size-8 shrink-0 overflow-hidden rounded-full",
17
- className
18
- )}
19
- {...props}
20
- />
21
- )
22
- }
23
-
24
- function AvatarImage({
25
- className,
26
- ...props
27
- }: React.ComponentProps<typeof AvatarPrimitive.Image>) {
28
- return (
29
- <AvatarPrimitive.Image
30
- data-slot="avatar-image"
31
- className={cn("aspect-square size-full", className)}
32
- {...props}
33
- />
34
- )
35
- }
36
-
37
- function AvatarFallback({
38
- className,
39
- ...props
40
- }: React.ComponentProps<typeof AvatarPrimitive.Fallback>) {
41
- return (
42
- <AvatarPrimitive.Fallback
43
- data-slot="avatar-fallback"
44
- className={cn(
45
- "bg-muted flex size-full items-center justify-center rounded-full",
46
- className
47
- )}
48
- {...props}
49
- />
50
- )
51
- }
52
-
53
- export { Avatar, AvatarImage, AvatarFallback }
@@ -1,42 +0,0 @@
1
- import * as React from "react"
2
- import { cva, type VariantProps } from "class-variance-authority"
3
-
4
- import { cn } from "@/lib/utils"
5
-
6
- const badgeVariants = cva(
7
- // Whitespace-nowrap: Badges should never wrap.
8
- // hover-elevate: adds subtle dark overlay on hover for interactive feedback
9
- "whitespace-nowrap inline-flex items-center rounded-md border px-2.5 py-0.5 text-xs font-semibold hover-elevate",
10
- {
11
- variants: {
12
- variant: {
13
- default:
14
- // Primary badge with subtle shadow for elevation
15
- "border-transparent bg-primary text-primary-foreground shadow-xs",
16
- secondary:
17
- // Subtle filled badge for secondary information
18
- "border-transparent bg-secondary text-secondary-foreground",
19
- destructive:
20
- // Error/danger state with matching shadow
21
- "border-transparent bg-destructive text-destructive-foreground shadow-xs",
22
- // Outline uses badge-outline variable to blend with parent background
23
- outline: "border [border-color:var(--badge-outline)] shadow-xs",
24
- },
25
- },
26
- defaultVariants: {
27
- variant: "default",
28
- },
29
- }
30
- )
31
-
32
- export interface BadgeProps
33
- extends React.HTMLAttributes<HTMLDivElement>,
34
- VariantProps<typeof badgeVariants> {}
35
-
36
- function Badge({ className, variant, ...props }: BadgeProps) {
37
- return (
38
- <div className={cn(badgeVariants({ variant }), className)} {...props} />
39
- );
40
- }
41
-
42
- export { Badge, badgeVariants }
@@ -1,69 +0,0 @@
1
- import * as React from "react"
2
- import { Slot } from "@radix-ui/react-slot"
3
- import { cva, type VariantProps } from "class-variance-authority"
4
-
5
- import { cn } from "@/lib/utils"
6
-
7
- const buttonVariants = cva(
8
- // Base button styles with elevate system for hover/active states.
9
- // hover-elevate: applies subtle dark overlay on hover
10
- // active-elevate-2: applies stronger dark overlay when pressed
11
- "inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0 hover-elevate active-elevate-2",
12
- {
13
- variants: {
14
- variant: {
15
- default:
16
- // Solid primary button with computed border for depth
17
- "bg-primary text-primary-foreground border border-primary-border",
18
- destructive:
19
- // Destructive action button with matching border
20
- "bg-destructive text-destructive-foreground border border-destructive-border",
21
- outline:
22
- // Shows the background color of whatever card / sidebar / accent background it is inside of.
23
- // Inherits the current text color.
24
- "border [border-color:var(--button-outline)] shadow-xs active:shadow-none",
25
- secondary:
26
- // Subtle filled button for secondary actions
27
- "bg-secondary text-secondary-foreground border border-secondary-border",
28
- // Add a transparent border so that when someone toggles a border on later, it doesn't shift layout/size.
29
- ghost: "border border-transparent",
30
- },
31
- // Heights are set as "min" heights, because sometimes AI will place large amount of content
32
- // inside buttons. With a min-height they will look appropriate with small amounts of content,
33
- // but will expand to fit large amounts of content.
34
- size: {
35
- default: "min-h-9 px-4 py-2",
36
- sm: "min-h-8 rounded-md px-3 text-xs",
37
- lg: "min-h-10 rounded-md px-8",
38
- icon: "h-9 w-9",
39
- },
40
- },
41
- defaultVariants: {
42
- variant: "default",
43
- size: "default",
44
- },
45
- }
46
- )
47
-
48
- function Button({
49
- className,
50
- variant,
51
- size,
52
- asChild = false,
53
- ...props
54
- }: React.ComponentProps<"button"> &
55
- VariantProps<typeof buttonVariants> & {
56
- asChild?: boolean
57
- }) {
58
- const Comp = asChild ? Slot : "button"
59
-
60
- return (
61
- <Comp
62
- data-slot="button"
63
- className={cn(buttonVariants({ variant, size, className }))}
64
- {...props}
65
- />
66
- )
67
- }
68
-
69
- export { Button, buttonVariants }