Skip to content

Commit

Permalink
feat: Add support for setting background and text colors in KModal #1010
Browse files Browse the repository at this point in the history
  • Loading branch information
cnouguier committed Dec 8, 2024
1 parent 1f6dbbc commit a09b074
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions core/client/components/KModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,7 @@
>
<q-card
id="modal-card"
v-bind:class="{
'column full-height': maximized,
'q-pa-sm': $q.screen.gt.xs,
'q-pa-xs': $q.screen.lt.sm
}"
:class="computedClass"
:style="computedStyle">
<!--
Header section
Expand Down Expand Up @@ -99,6 +95,14 @@ const props = defineProps({
scrollable: {
type: Boolean,
default: true
},
backgroundColor: {
type: String,
default: 'white'
},
textColor: {
type: String,
default: 'black'
}
})
Expand All @@ -118,6 +122,13 @@ const lgMinWidths = { wide: 92, medium: 65, narrow: 35 }
const xlMinWidths = { wide: 90, medium: 55, narrow: 25 }
// Computed
const computedClass = computed(() => {
let result = `bg-${props.backgroundColor} text-${props.textColor}`
if (props.maximized) result += ' column full-height'
if ($q.screen.gt.xs) result += ' q-pa-sm'
if ($q.screen.lt.sm) result += ' q-pa-xs'
return result
})
const computedStyle = computed(() => {
// compute the modal max height
const screenHeight = $q.screen.height
Expand Down

0 comments on commit a09b074

Please sign in to comment.