Skip to content

Commit

Permalink
Added darkmode icons
Browse files Browse the repository at this point in the history
  • Loading branch information
remko48 committed Nov 13, 2024
1 parent 52f48dc commit fd9ff89
Show file tree
Hide file tree
Showing 17 changed files with 73 additions and 13 deletions.
1 change: 1 addition & 0 deletions img/account-outline-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion img/account-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions img/briefcase-account-outline-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion img/briefcase-account-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions img/calendar-month-outline-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion img/calendar-month-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions img/chat-outline-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion img/chat-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions img/office-building-outline-dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion img/office-building-outline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions src/services/getTheme.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* Determines the current theme of the document.
*
* This function checks the `data-theme-light` and `data-theme-default` attributes
* on the document body to determine the theme. If `data-theme-light` is present,
* it returns 'light'. If `data-theme-default` is present, it checks the user's
* preferred color scheme using the `window.matchMedia` API and returns 'light' or 'dark'
* accordingly. If neither attribute is present, it defaults to 'dark'.
*
* @return { 'light' | 'dark' } The current theme, either 'light' or 'dark'.
*/
export const getTheme = () => {
if (document.body.hasAttribute('data-theme-light')) {
return 'light'
}

if (document.body.hasAttribute('data-theme-dark')) {
return 'dark'
}

if (document.body.hasAttribute('data-theme-default')) {
return window.matchMedia('(prefers-color-scheme: light)').matches ? 'light' : 'dark'
}
return 'light'
}
7 changes: 6 additions & 1 deletion src/views/widgets/ContactMomentenWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { berichtStore, navigationStore } from '../../store/store.js'
<script>
// Components
import { NcDashboardWidget, NcEmptyContent, NcButton } from '@nextcloud/vue'
import { getTheme } from '../../services/getTheme.js'
import Plus from 'vue-material-design-icons/Plus.vue'
import ChatOutline from 'vue-material-design-icons/ChatOutline.vue'
import BerichtForm from '../../modals/berichten/EditBericht.vue'
Expand Down Expand Up @@ -75,12 +76,16 @@ export default {
id: bericht.id,
mainText: bericht.title,
subText: bericht.aanmaakDatum,
avatarUrl: '/apps-extra/zaakafhandelapp/img/chat-outline.svg',
avatarUrl: this.getItemIcon(),
}))
this.loading = false
})
},
getItemIcon() {
const theme = getTheme()
return theme === 'light' ? '/apps-extra/zaakafhandelapp/img/chat-outline-dark.svg' : '/apps-extra/zaakafhandelapp/img/chat-outline.svg'
},
openModal() {
this.isModalOpen = true
berichtStore.setBerichtItem(null)
Expand Down
7 changes: 6 additions & 1 deletion src/views/widgets/OpenZakenWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import { zaakStore } from '../../store/store.js'
<script>
// Components
import { NcDashboardWidget, NcEmptyContent, NcButton } from '@nextcloud/vue'
import { getTheme } from '../../services/getTheme.js'
import OpenInApp from 'vue-material-design-icons/OpenInApp.vue'
import Folder from 'vue-material-design-icons/Folder.vue'
Expand Down Expand Up @@ -68,12 +69,16 @@ export default {
id: zaak.id,
mainText: zaak.identificatie,
subText: zaak.zaaktype,
avatarUrl: '/apps-extra/zaakafhandelapp/img/briefcase-account-outline.svg',
avatarUrl: this.getItemIcon(),
}))
this.loading = false
})
},
getItemIcon() {
const theme = getTheme()
return theme === 'light' ? '/apps-extra/zaakafhandelapp/img/briefcase-account-outline-dark.svg' : '/apps-extra/zaakafhandelapp/img/briefcase-account-outline.svg'
},
search() {
console.info('click')
},
Expand Down
9 changes: 7 additions & 2 deletions src/views/widgets/OrganisatiesWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { klantStore } from '../../store/store.js'
<script>
// Components
import { NcDashboardWidget, NcEmptyContent, NcButton, NcTextField } from '@nextcloud/vue'
import { getTheme } from '../../services/getTheme.js'
import Search from 'vue-material-design-icons/Magnify.vue'
import OfficeBuildingOutline from 'vue-material-design-icons/OfficeBuildingOutline.vue'
Expand Down Expand Up @@ -82,7 +83,7 @@ export default {
id: organisatie.id,
mainText: organisatie.bedrijfsnaam,
subText: organisatie.websiteUrl,
avatarUrl: '/apps-extra/zaakafhandelapp/img/office-building-outline.svg',
avatarUrl: this.getItemIcon(),
}))
this.loading = false
Expand All @@ -96,14 +97,18 @@ export default {
id: organisatie.id,
mainText: organisatie.bedrijfsnaam,
subText: organisatie.websiteUrl,
avatarUrl: '/apps-extra/zaakafhandelapp/img/office-building-outline.svg',
avatarUrl: this.getItemIcon(),
}))
this.loading = false
})
.finally(() => {
this.loading = false
})
},
getItemIcon() {
const theme = getTheme()
return theme === 'light' ? '/apps-extra/zaakafhandelapp/img/office-building-outline-dark.svg' : '/apps-extra/zaakafhandelapp/img/office-building-outline.svg'
},
onShow() {
window.open('/apps/opencatalogi/catalogi', '_self')
},
Expand Down
9 changes: 7 additions & 2 deletions src/views/widgets/PersonenWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ import { klantStore } from '../../store/store.js'
<script>
// Components
import { NcDashboardWidget, NcEmptyContent, NcButton, NcTextField } from '@nextcloud/vue'
import { getTheme } from '../../services/getTheme.js'
import Search from 'vue-material-design-icons/Magnify.vue'
import AccountOutline from 'vue-material-design-icons/AccountOutline.vue'
Expand Down Expand Up @@ -84,7 +85,7 @@ export default {
id: person.id,
mainText: `${person.voornaam} ${person.tussenvoegsel} ${person.achternaam}`,
subText: person.emailadres,
avatarUrl: '/apps-extra/zaakafhandelapp/img/account-outline.svg',
avatarUrl: this.getItemIcon(),
}))
this.loading = false
})
Expand All @@ -97,14 +98,18 @@ export default {
id: person.id,
mainText: `${person.voornaam} ${person.tussenvoegsel} ${person.achternaam}`,
subText: person.emailadres,
avatarUrl: '/apps-extra/zaakafhandelapp/img/account-outline.svg',
avatarUrl: this.getItemIcon(),
}))
this.loading = false
})
.finally(() => {
this.loading = false
})
},
getItemIcon() {
const theme = getTheme()
return theme === 'light' ? '/apps-extra/zaakafhandelapp/img/account-outline-dark.svg' : '/apps-extra/zaakafhandelapp/img/account-outline.svg'
},
onShow() {
window.open('/apps/opencatalogi/catalogi', '_self')
},
Expand Down
7 changes: 6 additions & 1 deletion src/views/widgets/TakenWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import { taakStore, navigationStore } from '../../store/store.js'
<script>
// Components
import { NcDashboardWidget, NcEmptyContent, NcButton } from '@nextcloud/vue'
import { getTheme } from '../../services/getTheme.js'
import Plus from 'vue-material-design-icons/Plus.vue'
import Folder from 'vue-material-design-icons/Folder.vue'
import TakenForm from '../../modals/taken/EditTaak.vue'
Expand Down Expand Up @@ -75,12 +76,16 @@ export default {
id: taak.id,
mainText: taak.title,
subText: taak.type,
avatarUrl: '/apps-extra/zaakafhandelapp/img/briefcase-account-outline.svg',
avatarUrl: this.getItemIcon(),
}))
this.loading = false
})
},
getItemIcon() {
const theme = getTheme()
return theme === 'light' ? '/apps-extra/zaakafhandelapp/img/calendar-month-outline-dark.svg' : '/apps-extra/zaakafhandelapp/img/calendar-month-outline.svg'
},
openModal() {
this.isModalOpen = true
taakStore.setTaakItem(null)
Expand Down
7 changes: 6 additions & 1 deletion src/views/widgets/ZakenWidget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import { zaakStore } from '../../store/store.js'
<script>
// Components
import { NcDashboardWidget, NcEmptyContent, NcButton } from '@nextcloud/vue'
import { getTheme } from '../../services/getTheme.js'
import Plus from 'vue-material-design-icons/Plus.vue'
import Folder from 'vue-material-design-icons/Folder.vue'
Expand Down Expand Up @@ -70,12 +71,16 @@ export default {
id: zaak.id,
mainText: zaak.identificatie,
subText: zaak.zaaktype,
avatarUrl: '/apps-extra/zaakafhandelapp/img/briefcase-account-outline.svg',
avatarUrl: this.getItemIcon(),
}))
this.loading = false
})
},
getItemIcon() {
const theme = getTheme()
return theme === 'light' ? '/apps-extra/zaakafhandelapp/img/briefcase-account-outline-dark.svg' : '/apps-extra/zaakafhandelapp/img/briefcase-account-outline.svg'
},
search() {
console.info('click')
},
Expand Down

0 comments on commit fd9ff89

Please sign in to comment.