Commit e64b93cc authored by Phil Hughes's avatar Phil Hughes

change button style when there are changes

parent 60c9c24e
...@@ -6,6 +6,10 @@ ...@@ -6,6 +6,10 @@
Icon, Icon,
}, },
props: { props: {
hasChanges: {
type: Boolean,
required: true,
},
viewer: { viewer: {
type: String, type: String,
required: true, required: true,
...@@ -33,6 +37,9 @@ ...@@ -33,6 +37,9 @@
<button <button
type="button" type="button"
class="btn btn-primary btn-sm" class="btn btn-primary btn-sm"
:class="{
'btn-inverted': hasChanges,
}"
data-toggle="dropdown" data-toggle="dropdown"
> >
<template v-if="viewer === 'editor'"> <template v-if="viewer === 'editor'">
......
<script> <script>
import { mapActions, mapState } from 'vuex'; import { mapActions, mapGetters, mapState } from 'vuex';
import RepoTab from './repo_tab.vue'; import RepoTab from './repo_tab.vue';
import EditorMode from './editor_mode_dropdown.vue'; import EditorMode from './editor_mode_dropdown.vue';
...@@ -14,6 +14,9 @@ ...@@ -14,6 +14,9 @@
}; };
}, },
computed: { computed: {
...mapGetters([
'hasChanges',
]),
...mapState([ ...mapState([
'openFiles', 'openFiles',
'viewer', 'viewer',
...@@ -47,6 +50,7 @@ ...@@ -47,6 +50,7 @@
<editor-mode <editor-mode
:viewer="viewer" :viewer="viewer"
:show-shadow="showShadow" :show-shadow="showShadow"
:has-changes="hasChanges"
@click="updateViewer" @click="updateViewer"
/> />
</div> </div>
......
...@@ -15,3 +15,5 @@ export const canEditFile = (state) => { ...@@ -15,3 +15,5 @@ export const canEditFile = (state) => {
export const addedFiles = state => state.changedFiles.filter(f => f.tempFile); export const addedFiles = state => state.changedFiles.filter(f => f.tempFile);
export const modifiedFiles = state => state.changedFiles.filter(f => !f.tempFile); export const modifiedFiles = state => state.changedFiles.filter(f => !f.tempFile);
export const hasChanges = state => !!state.changedFiles.length;
...@@ -82,7 +82,7 @@ describe('Multi-file editor library', () => { ...@@ -82,7 +82,7 @@ describe('Multi-file editor library', () => {
}); });
}); });
fdescribe('attachModel', () => { describe('attachModel', () => {
let model; let model;
beforeEach(() => { beforeEach(() => {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment