Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

align on packages #34

Merged
merged 14 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 0 additions & 40 deletions .github/workflows/storybook.yml

This file was deleted.

4 changes: 2 additions & 2 deletions .storybook/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type { StorybookConfig } from "@storybook/react-vite";

const relativePath = (...pathSegments: string[]) => path.resolve(__dirname, ...pathSegments);

const fontsPath = (...pathSegments: string[]) => relativePath("..", "src", "assets", "fonts", ...pathSegments);
const fontsPath = (...pathSegments: string[]) => relativePath("..", "packages", "core", "fonts", ...pathSegments);

const config: StorybookConfig = {
addons: [
Expand Down Expand Up @@ -44,7 +44,7 @@ const config: StorybookConfig = {
to: "/static",
},
],
stories: [relativePath("..", "src", "**", "*.stories.@(js|jsx|ts|tsx|mdx)")],
stories: [relativePath("..", "packages", "**", "*.stories.@(js|jsx|ts|tsx|mdx)")],
};

export default config;
3 changes: 1 addition & 2 deletions .storybook/preview.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { Preview } from "@storybook/react";
import { withThemeByClassName } from "@storybook/addon-styling";

import "../src/assets/fonts/fonts.css";
import "../src/mantle.css";
import "../packages/core/mantle.css";

const preview: Preview = {
parameters: {
Expand Down
10 changes: 5 additions & 5 deletions app/components/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Button } from "@/components/button";
// import { Input } from "@/components/input";
import { Select, SelectContent, SelectIcon, SelectOption, SelectTrigger } from "@/components/select";
import { isTheme, theme, useTheme } from "@/components/theme-provider";
import { cx } from "@/lib/cx";
import { Button } from "@/button";
// import { Input } from "@/input";
import { Select, SelectContent, SelectIcon, SelectOption, SelectTrigger } from "@/select";
import { isTheme, theme, useTheme } from "@/theme-provider";
import { cx } from "@/cx";
import { WithStyleProps } from "@/types/with-style-props";
import { Link, NavLink } from "@remix-run/react";
import { PropsWithChildren } from "react";
Expand Down
4 changes: 2 additions & 2 deletions app/root.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { cssBundleHref } from "@remix-run/css-bundle";
import { Links, LiveReload, Meta, Outlet, Scripts, ScrollRestoration } from "@remix-run/react";
import type { LinksFunction } from "@vercel/remix";
import mantleCss from "../src/mantle.css";
import { PreventWrongThemeFlash, ThemeProvider } from "@/components/theme-provider";
import mantleCss from "../packages/core/mantle.css";
import { PreventWrongThemeFlash, ThemeProvider } from "@/theme-provider";
import { Layout } from "./components/layout";

export const links: LinksFunction = () => [
Expand Down
2 changes: 1 addition & 1 deletion app/routes/base.colors.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cx } from "@/lib/cx";
import { cx } from "@/cx";
import { WithStyleProps } from "@/types/with-style-props";
import { HashNavLink } from "~/components/hash-nav-link";
import type { MetaFunction } from "@vercel/remix";
Expand Down
2 changes: 1 addition & 1 deletion app/routes/components.input.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { MetaFunction } from "@vercel/remix";
import { Input } from "@/components/input";
import { Input } from "@/input";
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";

export const meta: MetaFunction = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"use client";

import { usePrefersReducedMotion } from "@/hooks/use-prefers-reduced-motion";
import { usePrefersReducedMotion } from "../hooks/use-prefers-reduced-motion";
import { useWindowScroll } from "@uidotdev/usehooks";
import { useRef, type CSSProperties, useEffect } from "react";
import { Portal } from "./portal";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "./tooltip";
import { Portal } from "../portal";
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "../tooltip";
import { ArrowUpToLine } from "lucide-react";
import { cx } from "../lib/cx";
import { cx } from "../cx";

type Props = {
className?: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Meta, StoryObj } from "@storybook/react";

import { Button } from "./button";
import { Button } from "./";

const meta: Meta<typeof Button> = {
title: "Button",
Expand Down
2 changes: 1 addition & 1 deletion src/components/button.tsx → packages/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { type ButtonHTMLAttributes, forwardRef } from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva } from "class-variance-authority";

import { cx } from "../lib/cx";
import { cx } from "../cx";
import type { WithAsChild } from "../types/as-child";
import type { VariantProps } from "../types/variant-props";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Meta, StoryObj } from "@storybook/react";

import { Card, CardBody, CardFooter, CardHeader, CardTitle } from "./card";
import { Card, CardBody, CardFooter, CardHeader, CardTitle } from "./";

const meta = {
title: "Card",
Expand Down
2 changes: 1 addition & 1 deletion src/components/card.tsx → packages/card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { HTMLAttributes } from "react";
import { forwardRef } from "react";
import { Slot } from "@radix-ui/react-slot";

import { cx } from "../lib/cx";
import { cx } from "../cx";
import type { WithAsChild } from "../types/as-child";

export type Props = HTMLAttributes<HTMLDivElement>;
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/mantle.css → packages/core/mantle.css
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import url("./assets/fonts/fonts.css");
@import url("./fonts/fonts.css");

@tailwind base;
@tailwind components;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/** @type {import('tailwindcss').Config} */
import defaultTheme from "tailwindcss/defaultTheme";
import tailwindCssAnimatePlugin from "tailwindcss-animate";

export default {
darkMode: "class",
Expand Down Expand Up @@ -146,5 +147,5 @@ export default {
},
},
},
plugins: [require("tailwindcss-animate")],
plugins: [tailwindCssAnimatePlugin],
};
2 changes: 1 addition & 1 deletion src/lib/cx.test.ts → packages/cx/cx.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, expect, test } from "vitest";

import { cx } from "./cx";
import { cx } from ".";

describe("cx", () => {
test("given '', returns ''", () => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
"use client";

import * as DropdownMenuPrimitive from "@radix-ui/react-dropdown-menu";
import { Check, ChevronRight, Circle } from "lucide-react";

import type { ComponentPropsWithoutRef, ElementRef } from "react";
import { forwardRef } from "react";

import { cx } from "../lib/cx";
import { cx } from "../cx";

const DropdownMenu = DropdownMenuPrimitive.Root;

Expand Down
2 changes: 1 addition & 1 deletion src/components/input.tsx → packages/input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import type { InputHTMLAttributes } from "react";
import { forwardRef } from "react";
import { cva } from "class-variance-authority";

import { cx } from "../lib/cx";
import { cx } from "../cx";
import type { VariantProps } from "../types/variant-props";
import type { AutoComplete, InputType } from "../types/input";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Meta, StoryObj } from "@storybook/react";

import { Input } from "./input";
import { Input } from "./";

const meta: Meta<typeof Input> = {
title: "Input",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { forwardRef } from "react";
import type { HTMLAttributes } from "react";

import { cx } from "../lib/cx";
import { cx } from "../cx";

type Props = HTMLAttributes<HTMLDivElement>;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Meta, StoryObj } from "@storybook/react";

import { MediaObject, MediaObjectMedia, MediaObjectContent } from "./media-object";
import { MediaObject, MediaObjectMedia, MediaObjectContent } from "./";

const meta = {
title: "MediaObject",
Expand Down
2 changes: 0 additions & 2 deletions src/components/portal.tsx → packages/portal/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use client";

import { PropsWithChildren } from "react";
import { createPortal } from "react-dom";

Expand Down
4 changes: 1 addition & 3 deletions src/components/select.tsx → packages/select/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
"use client";

import { CaretSortIcon, CheckIcon } from "@radix-ui/react-icons";
import {
Root,
Expand All @@ -20,7 +18,7 @@ import {
import type { ComponentPropsWithoutRef, ElementRef } from "react";
import { forwardRef } from "react";

import { cx } from "../lib/cx";
import { cx } from "../cx";

const Select = Root;

Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Provider, Root, Trigger, Content } from "@radix-ui/react-tooltip";

import { cx } from "../lib/cx";
import { cx } from "../cx";
import { ComponentPropsWithoutRef, ElementRef, forwardRef } from "react";

const TooltipProvider = Provider;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import baseConfig from "./tailwind.base.config";
import baseConfig from "./packages/core/tailwind.preset";

export default {
presets: [baseConfig],
content: ["./src/**/*.{ts,tsx}", "./app/**/*.{ts,tsx}"],
content: ["./packages/**/*.{ts,tsx}", "./app/**/*.{ts,tsx}"],
};
2 changes: 1 addition & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"baseUrl": ".",
"paths": {
"~/*": ["./app/*"],
"@/*": ["./src/*"],
"@/*": ["./packages/*"],
},

// Remix takes care of building everything in `remix build`.
Expand Down
2 changes: 1 addition & 1 deletion vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export default defineConfig({
test: {
globals: true,
environment: "jsdom",
setupFiles: "./src/test/setup.ts",
setupFiles: "./vitest.setup.ts",
// you might want to disable it, if you don't have tests that rely on CSS
// since parsing CSS is slow
css: true,
Expand Down
File renamed without changes.