feat(create-turbo): create kitchen-sink
This commit is contained in:
commit
4625c93980
80 changed files with 11572 additions and 0 deletions
4
packages/ui/eslint.config.mjs
Normal file
4
packages/ui/eslint.config.mjs
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
import { config } from "@repo/eslint-config/react";
|
||||
|
||||
/** @type {import("eslint").Linter.Config} */
|
||||
export default config;
|
||||
60
packages/ui/package.json
Normal file
60
packages/ui/package.json
Normal file
|
|
@ -0,0 +1,60 @@
|
|||
{
|
||||
"name": "@repo/ui",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"files": [
|
||||
"dist/**",
|
||||
"dist"
|
||||
],
|
||||
"exports": {
|
||||
"./counter-button": {
|
||||
"import": {
|
||||
"types": "./dist/es/counter-button.d.mts",
|
||||
"default": "./dist/es/counter-button.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/cjs/counter-button.d.ts",
|
||||
"default": "./dist/cjs/counter-button.js"
|
||||
}
|
||||
},
|
||||
"./link": {
|
||||
"import": {
|
||||
"types": "./dist/es/link.d.mts",
|
||||
"default": "./dist/es/link.mjs"
|
||||
},
|
||||
"require": {
|
||||
"types": "./dist/cjs/link.d.ts",
|
||||
"default": "./dist/cjs/link.js"
|
||||
}
|
||||
}
|
||||
},
|
||||
"scripts": {
|
||||
"build": "bunchee",
|
||||
"dev": "bunchee --watch",
|
||||
"check-types": "tsc --noEmit",
|
||||
"lint": "eslint src/",
|
||||
"test": "jest"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "@repo/jest-presets/browser"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@jest/globals": "^29.7.0",
|
||||
"@repo/eslint-config": "workspace:*",
|
||||
"@repo/jest-presets": "workspace:*",
|
||||
"@repo/typescript-config": "workspace:*",
|
||||
"@types/node": "^22.15.3",
|
||||
"bunchee": "^6.4.0",
|
||||
"eslint": "^9.29.0",
|
||||
"jest": "^29.7.0",
|
||||
"typescript": "5.8.2"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@types/react": ">=18",
|
||||
"@types/react-dom": ">=18",
|
||||
"react": ">=18",
|
||||
"react-dom": ">=18"
|
||||
}
|
||||
}
|
||||
12
packages/ui/src/counter-button/index.test.tsx
Normal file
12
packages/ui/src/counter-button/index.test.tsx
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { describe, it } from "@jest/globals";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { CounterButton } from ".";
|
||||
|
||||
describe("CounterButton", () => {
|
||||
it("renders without crashing", () => {
|
||||
const div = document.createElement("div");
|
||||
const root = createRoot(div);
|
||||
root.render(<CounterButton />);
|
||||
root.unmount();
|
||||
});
|
||||
});
|
||||
50
packages/ui/src/counter-button/index.tsx
Normal file
50
packages/ui/src/counter-button/index.tsx
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
"use client";
|
||||
|
||||
import { useState } from "react";
|
||||
|
||||
export function CounterButton() {
|
||||
const [count, setCount] = useState(0);
|
||||
|
||||
return (
|
||||
<div
|
||||
style={{
|
||||
background: `rgba(0,0,0,0.05)`,
|
||||
borderRadius: `8px`,
|
||||
padding: "1.5rem",
|
||||
fontWeight: 500,
|
||||
}}
|
||||
>
|
||||
<p style={{ margin: "0 0 1.5rem 0" }}>
|
||||
This component is from{" "}
|
||||
<code
|
||||
style={{
|
||||
padding: "0.2rem 0.3rem",
|
||||
background: `rgba(0,0,0,0.1)`,
|
||||
borderRadius: "0.25rem",
|
||||
}}
|
||||
>
|
||||
ui
|
||||
</code>
|
||||
</p>
|
||||
<div>
|
||||
<button
|
||||
onClick={() => {
|
||||
setCount((c) => c + 1);
|
||||
}}
|
||||
style={{
|
||||
background: "black",
|
||||
color: "white",
|
||||
border: "none",
|
||||
padding: "0.5rem 1rem",
|
||||
borderRadius: "0.25rem",
|
||||
display: "inline-block",
|
||||
cursor: "pointer",
|
||||
}}
|
||||
type="button"
|
||||
>
|
||||
Count: {count}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
12
packages/ui/src/link/index.test.tsx
Normal file
12
packages/ui/src/link/index.test.tsx
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
import { describe, it } from "@jest/globals";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import { Link } from ".";
|
||||
|
||||
describe("Link", () => {
|
||||
it("renders without crashing", () => {
|
||||
const div = document.createElement("div");
|
||||
const root = createRoot(div);
|
||||
root.render(<Link href="https://turborepo.com">Turborepo Docs</Link>);
|
||||
root.unmount();
|
||||
});
|
||||
});
|
||||
20
packages/ui/src/link/index.tsx
Normal file
20
packages/ui/src/link/index.tsx
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import type { AnchorHTMLAttributes, ReactNode } from "react";
|
||||
|
||||
interface LinkProps extends AnchorHTMLAttributes<HTMLAnchorElement> {
|
||||
children: ReactNode;
|
||||
newTab?: boolean;
|
||||
href: string;
|
||||
}
|
||||
|
||||
export function Link({ children, href, newTab, ...other }: LinkProps) {
|
||||
return (
|
||||
<a
|
||||
href={href}
|
||||
rel={newTab ? "noreferrer" : undefined}
|
||||
target={newTab ? "_blank" : undefined}
|
||||
{...other}
|
||||
>
|
||||
{children}
|
||||
</a>
|
||||
);
|
||||
}
|
||||
10
packages/ui/tsconfig.json
Normal file
10
packages/ui/tsconfig.json
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"extends": "@repo/typescript-config/react-library.json",
|
||||
"compilerOptions": {
|
||||
"lib": ["dom", "ES2015"],
|
||||
"sourceMap": true,
|
||||
"types": ["jest", "node"]
|
||||
},
|
||||
"include": ["."],
|
||||
"exclude": ["dist", "build", "node_modules"]
|
||||
}
|
||||
8
packages/ui/turbo.json
Normal file
8
packages/ui/turbo.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"extends": ["//"],
|
||||
"tasks": {
|
||||
"build": {
|
||||
"outputs": ["dist/**"]
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue