remove the map and ui shim packages
Both failed the deletion test in the telling direction: - @trails-cool/ui: Button/Input/Card had zero consumers — both apps roll their own elements inline. The only live part was a 6-line styles.css (the Tailwind entry + one keyframe), which now lives in each app as app/styles.css. - @trails-cool/map: MapView and RouteLayer had zero consumers; the package was otherwise a re-export of two map-core constants, and the two import sites now use @trails-cool/map-core directly. The "map components go in @trails-cool/map" convention had drifted long ago — the real map components live in apps/planner/app/components. CLAUDE.md's repository structure and conventions updated to match reality (including pointing shared-type guidance at the post-#515 sources: db row types, api contracts, Waypoint in types). Dockerfiles no longer COPY the deleted package manifests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
1a65b40d18
commit
765c9f49a8
28 changed files with 13 additions and 357 deletions
|
|
@ -1,32 +0,0 @@
|
|||
import type { ButtonHTMLAttributes } from "react";
|
||||
|
||||
export interface ButtonProps extends ButtonHTMLAttributes<HTMLButtonElement> {
|
||||
variant?: "primary" | "secondary" | "ghost";
|
||||
size?: "sm" | "md" | "lg";
|
||||
}
|
||||
|
||||
const variantStyles = {
|
||||
primary: "bg-blue-600 text-white hover:bg-blue-700 active:bg-blue-800",
|
||||
secondary: "bg-gray-100 text-gray-900 hover:bg-gray-200 active:bg-gray-300",
|
||||
ghost: "text-gray-700 hover:bg-gray-100 active:bg-gray-200",
|
||||
};
|
||||
|
||||
const sizeStyles = {
|
||||
sm: "px-2.5 py-1.5 text-sm",
|
||||
md: "px-4 py-2 text-sm",
|
||||
lg: "px-6 py-3 text-base",
|
||||
};
|
||||
|
||||
export function Button({
|
||||
variant = "primary",
|
||||
size = "md",
|
||||
className = "",
|
||||
...props
|
||||
}: ButtonProps) {
|
||||
return (
|
||||
<button
|
||||
className={`inline-flex items-center justify-center rounded-md font-medium transition-colors focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2 disabled:opacity-50 disabled:pointer-events-none ${variantStyles[variant]} ${sizeStyles[size]} ${className}`}
|
||||
{...props}
|
||||
/>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
export interface CardProps {
|
||||
className?: string;
|
||||
children: React.ReactNode;
|
||||
}
|
||||
|
||||
export function Card({ className = "", children }: CardProps) {
|
||||
return (
|
||||
<div className={`rounded-lg border border-gray-200 bg-white p-6 shadow-sm ${className}`}>
|
||||
{children}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,25 +0,0 @@
|
|||
import type { InputHTMLAttributes } from "react";
|
||||
|
||||
export interface InputProps extends InputHTMLAttributes<HTMLInputElement> {
|
||||
label?: string;
|
||||
error?: string;
|
||||
}
|
||||
|
||||
export function Input({ label, error, className = "", id, ...props }: InputProps) {
|
||||
const inputId = id ?? label?.toLowerCase().replace(/\s+/g, "-");
|
||||
return (
|
||||
<div className="flex flex-col gap-1.5">
|
||||
{label && (
|
||||
<label htmlFor={inputId} className="text-sm font-medium text-gray-700">
|
||||
{label}
|
||||
</label>
|
||||
)}
|
||||
<input
|
||||
id={inputId}
|
||||
className={`rounded-md border border-gray-300 px-3 py-2 text-sm shadow-sm transition-colors focus:border-blue-500 focus:outline-none focus:ring-1 focus:ring-blue-500 ${error ? "border-red-500" : ""} ${className}`}
|
||||
{...props}
|
||||
/>
|
||||
{error && <p className="text-sm text-red-600">{error}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
@ -1,87 +0,0 @@
|
|||
/**
|
||||
* @vitest-environment jsdom
|
||||
*/
|
||||
import { describe, it, expect, afterEach } from "vitest";
|
||||
import "@testing-library/jest-dom/vitest";
|
||||
import { render, screen, cleanup } from "@testing-library/react";
|
||||
import { Button } from "./Button.tsx";
|
||||
import { Input } from "./Input.tsx";
|
||||
import { Card } from "./Card.tsx";
|
||||
|
||||
afterEach(cleanup);
|
||||
|
||||
describe("Button", () => {
|
||||
it("renders with text", () => {
|
||||
render(<Button>Click me</Button>);
|
||||
expect(screen.getByRole("button", { name: "Click me" })).toBeDefined();
|
||||
});
|
||||
|
||||
it("applies primary variant by default", () => {
|
||||
render(<Button>Test</Button>);
|
||||
expect(screen.getByRole("button").className).toContain("bg-blue-600");
|
||||
});
|
||||
|
||||
it("applies secondary variant", () => {
|
||||
render(<Button variant="secondary">Test</Button>);
|
||||
expect(screen.getByRole("button").className).toContain("bg-gray-100");
|
||||
});
|
||||
|
||||
it("applies ghost variant", () => {
|
||||
render(<Button variant="ghost">Test</Button>);
|
||||
expect(screen.getByRole("button").className).toContain("text-gray-700");
|
||||
});
|
||||
|
||||
it("applies size classes", () => {
|
||||
render(<Button size="lg">Test</Button>);
|
||||
expect(screen.getByRole("button").className).toContain("px-6");
|
||||
});
|
||||
|
||||
it("forwards disabled prop", () => {
|
||||
render(<Button disabled>Test</Button>);
|
||||
expect(screen.getByRole("button")).toBeDisabled();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Input", () => {
|
||||
it("renders with label", () => {
|
||||
render(<Input label="Email" />);
|
||||
expect(screen.getByLabelText("Email")).toBeDefined();
|
||||
});
|
||||
|
||||
it("generates id from label", () => {
|
||||
render(<Input label="First Name" />);
|
||||
expect(screen.getByLabelText("First Name").id).toBe("first-name");
|
||||
});
|
||||
|
||||
it("uses provided id over generated one", () => {
|
||||
render(<Input label="Email" id="custom-id" />);
|
||||
expect(screen.getByLabelText("Email").id).toBe("custom-id");
|
||||
});
|
||||
|
||||
it("shows error message", () => {
|
||||
render(<Input label="Email" error="Required" />);
|
||||
expect(screen.getByText("Required")).toBeDefined();
|
||||
});
|
||||
|
||||
it("applies error border class", () => {
|
||||
render(<Input label="Email" error="Required" />);
|
||||
expect(screen.getByLabelText("Email").className).toContain("border-red-500");
|
||||
});
|
||||
|
||||
it("renders without label", () => {
|
||||
render(<Input placeholder="Type here" />);
|
||||
expect(screen.getByPlaceholderText("Type here")).toBeDefined();
|
||||
});
|
||||
});
|
||||
|
||||
describe("Card", () => {
|
||||
it("renders children", () => {
|
||||
render(<Card>Card content</Card>);
|
||||
expect(screen.getByText("Card content")).toBeDefined();
|
||||
});
|
||||
|
||||
it("applies additional className", () => {
|
||||
const { container } = render(<Card className="mt-4">Content</Card>);
|
||||
expect(container.firstElementChild?.className).toContain("mt-4");
|
||||
});
|
||||
});
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
export { Button } from "./Button.tsx";
|
||||
export type { ButtonProps } from "./Button.tsx";
|
||||
export { Input } from "./Input.tsx";
|
||||
export type { InputProps } from "./Input.tsx";
|
||||
export { Card } from "./Card.tsx";
|
||||
export type { CardProps } from "./Card.tsx";
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
@import "tailwindcss";
|
||||
|
||||
@keyframes slide {
|
||||
0% { transform: translateX(-100%); }
|
||||
100% { transform: translateX(400%); }
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue