Skip to content

Commit 755c9b5

Browse files
committed
refactor(docs): Improve styling
1 parent 15ef610 commit 755c9b5

File tree

11 files changed

+106
-69
lines changed

11 files changed

+106
-69
lines changed

docs/.vuepress/components/DateDisabled.vue

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
<div>
33
<div class="example">
44
<h3>With minimum and maximum date range</h3>
5-
<DatePicker :disabled-dates="disabledDates" />
5+
<DatePicker :disabled-dates="disabledDates" placeholder="Datepicker based on settings below..." />
66
<code>
7-
&lt;datepicker :disabled-dates="disabledDates"&gt;&lt;/datepicker&gt;
8-
</code>
7+
&lt;datepicker :disabled-dates="disabledDates"&gt;&lt;/datepicker&gt;
8+
</code>
99
<div class="settings">
1010
<h5>Settings</h5>
1111
<div class="form-group">
@@ -18,45 +18,40 @@
1818
</div>
1919
<div class="form-group">
2020
<label>Disabled Days of Month:</label>
21-
<input
22-
type="text"
23-
value=""
24-
placeholder="5,6,12,13"
25-
@change="setDisabledDays"
26-
/>
21+
<input type="text" value="" placeholder="5,6,12,13" @change="setDisabledDays" />
2722
</div>
2823
<pre>disabled: {{ disabledDates }}</pre>
2924
</div>
3025
</div>
3126

3227
<div class="example">
3328
<h3>Disabled dates</h3>
34-
<DatePicker :disabled-dates="disabledFn" />
29+
<DatePicker :disabled-dates="disabledFn" placeholder="Datepicker based on settings below..." />
3530
<code>
36-
&lt;datepicker :disabled-dates="disabledFn"&gt;&lt;/datepicker&gt;
37-
</code>
31+
&lt;datepicker :disabled-dates="disabledFn"&gt;&lt;/datepicker&gt;
32+
</code>
3833
<div class="settings">
3934
<h5>Settings</h5>
4035
<pre>
41-
disabledDates: {
42-
customPredictor: function (date) {
43-
const year = date.getFullYear()
44-
const month = date.getMonth()
45-
const day = date.getDate()
46-
// disable every years that are a multiple of 2
47-
if (year % 2 === 0) {
48-
return true
49-
}
50-
// disable every months that are a multiple of 3
51-
if (month % 3 === 0) {
52-
return true
53-
}
54-
// disable first half of the month when it is a multiple of 2
55-
if (month % 2 !== 0 && day &lt; 15) {
56-
return true
57-
}
36+
disabledDates: {
37+
customPredictor: function (date) {
38+
const year = date.getFullYear()
39+
const month = date.getMonth()
40+
const day = date.getDate()
41+
// disable all even years
42+
if (year % 2 === 0) {
43+
return true
44+
}
45+
// disable months that are a multiple of 3
46+
if (month % 3 === 0) {
47+
return true
48+
}
49+
// disable the first half of all even months
50+
if (month % 2 !== 0 && day &lt; 15) {
51+
return true
5852
}
5953
}
54+
}
6055
</pre>
6156
</div>
6257
</div>
@@ -108,7 +103,7 @@ export default {
108103
this.disabledDates = {
109104
to: null,
110105
daysOfMonth: this.disabledDates.daysOfMonth,
111-
from: this.disabledDates.from,
106+
from: `${this.disabledDates.from}`,
112107
}
113108
}
114109
this.disabledDates.to = val

docs/.vuepress/components/DateFormatting.vue

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,31 @@
1818
:format="customFormatter"
1919
:parser="customParser"
2020
:typeable="true"
21+
placeholder="Datepicker based on settings below..."
2122
/>
2223
<code>
2324
&lt;DatePicker :format="customFormatter" :parser="customParser"/&gt;
2425
</code>
26+
27+
<pre>
28+
import { format, parse } from 'date-fns'
29+
30+
export default {
31+
data() {
32+
return {
33+
format: 'dd.MM.yyyy',
34+
}
35+
},
36+
methods: {
37+
customFormatter(date) {
38+
return format(date, this.format)
39+
},
40+
customParser(date) {
41+
return parse(date, this.format, new Date())
42+
},
43+
},
44+
}
45+
</pre>
2546
</div>
2647
</template>
2748

docs/.vuepress/components/DateHighlighted.vue

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<div>
33
<div class="example">
44
<h3>Highlighting Dates</h3>
5-
<DatePicker :highlighted="highlighted" />
5+
<DatePicker :highlighted="highlighted" placeholder="Datepicker based on settings below..." />
66

77
<code>
88
&lt;datepicker :highlighted="highlighted"&gt;&lt;/datepicker&gt;
@@ -27,21 +27,21 @@
2727

2828
<div class="example">
2929
<h3>Highlighting Dates Matching Given Function</h3>
30-
<DatePicker :highlighted="highlightedFn" />
30+
<DatePicker :highlighted="highlightedFn" placeholder="Datepicker based on settings below..." />
3131
<code>
3232
&lt;datepicker :highlighted="highlightedFn"&gt;&lt;/datepicker&gt;
3333
</code>
3434
<div class="settings">
3535
<h5>Settings</h5>
3636
<pre>
37-
highlightedFn: {
38-
customPredictor: function (date) {
39-
// highlights every day of a month which is a multiple of 4
40-
if (date.getDate() % 4 === 0) {
41-
return true
42-
}
37+
highlightedFn: {
38+
customPredictor: function (date) {
39+
// highlights every day of a month which is a multiple of 4
40+
if (date.getDate() % 4 === 0) {
41+
return true
4342
}
4443
}
44+
}
4545
</pre>
4646
</div>
4747
</div>

docs/.vuepress/components/DatePicker/OpenDate.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
</div>
1717
<pre>openDate: {{ openDate }}</pre>
1818
</div>
19-
<DatePicker :open-date="openDate" placeholder="Select Date" />
2019
</div>
2120
</template>
2221

docs/.vuepress/components/DatePicker/UseUtc.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div>
2+
<div class="example">
33
<h3>UTC</h3>
44
<DatePicker
55
v-model="utcDate"

docs/.vuepress/components/DatePicker/YearPickerRange.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<template>
2-
<div>
2+
<div class="example">
33
<div class="settings">
44
<h5>Settings</h5>
55
<div class="form-group">
@@ -12,7 +12,6 @@
1212
<pre>yearPickerRange: {{ yearPickerRange }}</pre>
1313
</div>
1414
<DatePicker :year-picker-range="yearPickerRange" />
15-
<hr />
1615
</div>
1716
</template>
1817

docs/.vuepress/components/style.css

Lines changed: 45 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,51 @@
1515

1616
.example {
1717
padding: 0 0 1em;
18-
margin-bottom: 2em;
18+
}
19+
20+
.example code {
21+
border: 1px solid #ccc;
22+
border-radius: 0.5em;
23+
display: block;
24+
margin-top: 1em;
25+
padding: 1em;
1926
}
2027

2128
.settings {
22-
margin: 2em 0;
23-
background: #eeeeee;
29+
background: #eee;
30+
border: 1px solid #ccc;
31+
padding: 1em;
32+
margin: 1em 0;
33+
border-radius: 0.5em;
34+
}
35+
36+
.settings h5 {
37+
margin: 0;
38+
padding: 0;
39+
}
40+
41+
.settings pre {
42+
margin: 0;
43+
padding: 0;
44+
}
45+
46+
.settings label {
47+
padding-bottom: 0.3em;
48+
}
49+
50+
input,
51+
select {
52+
background-color: #fff;
53+
border: 1px solid #cccccc;
54+
border-radius: 0.3em;
55+
box-sizing: border-box;
56+
font-size: 100%;
57+
padding: .75em .5em;
58+
width: 100%;
59+
}
60+
61+
h3 {
62+
padding: 1em 0;
2463
}
2564

2665
.form-group {
@@ -33,11 +72,13 @@
3372
}
3473

3574
.example pre {
36-
color: #ffffff;
75+
color: #333;
3776
}
3877

3978
.error {
4079
color: red;
80+
font-style: italic;
81+
margin-top: 0.5em;
4182
}
4283

4384
.overflow-scroll {

docs/demo/Disabled/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Disabled
1+
# Disabled Dates
22

33
<ClientOnly>
44
<DateDisabled />

docs/demo/README.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
<DatePicker v-model="vModelExample" />
2121
```
2222

23-
## First day of Week
23+
## First day of week
2424

2525
<ClientOnly>
2626
<DatePicker
@@ -46,7 +46,7 @@
4646
<DatePicker :show-edge-dates="false" />
4747
```
4848

49-
## Custom open Date
49+
## Custom open date
5050

5151
<ClientOnly>
5252
<DatePicker-OpenDate/>
@@ -121,7 +121,7 @@
121121
<DatePicker minimum-view="day" maximum-view="month" initial-view="month" />
122122
```
123123

124-
## With Button
124+
## With button
125125

126126
<ClientOnly>
127127
<DatePicker
@@ -167,7 +167,6 @@
167167
<style>
168168
/* @import '../../dist/style.css'; */
169169

170-
/* Start vue-datepicker.css */
171170
.rtl {
172171
direction: rtl;
173172
}
@@ -386,20 +385,4 @@
386385
.vdp-datepicker__calendar-button.input-group-append {
387386
padding: 0;
388387
}
389-
/* end vue-datepicker.css */
390-
391-
input, select {
392-
padding: .75em .5em;
393-
font-size: 100%;
394-
border: 1px solid #cccccc;
395-
width: 100%;
396-
box-sizing: border-box;
397-
}
398-
pre {
399-
color: #ffffff;
400-
}
401-
.settings {
402-
margin: 2em 0;
403-
background: #eeeeee;
404-
}
405388
</style>

docs/demo/Typeable/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Typeable
22

33
<ClientOnly>
4-
<typeable />
4+
<DateTypeable />
55
</ClientOnly>

0 commit comments

Comments
 (0)