Skip to content

Commit

Permalink
button config recipie
Browse files Browse the repository at this point in the history
  • Loading branch information
dsod committed Feb 19, 2024
1 parent d56bc90 commit 8a48e13
Show file tree
Hide file tree
Showing 11 changed files with 65 additions and 10 deletions.
13 changes: 12 additions & 1 deletion .husky/pre-commit
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1 +1,12 @@
pnpm biome check --apply --changed --since=$(git rev-parse --short HEAD~) --files-ignore-unknown=true
#!/bin/sh
set -eu

if git status --short | grep --quiet '^MM'; then
printf '%s\n' "ERROR: Some staged files have unstaged changes" >&2
exit 1;
fi

git diff -z --staged --name-only --diff-filter=ACMR | \
xargs -0 pnpm biome check --apply --files-ignore-unknown=true --no-errors-on-unmatched

git update-index --again
7 changes: 7 additions & 0 deletions packages/css/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
"cwd": "packages/css",
"command": "pnpm panda codegen"
}
},
"dev": {
"executor": "nx:run-commands",
"options": {
"cwd": "packages/css",
"command": "pnpm panda codegen --watch"
}
}
},
"tags": []
Expand Down
9 changes: 5 additions & 4 deletions packages/css/src/recipies/button.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { type RecipeVariantProps, cva } from "styled-system/css";

export const buttonRecipie = cva({
import { defineRecipe } from "@pandacss/dev";
export const buttonRecipie = defineRecipe({
className: "button",
staticCss: ["*"],
base: {
display: "inline-flex",
alignItems: "center",
Expand Down Expand Up @@ -33,4 +34,4 @@ export const buttonRecipie = cva({
},
});

export type ButtonVariants = RecipeVariantProps<typeof buttonRecipie>;
export type { ButtonVariant } from "styled-system/recipes";
3 changes: 2 additions & 1 deletion packages/css/src/recipies/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { type ButtonVariants, buttonRecipie } from "./button";
export * from "./button";
export type * from "./button";
14 changes: 14 additions & 0 deletions packages/qwik/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,20 @@
"command": "pnpm panda codegen"
}
},
"dev": {
"executor": "nx:run-commands",
"options": {
"cwd": "packages/css",
"command": "pnpm panda codegen --watch"
}
},
"build:css": {
"executor": "nx:run-commands",
"options": {
"cwd": "packages/qwik",
"command": "mkdir -p ../../dist/qwik/css && pnpm panda cssgen --outfile ../../dist/qwik/css/styles.css"
}
},
"build": {
"executor": "@nx/vite:build",
"dependsOn": ["prepare-build"],
Expand Down
2 changes: 2 additions & 0 deletions packages/qwik/src/components/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ import { buttonRecipie } from "@dui/css/recipies";
import { styled } from "../styled-system/jsx";

export const Button = styled("button", buttonRecipie);

export const CssButton = () => <Button size="small">Hello</Button>;
7 changes: 7 additions & 0 deletions packages/react/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
"command": "pnpm panda codegen"
}
},
"dev": {
"executor": "nx:run-commands",
"options": {
"cwd": "packages/css",
"command": "pnpm panda codegen --watch"
}
},
"build": {
"executor": "@nx/vite:build",
"dependsOn": ["prepare-build", "^build"],
Expand Down
5 changes: 2 additions & 3 deletions packages/react/tsconfig.lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
"isolatedModules": true,
"esModuleInterop": true,
"jsx": "react-jsx",
"types": ["vite/client"],
"baseUrl": "./src"
"types": ["vite/client"]
},
"include": ["src/**/*.tsx", "src/components/Button/Button.mtsx"],
"include": ["src/**/*.tsx"],
"exclude": ["src/**/*.spec.ts", "src/**/*.test.ts"]
}
7 changes: 7 additions & 0 deletions packages/solidjs/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@
"command": "pnpm panda codegen"
}
},
"dev": {
"executor": "nx:run-commands",
"options": {
"cwd": "packages/css",
"command": "pnpm panda codegen --watch"
}
},
"build": {
"executor": "@nx/vite:build",
"dependsOn": ["prepare-build"],
Expand Down
7 changes: 6 additions & 1 deletion panda.base.config.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { resolve } from "path";
import { defineConfig } from "@pandacss/dev";
import { buttonRecipie } from "./packages/css/src/recipies";

export const getDefaultConfig = (projectRoot) =>
defineConfig({
Expand All @@ -14,7 +15,11 @@ export const getDefaultConfig = (projectRoot) =>

// Useful for theme customization
theme: {
extend: {},
extend: {
recipes: {
button: buttonRecipie,
},
},
},

// The output directory for your css system
Expand Down
1 change: 1 addition & 0 deletions tsconfig.base.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"verbatimModuleSyntax": true,
"module": "ESNext",
"moduleResolution": "bundler",
"target": "ES2022",
Expand Down

0 comments on commit 8a48e13

Please sign in to comment.