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

fix: make sure hidden section not appearing in sidebar #1038

Merged
merged 10 commits into from
Aug 22, 2024
8 changes: 6 additions & 2 deletions library/src/containers/Sidebar/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const SidebarContext = React.createContext<{
export const Sidebar: React.FunctionComponent = () => {
const [showSidebar, setShowSidebar] = useState(false);
const asyncapi = useSpec();
const config = useConfig();

const info = asyncapi.info();
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment
Expand All @@ -23,6 +24,9 @@ export const Sidebar: React.FunctionComponent = () => {
const schemas = components?.schemas().all();
const hasOperations = asyncapi.operations().length > 0;

const showMessages = config.show?.messages;
const showSchemas = config.show?.schemas;

const messagesList = messages?.length > 0 && (
<li className="mb-3 mt-9">
<a
Expand Down Expand Up @@ -85,8 +89,8 @@ export const Sidebar: React.FunctionComponent = () => {
</a>
<OperationsList />
</li>
{messagesList}
{schemasList}
{showMessages && messagesList}
{showSchemas && schemasList}
</>
);

Expand Down
Loading