mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-03-28 20:21:52 +01:00
Add docs close button
This commit is contained in:
@@ -15,8 +15,10 @@ import {
|
|||||||
} from 'graphql';
|
} from 'graphql';
|
||||||
import { useAtomValue } from 'jotai';
|
import { useAtomValue } from 'jotai';
|
||||||
import { ReactNode, useState } from 'react';
|
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 { Icon } from './core/Icon';
|
||||||
|
import { IconButton } from './core/IconButton';
|
||||||
import { Markdown } from './Markdown';
|
import { Markdown } from './Markdown';
|
||||||
|
|
||||||
type ExplorerItem =
|
type ExplorerItem =
|
||||||
@@ -43,7 +45,16 @@ export function GraphQLDocsExplorer() {
|
|||||||
const allTypes = graphqlSchema.getTypeMap();
|
const allTypes = graphqlSchema.getTypeMap();
|
||||||
|
|
||||||
return (
|
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 ? (
|
{activeItem == null ? (
|
||||||
<div className="flex flex-col gap-3 overflow-auto h-full">
|
<div className="flex flex-col gap-3 overflow-auto h-full">
|
||||||
<Heading>Root Types</Heading>
|
<Heading>Root Types</Heading>
|
||||||
@@ -72,6 +83,7 @@ export function GraphQLDocsExplorer() {
|
|||||||
const t = allTypes[typeName]!;
|
const t = allTypes[typeName]!;
|
||||||
return (
|
return (
|
||||||
<GqlTypeLink
|
<GqlTypeLink
|
||||||
|
key={t.name}
|
||||||
color="notice"
|
color="notice"
|
||||||
item={{ kind: 'type', type: t, from: null }}
|
item={{ kind: 'type', type: t, from: null }}
|
||||||
setItem={setActiveItem}
|
setItem={setActiveItem}
|
||||||
|
|||||||
Reference in New Issue
Block a user