Skip to content

Commit 311089e

Browse files
authored
Merge pull request #3 from burhanahmeed/add-custom-style
Add custom style
2 parents 077271b + d45ba05 commit 311089e

File tree

5 files changed

+67
-10
lines changed

5 files changed

+67
-10
lines changed

README.md

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@ yarn add vue-daily-scheduler
2121
```
2222
Browser
2323
```html
24-
<script src="https://unpkg.com/vue-daily-scheduler@latest/dist/vue-schedule.min.js" />
24+
<link href="https://unpkg.com/vue-daily-scheduler@latest/dist/vue-schedule.min.css" ref="stylesheet" />
25+
<script src="https://unpkg.com/vue-daily-scheduler@latest/dist/vue-schedule.min.js"></script>
2526
```
2627

2728
then, use inside a component
@@ -55,6 +56,28 @@ use it inside vue template
5556
</template>
5657
```
5758

59+
### Props
60+
|Props|Desc|Type|Default|
61+
|---|---|---|---|
62+
|`bg`|Block scheduler bacground color|`String`|`#223642`|
63+
|`bgHover`|Block scheduler bacground color when on hover|`String`|`#84dafc7a`|
64+
|`bgActive`|Block scheduler bacground color when active|`String`|`#84c9fc`|
65+
|`textColor`|Text color inside block scheduler|`String`|`#000`|
66+
#### Example
67+
```html
68+
<template>
69+
<div>
70+
<VueSchedule
71+
v-model="schedule"
72+
bg="red"
73+
bgHover="gray"
74+
bgActive="black"
75+
textColor="#fff"
76+
/>
77+
</div>
78+
</template>
79+
```
80+
5881
### Contributor
5982
Feel free if you want to submit pull request or an issue.
6083

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vue-daily-scheduler",
3-
"version": "1.0.1",
3+
"version": "1.0.3",
44
"private": false,
55
"author": "Burhanuddin Ahmed",
66
"license": "MIT",

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<span style="padding: 10px">Vue week schedule</span>
66
</div>
77
<div style="width: 500px; margin: 0 auto; padding: 20px">
8-
<schedule v-model="schedule" />
8+
<schedule v-model="schedule" bgHover="black" />
99
</div>
1010
<div style="margin: 20px; padding: 20px; background-color: gray; color: white">
1111
<code>{{ JSON.stringify(schedule) }}</code>

src/assets/style.css

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,20 @@
2424
cursor: pointer;
2525
}
2626
.vws-rule-time-week, .vws-rule-time-item{
27-
background: #223642;
27+
/* background: #223642; */
28+
background: var(--vws-bg);
2829
}
2930

3031
.vws-rule-time-week.active, .vws-rule-time-item.active{
31-
background: #84c9fc;
32+
/* background: #84c9fc; */
33+
background: var(--vws-bgActive);
3234
}
3335
.vws-rule-time-week:hover,
3436
.vws-rule-time-item:hover,
3537
.vws-rule-time-week.active:hover,
3638
.vws-rule-time-item.active:hover{
37-
background: #84dafc7a;
39+
/* background: #84dafc7a; */
40+
background: var(--vws-bgHover);
3841
}
3942

4043
.vws-rule-time-item span{
@@ -55,5 +58,6 @@
5558
.vws-rule-time-item.active span {
5659
display: block;
5760
text-align: center;
58-
color: #000;
61+
/* color: #000; */
62+
color: var(--vws-text);
5963
}

src/components/Schedule.vue

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ Copyright Sultan Ads 2020.
77
-->
88

99
<template>
10-
<div style="position: relative">
10+
<div style="position: relative" :style="rootCssVar">
1111
<div class="vws-rule-custom" style='user-select: none;'>
1212
<div class="vws-rule-row">
1313
<div class="vws-table-rule">
@@ -114,7 +114,27 @@ Copyright Sultan Ads 2020.
114114
<script>
115115
import '../assets/style.css'
116116
export default {
117-
props: ['value'],
117+
props: {
118+
value: {
119+
type: Object
120+
},
121+
bg: {
122+
type: String,
123+
default: '#223642'
124+
},
125+
bgHover: {
126+
type: String,
127+
default: '#84dafc7a'
128+
},
129+
bgActive: {
130+
type: String,
131+
default: '#84c9fc'
132+
},
133+
textColor: {
134+
type: String,
135+
default: '#000'
136+
}
137+
},
118138
data () {
119139
return {
120140
timeArray: [],
@@ -391,6 +411,16 @@ export default {
391411
this.timetable = val;
392412
}
393413
}
414+
},
415+
computed: {
416+
rootCssVar () {
417+
return {
418+
'--vws-bg': this.bg,
419+
'--vws-bgActive': this.bgActive,
420+
'--vws-bgHover': this.bgHover,
421+
'--vws-text': this.textColor
422+
}
423+
}
394424
}
395425
}
396-
</script>
426+
</script>

0 commit comments

Comments
 (0)