Skip to content

Label mini GraphiQL panels. #1796

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

Merged
merged 3 commits into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 25 additions & 13 deletions src/codemirror.less
Original file line number Diff line number Diff line change
Expand Up @@ -816,6 +816,24 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {
inset 4px 0 0 #eee;
border-radius: 3px;
margin-left: -4px;

.editor-name {
position: sticky;
display: block;
padding: 0.5rem 0.75rem;
border-bottom: 1px solid rgb(209, 213, 219);
background-color: rgb(243, 244, 246);
color: rgb(55, 65, 81);
font-size: 0.8rem;
font-weight: 600;

.dark & {
border-bottom-color: rgb(23, 23, 23);
background-color: rgb(8, 8, 8);
color: rgb(209, 213, 219);
font-weight: 400;
}
}
}

.query-editor .CodeMirror {
Expand Down Expand Up @@ -846,19 +864,6 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {
margin: 0 7px;
background: none;
}

.variable-editor::before {
background: #eee;
color: white;
content: "VARIABLES";
display: block;
font-size: 10px;
font-weight: bold;
letter-spacing: 1px;
line-height: 1;
padding: 3px 12px 2px;
text-shadow: 0 -1px #ddd;
}
}

.result-window {
Expand All @@ -879,6 +884,13 @@ div.CodeMirror span.CodeMirror-nonmatchingbracket {
.result-window .CodeMirror {
background: none;
height: 100%;
padding-bottom: 45px;
margin: 0 7px;
box-sizing: border-box;
}

.query-editor,
.variable-editor,
.result-window {
overflow: hidden;
}
18 changes: 15 additions & 3 deletions src/components/marked/mini-graphiQL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,11 @@ class QueryEditor extends Component {
}

render() {
return <div className="query-editor" ref={e => (this.domNode = e)} />
return (
<div className="query-editor" ref={e => (this.domNode = e)}>
<span className="editor-name">Operation</span>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Technically this is a "document" since it may contain fragments and multiple operations; but I think that's probably a little too technical for people learning the technology so I think you've made the right choice of term here 👍

</div>
)
}
}

Expand Down Expand Up @@ -305,7 +309,11 @@ class ResultViewer extends Component {
}

render() {
return <div className="result-window" ref={e => (this.domNode = e)} />
return (
<div className="result-window" ref={e => (this.domNode = e)}>
<span className="editor-name">Response</span>
</div>
)
}
}

Expand Down Expand Up @@ -424,7 +432,11 @@ class VariableEditor extends Component {
}

render() {
return <div className="variable-editor" ref={e => (this.domNode = e)} />
return (
<div className="variable-editor" ref={e => (this.domNode = e)}>
<span className="editor-name">Variables</span>
</div>
)
}

_didLint(annotations) {
Expand Down