Skip to content
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

Feature/code mirror theme exposed #323

Merged

Conversation

joelgriffith
Copy link

@joelgriffith joelgriffith commented Feb 9, 2017

First pass on exposing a codeMirrorTheme prop, plumbing it through, and docs on how to load/use css for the theme.

@joelgriffith
Copy link
Author

See discussion in #129

Copy link
Contributor

@wincent wincent left a comment

Choose a reason for hiding this comment

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

This looks good to me overall, but before we merge, I want to ask whether just "theme" would be a better name for this prop. The fact that the editor views are powered by CodeMirror is really just an implementation detail, and using codeMirror in the prop name leaks that out. In the future, if a better implementation comes along, maybe we want to preserve the ability to pass in themes like "solarized" to it (obviously, this would depend on the appropriate CSS being available, so you could argue that changing the implementation would be a breaking change and we therefore should pick a different property name; but I do like the idea of keeping some clutter out of the API).

Thoughts?

@@ -9,7 +9,6 @@
/* eslint-disable no-console */
import express from 'express';
import path from 'path';
import fs from 'fs';
Copy link
Contributor

Choose a reason for hiding this comment

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

Naughty! Sneaking in an unrelated change.

@wincent
Copy link
Contributor

wincent commented Feb 10, 2017

Oh, forgot to mention: I applied some small fixes directly on the PR branch rather than incurring another round trip. If you do more work on this, be sure to pull those down.

@joelgriffith
Copy link
Author

The fact that the editor views are powered by CodeMirror is really just an implementation detail, and using codeMirror in the prop name leaks that out.

This is a great point, and something that I thought about in some capacity. Here's my thoughts:

  • theme is a bit broad in my opinion, as new adopters will likely assume that this theme would apply to the entirety of GraphiQL (which isn't the case).
  • Minor, but I think that at this point GraphiQL is pretty tied to the CodeMirror implementation (there's even sub-packages that were written to marry GraphiQL to CodeMirror). Not saying that won't change, but would be non-trivial work.

I think maybe syntaxTheme would suffice since it succinctly addresses the fact that this only applies to code portions of the UI, and is not a global UI-theme.

Would that be ok @wincent?

@wincent
Copy link
Contributor

wincent commented Feb 12, 2017

Or maybe editorTheme?

Agreed that for all practical purposes CodeMirror is likely to remain the implementation, but that doesn't mean we shouldn't try to practice good hygiene and abstract over it.

@joelgriffith
Copy link
Author

💥 editorTheme is great. I'll update my PR tomorrow.

@wincent
Copy link
Contributor

wincent commented Feb 13, 2017

Looks good. Thanks for your work on this!

@wincent wincent merged commit c573490 into graphql:master Feb 13, 2017
@joelgriffith
Copy link
Author

Thanks for catching that JSX error....again!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants