Skip to content

Commit

Permalink
fixed hidden section still appearing in sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
AceTheCreator committed Aug 12, 2024
1 parent 14620a8 commit 17d2ae8
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 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 @@ -75,6 +79,7 @@ export const Sidebar: React.FunctionComponent = () => {

const operationList = hasOperations && (
<>
<h1>Testing</h1>
<li className="mb-3 mt-9">
<a
className="text-xs uppercase text-gray-700 mt-10 mb-4 font-thin hover:text-gray-900"
Expand All @@ -85,8 +90,8 @@ export const Sidebar: React.FunctionComponent = () => {
</a>
<OperationsList />
</li>
{messagesList}
{schemasList}
{showMessages && messagesList}
{showSchemas && schemasList}
</>
);

Expand Down

0 comments on commit 17d2ae8

Please sign in to comment.