feat(create-turbo): create with-tailwind
This commit is contained in:
3
packages/ui/.eslintrc.js
Normal file
3
packages/ui/.eslintrc.js
Normal file
@ -0,0 +1,3 @@
|
||||
module.exports = {
|
||||
extends: ["custom/react"],
|
||||
};
|
34
packages/ui/package.json
Normal file
34
packages/ui/package.json
Normal file
@ -0,0 +1,34 @@
|
||||
{
|
||||
"name": "ui",
|
||||
"version": "0.0.0",
|
||||
"sideEffects": [
|
||||
"**/*.css"
|
||||
],
|
||||
"types": "./dist/index.d.ts",
|
||||
"exports": {
|
||||
".": "./dist",
|
||||
"./styles.css": "./dist/index.css"
|
||||
},
|
||||
"license": "MIT",
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"lint": "eslint src/",
|
||||
"dev": "tsup --watch",
|
||||
"check-types": "tsc --noEmit"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"react": "^18.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/react": "^18.2.5",
|
||||
"autoprefixer": "^10.4.13",
|
||||
"eslint-config-custom": "workspace:*",
|
||||
"postcss": "^8.4.20",
|
||||
"react": "^18.2.0",
|
||||
"tailwind-config": "workspace:*",
|
||||
"tailwindcss": "^3.2.4",
|
||||
"tsconfig": "workspace:*",
|
||||
"tsup": "^6.1.3",
|
||||
"typescript": "^5.1.6"
|
||||
}
|
||||
}
|
9
packages/ui/postcss.config.js
Normal file
9
packages/ui/postcss.config.js
Normal file
@ -0,0 +1,9 @@
|
||||
// If you want to use other PostCSS plugins, see the following:
|
||||
// https://tailwindcss.com/docs/using-with-preprocessors
|
||||
|
||||
module.exports = {
|
||||
plugins: {
|
||||
tailwindcss: {},
|
||||
autoprefixer: {},
|
||||
},
|
||||
};
|
30
packages/ui/src/card.tsx
Normal file
30
packages/ui/src/card.tsx
Normal file
@ -0,0 +1,30 @@
|
||||
import * as React from "react";
|
||||
|
||||
export function Card({
|
||||
title,
|
||||
children,
|
||||
href,
|
||||
}: {
|
||||
title: string;
|
||||
children: React.ReactNode;
|
||||
href: string;
|
||||
}): JSX.Element {
|
||||
return (
|
||||
<a
|
||||
className="ui-group ui-rounded-lg ui-border ui-border-transparent ui-px-5 ui-py-4 ui-transition-colors hover:ui-border-neutral-700 hover:ui-bg-neutral-800/30"
|
||||
href={`${href}?utm_source=create-turbo&utm_medium=with-tailwind&utm_campaign=create-turbo"`}
|
||||
rel="noopener noreferrer"
|
||||
target="_blank"
|
||||
>
|
||||
<h2 className="ui-mb-3 ui-text-2xl ui-font-semibold">
|
||||
{title}{" "}
|
||||
<span className="ui-inline-block ui-transition-transform group-hover:ui-translate-x-1 motion-reduce:ui-transform-none">
|
||||
->
|
||||
</span>
|
||||
</h2>
|
||||
<p className="ui-m-0 ui-max-w-[30ch] ui-text-sm ui-opacity-50">
|
||||
{children}
|
||||
</p>
|
||||
</a>
|
||||
);
|
||||
}
|
5
packages/ui/src/index.tsx
Normal file
5
packages/ui/src/index.tsx
Normal file
@ -0,0 +1,5 @@
|
||||
// styles
|
||||
import "./styles.css";
|
||||
|
||||
// components
|
||||
export * from "./card";
|
3
packages/ui/src/styles.css
Normal file
3
packages/ui/src/styles.css
Normal file
@ -0,0 +1,3 @@
|
||||
@tailwind base;
|
||||
@tailwind components;
|
||||
@tailwind utilities;
|
10
packages/ui/tailwind.config.ts
Normal file
10
packages/ui/tailwind.config.ts
Normal file
@ -0,0 +1,10 @@
|
||||
// tailwind config is required for editor support
|
||||
import type { Config } from "tailwindcss";
|
||||
import sharedConfig from "tailwind-config/tailwind.config.ts";
|
||||
|
||||
const config: Pick<Config, "prefix" | "presets"> = {
|
||||
prefix: "ui-",
|
||||
presets: [sharedConfig],
|
||||
};
|
||||
|
||||
export default config;
|
5
packages/ui/tsconfig.json
Normal file
5
packages/ui/tsconfig.json
Normal file
@ -0,0 +1,5 @@
|
||||
{
|
||||
"extends": "tsconfig/react-library.json",
|
||||
"include": ["."],
|
||||
"exclude": ["dist", "build", "node_modules"]
|
||||
}
|
13
packages/ui/tsup.config.ts
Normal file
13
packages/ui/tsup.config.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import { defineConfig, Options } from "tsup";
|
||||
|
||||
export default defineConfig((options: Options) => ({
|
||||
treeshake: true,
|
||||
splitting: true,
|
||||
entry: ["src/**/*.tsx"],
|
||||
format: ["esm"],
|
||||
dts: true,
|
||||
minify: true,
|
||||
clean: true,
|
||||
external: ["react"],
|
||||
...options,
|
||||
}));
|
Reference in New Issue
Block a user