aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/examples/with-tailwind/packages/ui
diff options
context:
space:
mode:
author简律纯 <hsiangnianian@outlook.com>2023-04-28 01:47:57 +0800
committer简律纯 <hsiangnianian@outlook.com>2023-04-28 01:47:57 +0800
commit8b2c4a38a461ff5ecc95972291bc711e2c5dec9a (patch)
tree29f552e3df949073e21bf5c76d7abc3044830ec6 /examples/with-tailwind/packages/ui
parentfc8c5fdce62fb229202659408798a7b6c98f6e8b (diff)
downloadHydroRoll-8b2c4a38a461ff5ecc95972291bc711e2c5dec9a.tar.gz
HydroRoll-8b2c4a38a461ff5ecc95972291bc711e2c5dec9a.zip
Diffstat (limited to 'examples/with-tailwind/packages/ui')
-rw-r--r--examples/with-tailwind/packages/ui/package.json32
-rw-r--r--examples/with-tailwind/packages/ui/postcss.config.js9
-rw-r--r--examples/with-tailwind/packages/ui/src/Button.tsx16
-rw-r--r--examples/with-tailwind/packages/ui/src/Card.tsx27
-rw-r--r--examples/with-tailwind/packages/ui/src/index.tsx6
-rw-r--r--examples/with-tailwind/packages/ui/src/styles.css3
-rw-r--r--examples/with-tailwind/packages/ui/tailwind.config.js7
-rw-r--r--examples/with-tailwind/packages/ui/tsconfig.json5
-rw-r--r--examples/with-tailwind/packages/ui/tsup.config.ts13
9 files changed, 118 insertions, 0 deletions
diff --git a/examples/with-tailwind/packages/ui/package.json b/examples/with-tailwind/packages/ui/package.json
new file mode 100644
index 0000000..be2c395
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/package.json
@@ -0,0 +1,32 @@
+{
+ "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",
+ "dev": "tsup --watch",
+ "check-types": "tsc --noEmit"
+ },
+ "peerDependencies": {
+ "react": "^18.2.0"
+ },
+ "devDependencies": {
+ "@types/react": "^18.0.26",
+ "eslint": "^7.32.0",
+ "eslint-config-custom": "workspace:*",
+ "postcss": "^8.4.20",
+ "react": "^18.2.0",
+ "tailwind-config": "workspace:*",
+ "tsconfig": "workspace:*",
+ "tsup": "^6.1.3",
+ "typescript": "^4.9.4"
+ }
+}
diff --git a/examples/with-tailwind/packages/ui/postcss.config.js b/examples/with-tailwind/packages/ui/postcss.config.js
new file mode 100644
index 0000000..07aa434
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/postcss.config.js
@@ -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: {},
+ },
+};
diff --git a/examples/with-tailwind/packages/ui/src/Button.tsx b/examples/with-tailwind/packages/ui/src/Button.tsx
new file mode 100644
index 0000000..495d02a
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/src/Button.tsx
@@ -0,0 +1,16 @@
+import * as React from "react";
+
+export const Button = () => {
+ return (
+ <div className="rounded-md ">
+ <a href="https://turbo.build/repo/docs">
+ <div className="ui-flex ui-w-full ui-items-center ui-justify-center ui-rounded-md ui-border ui-border-transparent ui-px-8 ui-py-3 ui-text-base ui-font-medium ui-no-underline ui-bg-white ui-text-black hover:ui-bg-gray-300 md:ui-py-3 md:ui-px-10 md:ui-text-lg md:ui-leading-6">
+ Read the docs
+ <span className="ui-ml-2 ui-bg-gradient-to-r ui-from-brandred ui-to-brandblue ui-bg-clip-text ui-text-transparent">
+ →
+ </span>
+ </div>
+ </a>
+ </div>
+ );
+};
diff --git a/examples/with-tailwind/packages/ui/src/Card.tsx b/examples/with-tailwind/packages/ui/src/Card.tsx
new file mode 100644
index 0000000..6083de2
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/src/Card.tsx
@@ -0,0 +1,27 @@
+import * as React from "react";
+
+export const Card = ({
+ title,
+ cta,
+ href,
+}: {
+ title: string;
+ cta: string;
+ href: string;
+}) => {
+ return (
+ <a
+ target="_blank"
+ rel="noopener noreferrer"
+ href={href}
+ className="ui-group ui-mt-4 ui-rounded-lg ui-border ui-border-transparent ui-overflow-hidden ui-bg-origin-border ui-bg-gradient-to-r ui-from-brandred ui-to-brandblue ui-text-[#6b7280]"
+ >
+ <div className="ui-p-4 ui-bg-zinc-900 ui-h-full">
+ <p className="ui-inline-block ui-text-xl ui-text-white">{title}</p>
+ <div className="ui-text-xs ui-mt-4 group-hover:ui-underline">
+ {cta} →
+ </div>
+ </div>
+ </a>
+ );
+};
diff --git a/examples/with-tailwind/packages/ui/src/index.tsx b/examples/with-tailwind/packages/ui/src/index.tsx
new file mode 100644
index 0000000..8af7073
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/src/index.tsx
@@ -0,0 +1,6 @@
+// styles
+import "./styles.css";
+
+// components
+export * from "./Button";
+export * from "./Card";
diff --git a/examples/with-tailwind/packages/ui/src/styles.css b/examples/with-tailwind/packages/ui/src/styles.css
new file mode 100644
index 0000000..b5c61c9
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/src/styles.css
@@ -0,0 +1,3 @@
+@tailwind base;
+@tailwind components;
+@tailwind utilities;
diff --git a/examples/with-tailwind/packages/ui/tailwind.config.js b/examples/with-tailwind/packages/ui/tailwind.config.js
new file mode 100644
index 0000000..23887e6
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/tailwind.config.js
@@ -0,0 +1,7 @@
+const sharedConfig = require("tailwind-config/tailwind.config.js");
+
+module.exports = {
+ // prefix ui lib classes to avoid conflicting with the app
+ prefix: "ui-",
+ presets: [sharedConfig],
+};
diff --git a/examples/with-tailwind/packages/ui/tsconfig.json b/examples/with-tailwind/packages/ui/tsconfig.json
new file mode 100644
index 0000000..cd6c94d
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/tsconfig.json
@@ -0,0 +1,5 @@
+{
+ "extends": "tsconfig/react-library.json",
+ "include": ["."],
+ "exclude": ["dist", "build", "node_modules"]
+}
diff --git a/examples/with-tailwind/packages/ui/tsup.config.ts b/examples/with-tailwind/packages/ui/tsup.config.ts
new file mode 100644
index 0000000..7b2189a
--- /dev/null
+++ b/examples/with-tailwind/packages/ui/tsup.config.ts
@@ -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,
+}));