-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
adjust @graphiql/plugin-explorer
styles
#3633
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphiql/plugin-explorer': minor | ||
--- | ||
|
||
adjust `@graphiql/plugin-explorer` styles |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions
14
packages/graphiql-plugin-explorer/src/icons/checkbox-checked.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions
10
packages/graphiql-plugin-explorer/src/icons/checkbox-unchecked.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
24 changes: 24 additions & 0 deletions
24
packages/graphiql-plugin-explorer/src/icons/folder-plus.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
import React, { CSSProperties, useCallback } from 'react'; | ||
import { | ||
GraphiQLPlugin, | ||
useEditorContext, | ||
|
@@ -10,7 +11,11 @@ import { | |
Explorer as GraphiQLExplorer, | ||
GraphiQLExplorerProps, | ||
} from 'graphiql-explorer'; | ||
import React, { useCallback } from 'react'; | ||
|
||
import ArrowIcon from './icons/arrow.svg'; | ||
import FolderPlusIcon from './icons/folder-plus.svg'; | ||
import CheckboxUncheckedIcon from './icons/checkbox-unchecked.svg'; | ||
import CheckboxCheckedIcon from './icons/checkbox-checked.svg'; | ||
|
||
import './graphiql-explorer.d.ts'; | ||
import './index.css'; | ||
|
@@ -29,92 +34,31 @@ const colors = { | |
atom: 'hsl(var(--color-tertiary))', | ||
}; | ||
|
||
/* eslint-disable @arthurgeron/react-usememo/require-usememo */ | ||
const arrowOpen = ( | ||
<svg | ||
viewBox="0 -4 13 15" | ||
style={{ | ||
color: 'hsla(var(--color-neutral), var(--alpha-tertiary, 0.4))', | ||
marginRight: 'var(--px-4)', | ||
height: 'var(--px-16)', | ||
width: 'var(--px-16)', | ||
}} | ||
> | ||
<path | ||
d="M3.35355 6.85355L6.14645 9.64645C6.34171 9.84171 6.65829 9.84171 6.85355 9.64645L9.64645 6.85355C9.96143 6.53857 9.73835 6 9.29289 6L3.70711 6C3.26165 6 3.03857 6.53857 3.35355 6.85355Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
); | ||
|
||
const arrowClosed = ( | ||
<svg | ||
viewBox="0 -2 13 15" | ||
style={{ | ||
color: 'hsla(var(--color-neutral), var(--alpha-tertiary, 0.4))', | ||
marginRight: 'var(--px-4)', | ||
height: 'var(--px-16)', | ||
width: 'var(--px-16)', | ||
}} | ||
> | ||
<path | ||
d="M6.35355 11.1464L9.14645 8.35355C9.34171 8.15829 9.34171 7.84171 9.14645 7.64645L6.35355 4.85355C6.03857 4.53857 5.5 4.76165 5.5 5.20711V10.7929C5.5 11.2383 6.03857 11.4614 6.35355 11.1464Z" | ||
fill="currentColor" | ||
/> | ||
</svg> | ||
<ArrowIcon style={{ width: 'var(--px-16)', transform: 'rotate(90deg)' }} /> | ||
); | ||
|
||
const arrowClosed = <ArrowIcon style={{ width: 'var(--px-16)' }} />; | ||
const checkboxUnchecked = ( | ||
<svg | ||
viewBox="0 0 15 15" | ||
style={{ | ||
color: 'hsla(var(--color-neutral), var(--alpha-tertiary, 0.4))', | ||
marginRight: 'var(--px-4)', | ||
height: 'var(--px-16)', | ||
width: 'var(--px-16)', | ||
}} | ||
> | ||
<circle cx="7.5" cy="7.5" r="6" stroke="currentColor" fill="none" /> | ||
</svg> | ||
<CheckboxUncheckedIcon style={{ marginRight: 'var(--px-4)' }} /> | ||
); | ||
|
||
const checkboxChecked = ( | ||
<svg | ||
viewBox="0 0 15 15" | ||
style={{ | ||
color: 'hsl(var(--color-info))', | ||
marginRight: 'var(--px-4)', | ||
height: 'var(--px-16)', | ||
width: 'var(--px-16)', | ||
}} | ||
> | ||
<circle cx="7.5" cy="7.5" r="7.5" fill="currentColor" /> | ||
<path | ||
d="M4.64641 7.00106L6.8801 9.23256L10.5017 5.61325" | ||
fill="none" | ||
stroke="white" | ||
strokeWidth="1.5" | ||
/> | ||
</svg> | ||
<CheckboxCheckedIcon | ||
style={{ fill: 'hsl(var(--color-info))', marginRight: 'var(--px-4)' }} | ||
/> | ||
); | ||
/* eslint-enable @arthurgeron/react-usememo/require-usememo */ | ||
|
||
const styles = { | ||
const styles: Record<string, CSSProperties> = { | ||
buttonStyle: { | ||
backgroundColor: 'transparent', | ||
border: 'none', | ||
color: 'hsla(var(--color-neutral), var(--alpha-secondary, 0.6))', | ||
cursor: 'pointer', | ||
fontSize: '1em', | ||
fontSize: '2em', | ||
lineHeight: 0, | ||
}, | ||
explorerActionsStyle: { | ||
padding: 'var(--px-8) var(--px-4)', | ||
}, | ||
actionButtonStyle: { | ||
backgroundColor: 'transparent', | ||
border: 'none', | ||
color: 'hsla(var(--color-neutral), var(--alpha-secondary, 0.6))', | ||
cursor: 'pointer', | ||
fontSize: '1em', | ||
paddingTop: 'var(--px-16)', | ||
}, | ||
actionButtonStyle: {}, | ||
}; | ||
|
||
export type GraphiQLExplorerPluginProps = Omit< | ||
|
@@ -163,32 +107,11 @@ function ExplorerPlugin(props: GraphiQLExplorerPluginProps) { | |
} | ||
|
||
export function explorerPlugin( | ||
props: GraphiQLExplorerPluginProps, | ||
props?: GraphiQLExplorerPluginProps, | ||
Comment on lines
-166
to
+110
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
): GraphiQLPlugin { | ||
return { | ||
title: 'GraphiQL Explorer', | ||
icon: () => ( | ||
<svg height="1em" strokeWidth="1.5" viewBox="0 0 24 24" fill="none"> | ||
<path | ||
d="M18 6H20M22 6H20M20 6V4M20 6V8" | ||
stroke="currentColor" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
<path | ||
d="M21.4 20H2.6C2.26863 20 2 19.7314 2 19.4V11H21.4C21.7314 11 22 11.2686 22 11.6V19.4C22 19.7314 21.7314 20 21.4 20Z" | ||
stroke="currentColor" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
<path | ||
d="M2 11V4.6C2 4.26863 2.26863 4 2.6 4H8.77805C8.92127 4 9.05977 4.05124 9.16852 4.14445L12.3315 6.85555C12.4402 6.94876 12.5787 7 12.722 7H14" | ||
stroke="currentColor" | ||
strokeLinecap="round" | ||
strokeLinejoin="round" | ||
/> | ||
</svg> | ||
), | ||
icon: FolderPlusIcon, | ||
content: () => <ExplorerPlugin {...props} />, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,7 @@ | ||
declare module '*.svg' { | ||
import { FC, SVGProps } from 'react'; | ||
const ReactComponent: FC<SVGProps<SVGSVGElement>>; | ||
export default ReactComponent; | ||
} | ||
|
||
/// <reference types="vite/client" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.