> For the complete documentation index, see [llms.txt](https://shaunh.gitbook.io/kairos/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://shaunh.gitbook.io/kairos/page-component.md).

# Page Component

Gets data associated with a block

The Page component calls these methods to see which blocks should be rendered. The Page component calls these methods to get the data that is associated with each block.

{% code title="ShowroomBlock.tsx" %}

```javascript
/**
 * Called from WP's block preview screen.
 * Separate from getServerSideProps because private/session based data might need to be mocked.
 * @returns
 */
export const getPreviewProps = async () => {
	return await getPropsData();
};

/**
 * Called by the page the block exists on within it's getServerSideProps method.
 * The result is passed to the component props.
 * @returns
 */
export const getServerSideProps = async () => {
	return await getPropsData();
};
```

{% endcode %}

Register Block

{% code title="gravity-platform-core.php" %}

```php
function gravity_platform_core_blocks_init()
{
	register_block_type(__DIR__ . '/src/blocks/showroom');
  register_block_type(__DIR__ . '/src/blocks/promotions');
}
add_action('init', 'gravity_platform_core_blocks_init');
```

{% endcode %}

Add to frontend > components > blocks

### \[slug] - Detail Page

In \[...slug] the post type should be the same as the post type name in the backend.
