diff --git a/packages/docs/src/components/live-code-tab-layout.astro b/packages/docs/src/components/live-code-tab-layout.astro new file mode 100644 index 0000000..33eac95 --- /dev/null +++ b/packages/docs/src/components/live-code-tab-layout.astro @@ -0,0 +1,36 @@ +--- +// See https://astro-live-code.vercel.app/guides/customization/ +// +// Layouts can be specified for a specific code block by adding a layout attribute to the code block: +// ```tsx layout="~/components/live-code-tab-layout.astro" +import { Tabs, TabItem } from '@astrojs/starlight/components'; +--- + + + +
+ +
+
+ + + + + + \ No newline at end of file diff --git a/packages/docs/src/content/docs/customization/theme.mdx b/packages/docs/src/content/docs/customization/theme.mdx index a8d463e..dd0ce17 100644 --- a/packages/docs/src/content/docs/customization/theme.mdx +++ b/packages/docs/src/content/docs/customization/theme.mdx @@ -41,7 +41,7 @@ export default function AdvancedFilter({ schema }) { You can override existing theme by replacing them with your own custom components or templates. -```tsx live wrapper="~/components/mui-theme-wrapper.tsx" +```tsx live wrapper="~/components/mui-theme-wrapper.tsx" layout="~/components/live-code-tab-layout.astro" import { filterTheme } from "@fn-sphere/theme-mui-material"; import { Button } from "@mui/material"; import { @@ -51,8 +51,9 @@ import { useFilterRule, useFilterGroup, useView, + createFilterGroup, + createSingleFilter, } from "@fn-sphere/filter"; -import { Fragment } from "react"; const customTheme = { ...filterTheme, @@ -113,8 +114,22 @@ const customTheme = { }, }; +const presetRule = createFilterGroup({ + op: "and", + conditions: [ + createSingleFilter(), + createFilterGroup({ + op: "or", + conditions: [createSingleFilter(), createSingleFilter()], + }), + ], +}); + export default function AdvancedFilter({ schema }) { - const { predicate, context } = useFilterSphere({ schema }); + const { predicate, context } = useFilterSphere({ + schema, + defaultRule: presetRule, + }); return (