Skip to content

Commit 48e7dd0

Browse files
committed
docs: add info how to get questions to entity page
1 parent b06436c commit 48e7dd0

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

docs/setup.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,3 +86,35 @@ export const Root = ({ children }: PropsWithChildren<{}>) => (
8686
An interface for Q&A is now available at `/qeta`.
8787
8888
QetaPage also takes optional properties if you want to change the page title/subtitle/elements shown in the header.
89+
90+
### Adding questions to entity page
91+
92+
You can also add questions list to any entity page. This will render questions related to that entity. First
93+
create the questions component:
94+
95+
```ts
96+
import { useEntity } from '@backstage/plugin-catalog-react';
97+
import { Container } from '@material-ui/core';
98+
import { stringifyEntityRef } from '@backstage/catalog-model';
99+
import React from 'react';
100+
import { QuestionsContainer } from '@drodil/backstage-plugin-qeta';
101+
102+
export const QetaContent = () => {
103+
const { entity } = useEntity();
104+
105+
return (
106+
<Container>
107+
<QuestionsContainer entity={stringifyEntityRef(entity)} showTitle />
108+
</Container>
109+
);
110+
};
111+
```
112+
113+
Then add it to your entity page:
114+
115+
```ts
116+
// EntityPage.tsx
117+
<EntityLayout.Route path="/qeta" title="Q&A">
118+
<QetaContent />
119+
</EntityLayout.Route>,
120+
```

0 commit comments

Comments
 (0)