Skip to content
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
6 changes: 6 additions & 0 deletions .changeset/cool-maps-exist.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@macalinao/zod-solana": patch
"@macalinao/grill": patch
---

support isolated declarations in zod-solana
27 changes: 25 additions & 2 deletions apps/example-dapp/biome.jsonc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"root": false,
"$schema": "https://biomejs.dev/schemas/2.2.7/schema.json",
"extends": "//",
"$schema": "https://biomejs.dev/schemas/2.3.0/schema.json",
"extends": ["@macalinao/biome-config/base", "@macalinao/biome-config/react"],
"linter": {
"domains": {
"react": "recommended"
Expand Down Expand Up @@ -31,6 +31,29 @@
"formatter": {
"enabled": false
}
},
{
"includes": ["src/routes/**/*.tsx"],
"linter": {
"rules": {
"style": {
"useComponentExportOnlyModules": "off"
}
}
}
},
{
"includes": [
"src/components/ui/sidebar.tsx",
"src/components/theme-provider.tsx"
],
"linter": {
"rules": {
"style": {
"useComponentExportOnlyModules": "off"
}
}
}
}
]
}
1 change: 1 addition & 0 deletions apps/example-dapp/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
},
"devDependencies": {
"@eslint/js": "^9.38.0",
"@macalinao/biome-config": "^0.1.4",
"@macalinao/eslint-config": "catalog:",
"@macalinao/grill": "workspace:^",
"@macalinao/tsconfig": "catalog:",
Expand Down
24 changes: 3 additions & 21 deletions apps/example-dapp/src/components/theme-provider.tsx
Original file line number Diff line number Diff line change
@@ -1,26 +1,14 @@
import type * as React from "react";
import { createContext, useContext, useEffect, useState } from "react";

type Theme = "dark" | "light" | "system";
import type { Theme } from "~/hooks/use-theme";
import { useEffect, useState } from "react";
import { ThemeProviderContext } from "~/hooks/use-theme";

interface ThemeProviderProps {
children: React.ReactNode;
defaultTheme?: Theme;
storageKey?: string;
}

interface ThemeProviderState {
theme: Theme;
setTheme: (theme: Theme) => void;
}

const initialState: ThemeProviderState = {
theme: "system",
setTheme: () => null,
};

const ThemeProviderContext = createContext<ThemeProviderState>(initialState);

export const ThemeProvider: React.FC<ThemeProviderProps> = ({
children,
defaultTheme = "system",
Expand Down Expand Up @@ -63,9 +51,3 @@ export const ThemeProvider: React.FC<ThemeProviderProps> = ({
</ThemeProviderContext.Provider>
);
};

// eslint-disable-next-line react-refresh/only-export-components
export const useTheme = (): ThemeProviderState => {
const context = useContext(ThemeProviderContext);
return context;
};
2 changes: 1 addition & 1 deletion apps/example-dapp/src/components/theme-toggle.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type * as React from "react";
import { Moon, Sun } from "lucide-react";
import { useTheme } from "@/components/theme-provider";
import { Button } from "@/components/ui/button";
import { useTheme } from "@/hooks/use-theme";

export const ThemeToggle: React.FC = () => {
const { theme, setTheme } = useTheme();
Expand Down
32 changes: 32 additions & 0 deletions apps/example-dapp/src/components/ui/button-variants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { cva } from "class-variance-authority";

export const buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
{
variants: {
variant: {
default:
"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
destructive:
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
outline:
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
secondary:
"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
ghost:
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-9 px-4 py-2 has-[>svg]:px-3",
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
icon: "size-9",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
},
);
36 changes: 2 additions & 34 deletions apps/example-dapp/src/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -1,39 +1,8 @@
import type { VariantProps } from "class-variance-authority";
import type * as React from "react";
import { Slot } from "@radix-ui/react-slot";
import { cva } from "class-variance-authority";
import { cn } from "@/lib/utils";

const buttonVariants = cva(
"inline-flex items-center justify-center gap-2 whitespace-nowrap rounded-md text-sm font-medium transition-all disabled:pointer-events-none disabled:opacity-50 [&_svg]:pointer-events-none [&_svg:not([class*='size-'])]:size-4 shrink-0 [&_svg]:shrink-0 outline-none focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 aria-invalid:border-destructive",
{
variants: {
variant: {
default:
"bg-primary text-primary-foreground shadow-xs hover:bg-primary/90",
destructive:
"bg-destructive text-white shadow-xs hover:bg-destructive/90 focus-visible:ring-destructive/20 dark:focus-visible:ring-destructive/40 dark:bg-destructive/60",
outline:
"border bg-background shadow-xs hover:bg-accent hover:text-accent-foreground dark:bg-input/30 dark:border-input dark:hover:bg-input/50",
secondary:
"bg-secondary text-secondary-foreground shadow-xs hover:bg-secondary/80",
ghost:
"hover:bg-accent hover:text-accent-foreground dark:hover:bg-accent/50",
link: "text-primary underline-offset-4 hover:underline",
},
size: {
default: "h-9 px-4 py-2 has-[>svg]:px-3",
sm: "h-8 rounded-md gap-1.5 px-3 has-[>svg]:px-2.5",
lg: "h-10 rounded-md px-6 has-[>svg]:px-4",
icon: "size-9",
},
},
defaultVariants: {
variant: "default",
size: "default",
},
},
);
import { buttonVariants } from "./button-variants";

function Button({
className,
Expand All @@ -56,5 +25,4 @@ function Button({
);
}

// eslint-disable-next-line react-refresh/only-export-components
export { Button, buttonVariants };
export { Button };
7 changes: 5 additions & 2 deletions apps/example-dapp/src/components/ui/sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const SIDEBAR_WIDTH_MOBILE = "18rem";
const SIDEBAR_WIDTH_ICON = "3rem";
const SIDEBAR_KEYBOARD_SHORTCUT = "b";

interface SidebarContextProps {
export interface SidebarContextProps {
state: "expanded" | "collapsed";
open: boolean;
setOpen: (open: boolean) => void;
Expand All @@ -40,7 +40,10 @@ interface SidebarContextProps {
toggleSidebar: () => void;
}

const SidebarContext = React.createContext<SidebarContextProps | null>(null);
// eslint-disable-next-line react-refresh/only-export-components
export const SidebarContext = React.createContext<SidebarContextProps | null>(
null,
);

function useSidebar() {
const context = React.useContext(SidebarContext);
Expand Down
21 changes: 21 additions & 0 deletions apps/example-dapp/src/hooks/use-theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { createContext, useContext } from "react";

export type Theme = "dark" | "light" | "system";

export interface ThemeProviderState {
theme: Theme;
setTheme: (theme: Theme) => void;
}

const initialState: ThemeProviderState = {
theme: "system",
setTheme: () => null,
};

export const ThemeProviderContext =
createContext<ThemeProviderState>(initialState);

export const useTheme = (): ThemeProviderState => {
const context = useContext(ThemeProviderContext);
return context;
};
2 changes: 1 addition & 1 deletion biome.jsonc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"$schema": "https://biomejs.dev/schemas/2.2.7/schema.json",
"$schema": "https://biomejs.dev/schemas/2.3.0/schema.json",
"extends": ["@macalinao/biome-config/base"]
}
Loading