|
1 | 1 | "use client"; |
2 | 2 |
|
| 3 | +import { InlineLink } from "@/components/inline-link"; |
3 | 4 | import { Page } from "@/components/page"; |
| 5 | +import { CodeSquareIcon } from "lucide-react"; |
4 | 6 | import { useTheme } from "next-themes"; |
5 | | -import { Button, Text } from "@brifui/components"; |
| 7 | +import { Button, Card, Codeblock, Text } from "@brifui/components"; |
6 | 8 | import { css, Styles } from "@brifui/styled/css"; |
7 | 9 |
|
8 | 10 | export default function ColorsDocs() { |
@@ -69,6 +71,107 @@ export default function ColorsDocs() { |
69 | 71 | </Page.Preview> |
70 | 72 | <Page.CodePreview>Try it out</Page.CodePreview> |
71 | 73 | </Page.Section> |
| 74 | + |
| 75 | + <Page.Section |
| 76 | + shadow={false} |
| 77 | + title="Override component styles" |
| 78 | + description="BrifUI helps you override the default component styles easily via configurations." |
| 79 | + > |
| 80 | + <p> |
| 81 | + Let's override the default styles of the{" "} |
| 82 | + <InlineLink href="/docs/button">Button</InlineLink> component, which |
| 83 | + has 2 <strong>slots</strong>: |
| 84 | + </p> |
| 85 | + <p> |
| 86 | + <ul className={css({ listStyle: "inside" })}> |
| 87 | + <Text as="li" fontWeight="semibold"> |
| 88 | + root |
| 89 | + </Text> |
| 90 | + <Text as="li" fontWeight="semibold"> |
| 91 | + container |
| 92 | + </Text> |
| 93 | + </ul> |
| 94 | + </p> |
| 95 | + <p> |
| 96 | + And we want to change the default text color of the{" "} |
| 97 | + <InlineLink href="/docs/button">Button</InlineLink> to <b>blue</b>. |
| 98 | + </p> |
| 99 | + <p> |
| 100 | + Each component can configure individually by overriding 2{" "} |
| 101 | + <b>properties</b>: |
| 102 | + </p> |
| 103 | + <p> |
| 104 | + <ul className={css({ listStyle: "inside" })}> |
| 105 | + <Text as="li" fontWeight="semibold"> |
| 106 | + base |
| 107 | + </Text> |
| 108 | + <Text as="li" fontWeight="semibold"> |
| 109 | + variants |
| 110 | + </Text> |
| 111 | + </ul> |
| 112 | + </p> |
| 113 | + |
| 114 | + <Card bordered css={css.raw({ mb: 6 })}> |
| 115 | + <Card.Body> |
| 116 | + <Codeblock.Root> |
| 117 | + <Codeblock.Header |
| 118 | + icon={<CodeSquareIcon />} |
| 119 | + filename="brifui.config.ts" |
| 120 | + /> |
| 121 | + <Codeblock.Content language="bash">{`import { defineConfig } from "@brifui/theme"; |
| 122 | + |
| 123 | +export default defineConfig({ |
| 124 | + ..., |
| 125 | + recipes: { |
| 126 | + button: { |
| 127 | + variants: { |
| 128 | + size: { |
| 129 | + md: { |
| 130 | + container: { |
| 131 | + borderRadius: "none" |
| 132 | + } |
| 133 | + } |
| 134 | + } |
| 135 | + } |
| 136 | + } |
| 137 | + } |
| 138 | +});`}</Codeblock.Content> |
| 139 | + </Codeblock.Root> |
| 140 | + </Card.Body> |
| 141 | + <Card.Footer> |
| 142 | + This configuration will make{" "} |
| 143 | + <InlineLink href="/docs/button">Button</InlineLink> of size{" "} |
| 144 | + <Text |
| 145 | + css={css.raw({ |
| 146 | + py: "0.5", |
| 147 | + px: 2, |
| 148 | + bg: "default", |
| 149 | + textStyle: "text.sm", |
| 150 | + color: "default.foreground", |
| 151 | + borderRadius: "component.md" |
| 152 | + })} |
| 153 | + fontWeight="semibold" |
| 154 | + > |
| 155 | + md |
| 156 | + </Text>{" "} |
| 157 | + has no{" "} |
| 158 | + <Text |
| 159 | + css={css.raw({ |
| 160 | + py: "0.5", |
| 161 | + px: 2, |
| 162 | + bg: "default", |
| 163 | + textStyle: "text.sm", |
| 164 | + color: "default.foreground", |
| 165 | + borderRadius: "component.md" |
| 166 | + })} |
| 167 | + fontWeight="semibold" |
| 168 | + > |
| 169 | + border-radius |
| 170 | + </Text> |
| 171 | + . |
| 172 | + </Card.Footer> |
| 173 | + </Card> |
| 174 | + </Page.Section> |
72 | 175 | </Page> |
73 | 176 | ); |
74 | 177 | } |
0 commit comments