diff --git a/.all-contributorsrc b/.all-contributorsrc index 19316328..67555488 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -293,6 +293,16 @@ "contributions": [ "doc" ] + }, + { + "login": "chrisdrackett", + "name": "Chris Drackett", + "avatar_url": "https://avatars3.githubusercontent.com/u/4378?v=4", + "profile": "https://github.com/chrisdrackett", + "contributions": [ + "code", + "design" + ] } ], "repoType": "github" diff --git a/README.md b/README.md index e6ec8226..9e26f645 100644 --- a/README.md +++ b/README.md @@ -100,7 +100,7 @@ Thanks goes to these people ([emoji key][emojis]): | [
Leon Chen](https://transcranial.github.io)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=transcranial "Code") | [
Christopher Chedeau](http://blog.vjeux.com/)
[πŸ’¬](#question-vjeux "Answering Questions") [πŸ’»](https://github.com/prettier/prettier-atom/commits?author=vjeux "Code") [πŸ”Œ](#plugin-vjeux "Plugin/utility libraries") | [
Christoph Geschwind](http://christoph-geschwind.de)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=1st8 "Code") | [
Andrew Hutchings](https://andrewhutchings.com)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=ahutchings "Code") | [
David Schnurr](http://davidschnurr.com)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=schnerd "Code") | [
Ryan Cole](http://rycole.com/)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=ryancole "Code") | [
Dara Hak](https://github.com/darahak)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=darahak "Code") [πŸ“–](https://github.com/prettier/prettier-atom/commits?author=darahak "Documentation") | | [
Stephen John Sorensen](http://www.stephenjohnsorensen.com/)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=spudly "Code") | [
Lukas Geiger](https://github.com/lgeiger)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=lgeiger "Code") [⚠️](https://github.com/prettier/prettier-atom/commits?author=lgeiger "Tests") | [
Viktor Charypar](https://github.com/charypar)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=charypar "Code") [⚠️](https://github.com/prettier/prettier-atom/commits?author=charypar "Tests") | [
Mats HΓΆgberg](http://mats.hgbrg.se)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=mhgbrg "Code") | [
Roman](https://github.com/RoM4iK)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=RoM4iK "Code") | [
vaibhav](https://vaibhavchatarkar.com)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=da-vaibhav "Code") | [
Karl Horky](https://work.karlhorky.com)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=karlhorky "Code") | | [
Dan Abramov](http://twitter.com/dan_abramov)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=gaearon "Code") | [
Murphy Randle](https://sploding.rocks)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=splodingsocks "Code") [πŸ›](https://github.com/prettier/prettier-atom/issues?q=author%3Asplodingsocks "Bug reports") | [
Matthieu Lemoine](https://matthieulemoine.com)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=MatthieuLemoine "Code") | [
Ron Green](https://github.com/rgreenjr)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=rgreenjr "Code") | [
Harold Treen](https://haroldtreen.com)
[πŸ›](https://github.com/prettier/prettier-atom/issues?q=author%3Aharoldtreen "Bug reports") [πŸ’»](https://github.com/prettier/prettier-atom/commits?author=haroldtreen "Code") | [
Nikita Mashukov](https://github.com/ferdibiflator)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=ferdibiflator "Code") | [
Sam Horton](https://github.com/SavePointSam)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=SavePointSam "Code") [⚠️](https://github.com/prettier/prettier-atom/commits?author=SavePointSam "Tests") | -| [
olsonpm](https://github.com/olsonpm)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=olsonpm "Code") | [
David Singleton](http://dsingleton.co.uk)
[πŸ“–](https://github.com/prettier/prettier-atom/commits?author=dsingleton "Documentation") | +| [
olsonpm](https://github.com/olsonpm)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=olsonpm "Code") | [
David Singleton](http://dsingleton.co.uk)
[πŸ“–](https://github.com/prettier/prettier-atom/commits?author=dsingleton "Documentation") | [
Chris Drackett](https://github.com/chrisdrackett)
[πŸ’»](https://github.com/prettier/prettier-atom/commits?author=chrisdrackett "Code") [🎨](#design-chrisdrackett "Design") | This project follows the [all-contributors][all-contributors] specification. Contributions of any kind are welcome! diff --git a/dist/statusTile/updateStatusTile.js b/dist/statusTile/updateStatusTile.js index 7c0153b2..f5d4948f 100644 --- a/dist/statusTile/updateStatusTile.js +++ b/dist/statusTile/updateStatusTile.js @@ -7,7 +7,15 @@ const { addTooltip } = require('../atomInterface'); const updateStatusTile = (disposable, element) => { disposeTooltip(); - element.dataset.prettierFormatOnSave = getFormatOnSaveStatus(); // eslint-disable-line no-param-reassign + const formatStatus = getFormatOnSaveStatus(); + + if (formatStatus === 'enabled') { + element.classList.add('text-success'); + } else { + element.classList.remove('text-success'); + } + + element.dataset.prettierFormatOnSave = formatStatus; // eslint-disable-line no-param-reassign const newTooltip = addTooltip(element, { title: `Format on Save: ${getFormatOnSaveStatus()}
Click to toggle` diff --git a/src/statusTile/updateStatusTile.js b/src/statusTile/updateStatusTile.js index b4fa9f52..defadb33 100644 --- a/src/statusTile/updateStatusTile.js +++ b/src/statusTile/updateStatusTile.js @@ -6,7 +6,15 @@ const { addTooltip } = require('../atomInterface'); const updateStatusTile = (disposable: Atom$Disposable, element: HTMLElement) => { disposeTooltip(); - element.dataset.prettierFormatOnSave = getFormatOnSaveStatus(); // eslint-disable-line no-param-reassign + const formatStatus = getFormatOnSaveStatus(); + + if (formatStatus === 'enabled') { + element.classList.add('text-success'); + } else { + element.classList.remove('text-success'); + } + + element.dataset.prettierFormatOnSave = formatStatus; // eslint-disable-line no-param-reassign const newTooltip = addTooltip(element, { title: `Format on Save: ${getFormatOnSaveStatus()}
Click to toggle`, diff --git a/src/statusTile/updateStatusTile.test.js b/src/statusTile/updateStatusTile.test.js index 8e09b267..f193e83b 100644 --- a/src/statusTile/updateStatusTile.test.js +++ b/src/statusTile/updateStatusTile.test.js @@ -6,7 +6,13 @@ const updateStatusTile = require('./updateStatusTile'); const getFormatOnSaveStatus = require('./getFormatOnSaveStatus'); const callUpdateStatusTile = () => { - const div = { dataset: {} }; + const div = { + dataset: {}, + classList: { + add: jest.fn(), + remove: jest.fn(), + }, + }; const disposable = { add: jest.fn() }; updateStatusTile(disposable, div); diff --git a/styles/statusTile.less b/styles/statusTile.less index c3cc890a..96bfc885 100644 --- a/styles/statusTile.less +++ b/styles/statusTile.less @@ -12,7 +12,7 @@ div { // If Format on Save is enabled, make the label more visible. &[data-prettier-format-on-save='enabled'] { - color: @text-color-success; + // color is handled by adding or removing the text-success class when updating the status tile &::after { content: ' βœ“'; }