From 677f39f786ccee39aea055d2d7bf3dcc3a8a19e9 Mon Sep 17 00:00:00 2001 From: Zai Shi Date: Sun, 14 Apr 2024 08:24:20 +0200 Subject: [PATCH] fixed small things in documentation --- apps/dev/src/components/custom-button.tsx | 32 +++++++++++++ apps/dev/src/components/provider.tsx | 4 +- .../docs/02-customization/02-custom-colors.md | 2 +- .../02-customization/03-custom-components.md | 47 ++++++++++++------- docs/docs/03-api-documentation/01-app.md | 5 ++ .../stack/src/components-core-joy/button.tsx | 8 ---- 6 files changed, 70 insertions(+), 28 deletions(-) create mode 100644 apps/dev/src/components/custom-button.tsx diff --git a/apps/dev/src/components/custom-button.tsx b/apps/dev/src/components/custom-button.tsx new file mode 100644 index 000000000..818c06e51 --- /dev/null +++ b/apps/dev/src/components/custom-button.tsx @@ -0,0 +1,32 @@ +'use client'; + +import React from "react"; +import { Button as DefaultButton, useDesign } from "@stackframe/stack"; + +export const Button = React.forwardRef< + HTMLButtonElement, + React.ComponentProps +>(({ + variant = "primary", + color, + size = "md", + loading = false, + disabled = false, + ...props +}, ref) => { + const { colors } = useDesign(); + + return ; -} + />; +}); + +Button.displayName = "Button"; ``` Then you can pass the custom button to the `StackTheme` (if you followed the get started guide, you can find it in your `layout.tsx` file) as follows: @@ -67,13 +72,19 @@ const theme = { Now if you check out your sign-in page, you will see the sign-in button there is using your custom button component. If you import `Button` from `@stackframe/stack`, it will also use your custom button component as well. Here is a list of low-level components that you can customize, stared ones are the most used and recommended to customize first: -- Button ⭐ -- Container -- Separator -- Input ⭐ -- Label -- Link -- Text ⭐ + +- `Input` ⭐ +- `Button` ⭐ +- `Container` +- `Separator` +- `Label` +- `Link` +- `Text` ⭐ +- `Popover`, `PopoverTrigger`, `PopoverContent` +- `DropdownMenu`, `DropdownMenuTrigger`, `DropdownMenuContent`, `DropdownMenuItem`, `DropdownMenuLabel`, `DropdownMenuSeparator` +- `Avatar`, `AvatarFallback`, `AvatarImage` +- `Collapsible`, `CollapsibleTrigger`, `CollapsibleContent` +- `Card`, `CardHeader`, `CardContent`, `CardFooter`, `CardDescription` ## MUI Joy setup diff --git a/docs/docs/03-api-documentation/01-app.md b/docs/docs/03-api-documentation/01-app.md index 96d84aa16..d7e9057c3 100644 --- a/docs/docs/03-api-documentation/01-app.md +++ b/docs/docs/03-api-documentation/01-app.md @@ -94,6 +94,11 @@ export const stackApp = new StackServerApp({ The URL of the forgot password page. +- `account-settings` + Default: `"/handler/account-settings"` + + The URL of the account settings page. + - `handler` Default: `"/handler"` diff --git a/packages/stack/src/components-core-joy/button.tsx b/packages/stack/src/components-core-joy/button.tsx index df5557bf2..61e1508c4 100644 --- a/packages/stack/src/components-core-joy/button.tsx +++ b/packages/stack/src/components-core-joy/button.tsx @@ -5,14 +5,6 @@ import { Button as DefaultButton } from "../components-core"; import { Button as JoyButton } from '@mui/joy'; import Color from "color"; -// export default function Button({ -// variant = "primary", -// color, -// size = "md", -// loading = false, -// ...props -// } : React.ComponentProps) { - export const Button = React.forwardRef< HTMLButtonElement, React.ComponentProps