Skip to content

Commit

Permalink
slightly update readme examples
Browse files Browse the repository at this point in the history
  • Loading branch information
Rasmus Schmidt committed Feb 2, 2024
1 parent 0751539 commit 9ac7e0f
Showing 1 changed file with 17 additions and 16 deletions.
33 changes: 17 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,27 +100,24 @@ Component for a basic document page:
```tsx
import {
ContentCollection,
ContentComponent,
NeosContentNode,
NeosContext,
useMeta,
useSiteNode,
} from '@networkteam/zebra';
import { useContext } from 'react';
withMeta,
} from '@networkteam/zebra/server';

import Header from './partials/Header';

const DocumentPage = () => {
const meta = useMeta();
const DocumentPage = async ({ ctx }: { ctx: ContextProps }) => {
const meta = withMeta(ctx);
const inBackend = ctx.inBackend;

return (
<div className="flex min-h-screen flex-col">
<Header
mainNavigation={meta?.mainNavigation}
inBackend={inBackend}
/>

<main className="flex grow flex-col justify-between">
<ContentCollection className="grow" nodeName="main" />
<ContentCollection className="grow" nodeName="main" ctx={ctx} />
</main>
</div>
);
Expand Down Expand Up @@ -167,16 +164,20 @@ export default Headline;
Integrational component for a headline:

```tsx
import { ContentComponent, Editable, useNode } from '@networkteam/zebra';
import { ContextProps } from '@networkteam/zebra';
import { ContentComponent, Editable, withNode } from '@networkteam/zebra/server';

import { baseClasses } from '@/lib/utils/baseClasses';

import Headline from '../ui/Headline';

const ContentHeadline = () => {
const node = useNode();
const ContentHeadline = async ({ ctx }: { ctx: ContextProps }) => {
const node = await withNode(ctx);

return (
<ContentComponent>
<Headline as={node.properties.hierarchy} size={node.properties.size}>
<Editable property="title" />
<ContentComponent ctx={ctx} className={baseClasses(node)}>
<Headline as={node.properties?.hierarchy} size={node.properties?.size}>
<Editable ctx={ctx} property="title" />
</Headline>
</ContentComponent>
);
Expand Down

0 comments on commit 9ac7e0f

Please sign in to comment.