File tree Expand file tree Collapse file tree
graphiql/__mocks__/@graphiql Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' @graphiql/react ' : minor
3+ ---
4+
5+ Add ` DocsFilledIcon ` component and use show that icon in the sidebar when the docs plugin is visible
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import _DeprecatedArgumentIcon from './deprecated-argument.svg';
88import _DeprecatedEnumValueIcon from './deprecated-enum-value.svg' ;
99import _DeprecatedFieldIcon from './deprecated-field.svg' ;
1010import _DirectiveIcon from './directive.svg' ;
11+ import _DocsFilledIcon from './docs-filled.svg' ;
1112import _DocsIcon from './docs.svg' ;
1213import _EnumValueIcon from './enum-value.svg' ;
1314import _FieldIcon from './field.svg' ;
@@ -53,6 +54,7 @@ export const DeprecatedFieldIcon = generateIcon(
5354 'deprecated field icon' ,
5455) ;
5556export const DirectiveIcon = generateIcon ( _DirectiveIcon , 'directive icon' ) ;
57+ export const DocsFilledIcon = generateIcon ( _DocsFilledIcon , 'filled docs icon' ) ;
5658export const DocsIcon = generateIcon ( _DocsIcon , 'docs icon' ) ;
5759export const EnumValueIcon = generateIcon ( _EnumValueIcon , 'enum value icon' ) ;
5860export const FieldIcon = generateIcon ( _FieldIcon , 'field icon' ) ;
Original file line number Diff line number Diff line change 88} from 'react' ;
99import { DocExplorer , useExplorerContext } from './explorer' ;
1010import { History , useHistoryContext } from './history' ;
11- import { DocsIcon , HistoryIcon } from './icons' ;
11+ import { DocsFilledIcon , DocsIcon , HistoryIcon } from './icons' ;
1212import { useStorageContext } from './storage' ;
1313import { createContextHook , createNullableContext } from './utility/context' ;
1414
@@ -31,7 +31,14 @@ export type GraphiQLPlugin = {
3131
3232export const DOC_EXPLORER_PLUGIN : GraphiQLPlugin = {
3333 title : 'Documentation Explorer' ,
34- icon : DocsIcon ,
34+ icon : function Icon ( ) {
35+ const pluginContext = usePluginContext ( ) ;
36+ return pluginContext ?. visiblePlugin === DOC_EXPLORER_PLUGIN ? (
37+ < DocsFilledIcon />
38+ ) : (
39+ < DocsIcon />
40+ ) ;
41+ } ,
3542 content : DocExplorer ,
3643} ;
3744export const HISTORY_PLUGIN : GraphiQLPlugin = {
Original file line number Diff line number Diff line change @@ -31,6 +31,7 @@ export {
3131 DirectiveIcon ,
3232 DOC_EXPLORER_PLUGIN ,
3333 DocExplorer ,
34+ DocsFilledIcon ,
3435 DocsIcon ,
3536 EditorContext ,
3637 EditorContextProvider ,
You can’t perform that action at this time.
0 commit comments