Skip to content

Commit 426dc0d

Browse files
committed
Dynamicaly set css colors using props
1 parent e922a5a commit 426dc0d

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

src/components/exitIntent.vue

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,14 @@ const props = defineProps({
77
navigateBeforeShowSeconds: { type: Number, required: false, default: 0 },
88
mouseOutEnabled: { type: Boolean, required: false, default: true },
99
showByDefault: { type: Boolean, required: false, default: false },
10-
showCloseBtn: { type: Boolean, required: false, default: true }
10+
showCloseBtn: { type: Boolean, required: false, default: true },
11+
color: { type: String, required: false, default: '#555' },
12+
bgroundColor: { type: String, required: false, default: '#fefefe' },
13+
bdropColor: {
14+
type: String,
15+
required: false,
16+
default: 'rgba(0, 0, 0, 0.7)'
17+
}
1118
});
1219
1320
const show = ref(false);
@@ -153,13 +160,13 @@ const showModal = () => {
153160
bottom: 0;
154161
left: 0;
155162
right: 0;
156-
background-color: rgba(0, 0, 0, 0.7);
163+
background-color: v-bind(bdropColor);
157164
}
158165
.exit-intent-content {
159166
position: relative;
160167
margin: auto;
161-
color: #555;
162-
background-color: #fefefe;
168+
color: v-bind(color);
169+
background-color: v-bind(bgroundColor);
163170
}
164171
165172
.btn-close {
@@ -171,12 +178,12 @@ const showModal = () => {
171178
padding: 4px;
172179
cursor: pointer;
173180
font-weight: bold;
174-
color: #555;
181+
color: v-bind(color);
175182
background-color: transparent;
176183
}
177184
178185
.fallback-content {
179-
background-color: #fefefe;
186+
background-color: v-bind(bgroundColor);
180187
overflow-x: auto;
181188
display: flex;
182189
flex-direction: column;
@@ -188,11 +195,11 @@ const showModal = () => {
188195
padding: 25px 10px;
189196
text-align: center;
190197
border-bottom: 1px solid #eee;
191-
color: #555;
198+
color: v-bind(color);
192199
}
193200
194201
.fallback-content-body {
195-
color: #555;
202+
color: v-bind(color);
196203
padding: 20px 10px;
197204
font-size: 16px;
198205
line-height: 1.5;
@@ -211,8 +218,8 @@ const showModal = () => {
211218
font-size: 14px;
212219
cursor: pointer;
213220
color: white;
214-
background: #555;
215-
border: 1px solid #555;
221+
background: v-bind(color);
222+
border: 1px solid v-bind(color);
216223
border-radius: 2px;
217224
}
218225

0 commit comments

Comments
 (0)