Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom dayCustomClasses to daySelector + example in Demo.vue #548

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jlsjonas
Copy link
Contributor

Usage:

<datepicker :dayCustomClasses="dayCustomClasses"></datepicker>
    dayCustomClasses (day) {
      return {
        'custom': Math.random() >= 0.5
      }

The above example code adds a "custom" CSS class randomly

@coveralls
Copy link

coveralls commented Jun 28, 2018

Coverage Status

Coverage remained the same at 100.0% when pulling 4592cc7 on jlsjonas:add-dayclasses into 9ae1153 on charliekassel:master.

@@ -193,7 +193,13 @@

<div class="example">
<h3>Inline datepicker</h3>
<datepicker :inline="true"></datepicker>
<datepicker :inline="true"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add this to a new example demo block please?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

@@ -36,6 +36,10 @@ export default {
pageTimestamp: Number,
fullMonthName: Boolean,
allowedToShowView: Function,
dayCustomClasses: {
type: Function,
default: day => { return {} }
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need the return {}? i.e maybe just default: day => {}?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, will update (was still getting to know Vue when I wrote this)

@@ -331,7 +335,8 @@ export default {
'sat': day.isSaturday,
'sun': day.isSunday,
'highlight-start': day.isHighlightStart,
'highlight-end': day.isHighlightEnd
'highlight-end': day.isHighlightEnd,
...this.dayCustomClasses(day)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why the spread operator here? Isn't is just one function with variable output?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

@jlsjonas jlsjonas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late reply, completely lost track of this PR 😬

Will be making the code updates early next week

@@ -331,7 +335,8 @@ export default {
'sat': day.isSaturday,
'sun': day.isSunday,
'highlight-start': day.isHighlightStart,
'highlight-end': day.isHighlightEnd
'highlight-end': day.isHighlightEnd,
...this.dayCustomClasses(day)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@@ -36,6 +36,10 @@ export default {
pageTimestamp: Number,
fullMonthName: Boolean,
allowedToShowView: Function,
dayCustomClasses: {
type: Function,
default: day => { return {} }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, will update (was still getting to know Vue when I wrote this)

@@ -193,7 +193,13 @@

<div class="example">
<h3>Inline datepicker</h3>
<datepicker :inline="true"></datepicker>
<datepicker :inline="true"
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants