Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: backfill next readme with getGlobalStyles() and getTemplateData() #46

Merged
31 changes: 31 additions & 0 deletions docs/mutating-query.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Global Styles

Global styles can be mutated by passing `getGlobalStyles` attribute to `RootLayout` in `src/app/layout.tsx`.

`getGlobalStyles` takes an async callback function that returns an object containing global styles.

The default definition for `getGlobalStyles` function passed in `getGlobalStyles` attribute to `RootLayout` in `src/app/[[...path]]/layout.tsx`, can be found in [@snapwp/query](../packages/query/README.md) package.

Type Definition of `getGlobalStyles`:

```typescript
type getGlobalStyles = () => Promise< GlobalHeadProps >;
```

Type definition of `GlobalHeadProps` can be found in [@snapwp/core](../packages/core/README.md) package.

# Template Data

Template data can be mutated by passing `getTemplateData` attribute to `TemplateRenderer` in `src/app/[[...path]]/page.tsx`.

`getTemplateData` takes an async callback to get template styles and content.

The default definition for `getTemplateData` function passed in `getTemplateData` attribute to `TemplateRenderer` in `src/app/[[...path]]/page.tsx`, can be found in [@snapwp/query](../packages/query/README.md) package.

Type Definition of `getTemplateData`:

```typescript
type getTemplateData = ( uri: string ) => Promise< TemplateData >;
```

Type definition of `TemplateData` can be found in [@snapwp/core](../packages/core/README.md) package.