Skip to content

Commit 67e5d92

Browse files
author
Jeff Rooks
committed
code cleanup
1 parent 72b0ed8 commit 67e5d92

File tree

5 files changed

+45
-44
lines changed

5 files changed

+45
-44
lines changed

src/date-range-picker/components/Controls.svelte

+10-10
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@
5151
<div class="space-between">
5252
<button
5353
aria-disabled={prevBtnDisabled}
54-
aria-label={`Previous month, ${localeFormat(prevMonth, "MMMM yyyy")}`}
54+
aria-label={`Previous month, ${localeFormat(prevMonth, 'MMMM yyyy')}`}
5555
class={btnClass}
5656
disabled={prevBtnDisabled}
57-
on:click={() => disptachEvent("prevMonth")}
58-
title={`Previous month, ${localeFormat(prevMonth, "MMMM yyyy")}`}
57+
on:click={() => disptachEvent('prevMonth')}
58+
title={`Previous month, ${localeFormat(prevMonth, 'MMMM yyyy')}`}
5959
type="button">
6060
{@html prevIcon}
6161
</button>
@@ -65,7 +65,7 @@
6565
aria-label="Month select"
6666
bind:value={selectedMonth}
6767
class={selectClass}
68-
on:change={() => disptachEvent("pageChange", {
68+
on:change={() => disptachEvent('pageChange', {
6969
incrementAmount: differenceInCalendarMonths(
7070
selectedMonth.value,
7171
month
@@ -81,14 +81,14 @@
8181
{/each}
8282
</select>
8383
{:else}
84-
<small>{localeFormat(month, "MMMM")}</small>
84+
<small>{localeFormat(month, 'MMMM')}</small>
8585
{/if}
8686
{#if yearDropdown}
8787
<select
8888
aria-label="Year select"
8989
bind:value={selectedYear}
9090
class={selectClass}
91-
on:change={() => disptachEvent("pageChange", {
91+
on:change={() => disptachEvent('pageChange', {
9292
incrementAmount:
9393
differenceInCalendarYears(selectedYear.value, month) * 12
9494
})}>
@@ -102,16 +102,16 @@
102102
{/each}
103103
</select>
104104
{:else}
105-
<small>{localeFormat(month, "yyyy")}</small>
105+
<small>{localeFormat(month, 'yyyy')}</small>
106106
{/if}
107107
</span>
108108
<button
109109
aria-disabled={nextBtnDisabled}
110-
aria-label={`Next month, ${localeFormat(nextMonth, "MMMM yyyy")}`}
110+
aria-label={`Next month, ${localeFormat(nextMonth, 'MMMM yyyy')}`}
111111
class={btnClass}
112112
disabled={nextBtnDisabled}
113-
on:click={() => disptachEvent("nextMonth")}
114-
title={`Next month, ${localeFormat(nextMonth, "MMMM yyyy")}`}
113+
on:click={() => disptachEvent('nextMonth')}
114+
title={`Next month, ${localeFormat(nextMonth, 'MMMM yyyy')}`}
115115
type="button">
116116
{@html nextIcon}
117117
</button>

src/date-range-picker/components/Day.svelte

+6-6
Original file line numberDiff line numberDiff line change
@@ -186,20 +186,20 @@
186186
role="gridcell">
187187
<button
188188
aria-disabled={day.isDisabled}
189-
aria-label={localeFormat(day.date, "EEEE, MMMM dd, yyyy")}
189+
aria-label={localeFormat(day.date, 'EEEE, MMMM dd, yyyy')}
190190
class="cell"
191191
class:muted={day.isNextMonth || day.isPrevMonth}
192192
disabled={day.isDisabled}
193-
data-date={localeFormat(day.date, "yyyy-MM-dd")}
193+
data-date={localeFormat(day.date, 'yyyy-MM-dd')}
194194
on:keydown={e => onKeydown(e, day.date)}
195-
on:mouseenter={() => dispatchEvent("hover", day.date)}
195+
on:mouseenter={() => dispatchEvent('hover', day.date)}
196196
on:mousedown={e => onMouseDown(e, day.date)}
197197
on:mouseup={e => onMouseUp(e, day.date)}
198-
title={localeFormat(day.date, "EEEE, MMMM dd, yyyy")}
198+
title={localeFormat(day.date, 'EEEE, MMMM dd, yyyy')}
199199
type="button">
200200
{#if monthIndicator}
201-
<span class="month-indicator">{localeFormat(day.date, "MMM")}</span>
201+
<span class="month-indicator">{localeFormat(day.date, 'MMM')}</span>
202202
{/if}
203-
{localeFormat(day.date, "d")}
203+
{localeFormat(day.date, 'd')}
204204
</button>
205205
</div>

src/date-range-picker/components/DaysOfWeek.svelte

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@
1414
{/if}
1515
{#each daysOfWeek as dayOfWeek}
1616
<small
17-
aria-label={localeFormat(dayOfWeek, "EEEE")}
17+
aria-label={localeFormat(dayOfWeek, 'EEEE')}
1818
class="cell muted"
1919
role="gridcell">
20-
{localeFormat(dayOfWeek, "eeeeee")}
20+
{localeFormat(dayOfWeek, 'eeeeee')}
2121
</small>
2222
{/each}
2323
{#if weekNumbers}

src/date-range-picker/components/TimePicker.svelte

+7-7
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,21 @@
101101
aria-label="First available time"
102102
class={btnClass}
103103
disabled={isFirstAvailableTime}
104-
on:click={() => dispatchEvent("timeChange", {
104+
on:click={() => dispatchEvent('timeChange', {
105105
hours: parseInt(hours[0]),
106106
minutes: parseInt(minutes[0]),
107107
seconds: parseInt(seconds[0])
108108
})}
109109
title="First available time"
110110
type="button">
111-
{@html "&#8643;"}
111+
{@html '&#8643;'}
112112
</button>
113113
{/if}
114114
<select
115115
aria-label="Hour select"
116116
value={selectedHour}
117117
class={selectClass}
118-
on:change={e => dispatchEvent("timeChange", {
118+
on:change={e => dispatchEvent('timeChange', {
119119
hours: parseInt(e.target.value),
120120
minutes: selectedMinute,
121121
seconds: timePickerSeconds ? selectedSecond : 0
@@ -131,7 +131,7 @@
131131
aria-label="Minute select"
132132
value={selectedMinute}
133133
class={selectClass}
134-
on:change={e => dispatchEvent("timeChange", {
134+
on:change={e => dispatchEvent('timeChange', {
135135
hours: selectedHour,
136136
minutes: parseInt(e.target.value),
137137
seconds: timePickerSeconds ? selectedSecond : 0
@@ -150,7 +150,7 @@
150150
aria-label="Second select"
151151
value={selectedSecond}
152152
class={selectClass}
153-
on:change={e => dispatchEvent("timeChange", {
153+
on:change={e => dispatchEvent('timeChange', {
154154
hours: selectedHour,
155155
minutes: selectedMinute,
156156
seconds: parseInt(e.target.value)
@@ -179,14 +179,14 @@
179179
aria-label="Last available time"
180180
class={btnClass}
181181
disabled={isLastAvailableTime}
182-
on:click={() => dispatchEvent("timeChange", {
182+
on:click={() => dispatchEvent('timeChange', {
183183
hours: parseInt(hours[hours.length - 1]),
184184
minutes: parseInt(minutes[minutes.length - 1]),
185185
seconds: parseInt(seconds[seconds.length - 1])
186186
})}
187187
title="Last available time"
188188
type="button">
189-
{@html "&#8638;"}
189+
{@html '&#8638;'}
190190
</button>
191191
{/if}
192192
</div>

svelte.config.js

+20-19
Original file line numberDiff line numberDiff line change
@@ -13,27 +13,28 @@ const env = createEnv()
1313
module.exports = {
1414
preprocess: {
1515
style: async ({ content, attributes }) => {
16-
if (attributes.type !== "text/scss" && attributes.lang !== "scss") return // lang is now taken into account
16+
if (attributes.type !== "text/scss" && attributes.lang !== "scss") return // lang is now taken into account
1717

18-
return new Promise((resolve, reject) => {
19-
sass.render({
20-
data: content,
21-
includePaths: ["src"],
22-
sourceMap: true,
23-
outFile: "x" // this is necessary, but is ignored
24-
},
25-
(err, result) => {
26-
if (err) return reject(err)
18+
return new Promise((resolve, reject) => {
19+
sass.render(
20+
{
21+
data: content,
22+
includePaths: ["src"],
23+
sourceMap: true,
24+
outFile: "x" // this is necessary, but is ignored
25+
},
26+
(err, result) => {
27+
if (err) return reject(err)
2728

28-
resolve({
29-
code: result.css.toString(),
30-
map: result.map.toString()
31-
})
32-
}
33-
)
34-
})
35-
},
36-
typescript: preprocess({
29+
resolve({
30+
code: result.css.toString(),
31+
map: result.map.toString()
32+
})
33+
}
34+
)
35+
})
36+
},
37+
typescript: preprocess({
3738
env,
3839
compilerOptions: {
3940
...readConfigFile(env),

0 commit comments

Comments
 (0)