mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-01-11 20:00:29 +01:00
Add docs close button
This commit is contained in:
@@ -15,8 +15,10 @@ import {
|
||||
} from 'graphql';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { ReactNode, useState } from 'react';
|
||||
import { graphqlSchemaAtom } from '../atoms/graphqlSchemaAtom';
|
||||
import { graphqlDocStateAtom, graphqlSchemaAtom } from '../atoms/graphqlSchemaAtom';
|
||||
import { jotaiStore } from '../lib/jotai';
|
||||
import { Icon } from './core/Icon';
|
||||
import { IconButton } from './core/IconButton';
|
||||
import { Markdown } from './Markdown';
|
||||
|
||||
type ExplorerItem =
|
||||
@@ -43,7 +45,16 @@ export function GraphQLDocsExplorer() {
|
||||
const allTypes = graphqlSchema.getTypeMap();
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div className="relative w-full">
|
||||
<IconButton
|
||||
icon="x"
|
||||
size="sm"
|
||||
className="!absolute right-2 top-0"
|
||||
title="Close documenation explorer"
|
||||
onClick={() => {
|
||||
jotaiStore.set(graphqlDocStateAtom, false);
|
||||
}}
|
||||
/>
|
||||
{activeItem == null ? (
|
||||
<div className="flex flex-col gap-3 overflow-auto h-full">
|
||||
<Heading>Root Types</Heading>
|
||||
@@ -72,6 +83,7 @@ export function GraphQLDocsExplorer() {
|
||||
const t = allTypes[typeName]!;
|
||||
return (
|
||||
<GqlTypeLink
|
||||
key={t.name}
|
||||
color="notice"
|
||||
item={{ kind: 'type', type: t, from: null }}
|
||||
setItem={setActiveItem}
|
||||
|
||||
Reference in New Issue
Block a user