Skip to content

Commit

Permalink
Remove zod dep
Browse files Browse the repository at this point in the history
  • Loading branch information
seanchas116 committed Apr 27, 2023
1 parent a411568 commit e8227e0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 57 deletions.
3 changes: 1 addition & 2 deletions packages/elements-react/package.json
Expand Up @@ -9,8 +9,7 @@
"build-storybook": "storybook build"
},
"dependencies": {
"csstype": "^3.1.2",
"zod": "^3.21.4"
"csstype": "^3.1.2"
},
"devDependencies": {
"@babel/preset-env": "^7.21.4",
Expand Down
76 changes: 24 additions & 52 deletions packages/elements-react/src/StyleProps.ts
@@ -1,55 +1,27 @@
import { z } from "zod";

const Shadow = z.object({
color: z.string(),
x: z.number(),
y: z.number(),
blur: z.number(),
spread: z.number(),
});

type Shadow = z.infer<typeof Shadow>;

const StackDirection = z.enum(["x", "y"]);
type StackDirection = z.infer<typeof StackDirection>;

const StackAlign = z.enum(["start", "center", "end"]);
type StackAlign = z.infer<typeof StackAlign>;

const StackJustify = z.enum(["start", "center", "end", "spaceBetween"]);
type StackJustify = z.infer<typeof StackJustify>;

const TextHorizontalAlign = z.enum(["start", "center", "end", "justify"]);
type TextHorizontalAlign = z.infer<typeof TextHorizontalAlign>;

const TextVerticalAlign = z.enum(["start", "center", "end"]);
type TextVerticalAlign = z.infer<typeof TextVerticalAlign>;

const Position = z.object({
left: z.number().optional(),
top: z.number().optional(),
right: z.number().optional(),
bottom: z.number().optional(),
});
type Position = z.infer<typeof Position>;

const Size = z.union([
z.literal("hug"),
z.number(),
z.object({
min: z.number(),
max: z.number().optional(),
}),
]);
type Size = z.infer<typeof Size>;

const Color = z.string();
type Color = z.infer<typeof Color>;

const Fill = z.object({
solid: Color,
});
type Fill = z.infer<typeof Fill>;
interface Shadow {
color: string;
x: number;
y: number;
blur: number;
spread: number;
}

type StackDirection = "x" | "y";
type StackAlign = "start" | "center" | "end";
type StackJustify = "start" | "center" | "end" | "spaceBetween";
type TextHorizontalAlign = "start" | "center" | "end" | "justify";
type TextVerticalAlign = "start" | "center" | "end";

interface Position {
left?: number;
top?: number;
right?: number;
bottom?: number;
}

type Size = "hug" | number | { min: number; max?: number };

type Fill = { solid: string };

export interface StyleProps {
hidden: boolean;
Expand Down
3 changes: 0 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e8227e0

Please sign in to comment.