git ssb

0+

mixmix / marama



Commit 64e9abb6cd8d8e8be200248e9a8eeabe10f3dfe2

extract month name / title responsibilities from marama

mixmix committed on 8/20/2018, 7:51:35 AM
Parent: 6a63ca3977febbdc5b016c8119cefe3329f0a1a2

Files changed

README.mdchanged
index.jschanged
styles/index.mcsschanged
README.mdView
@@ -38,9 +38,8 @@
3838 {
3939 month, // month number (by common defn, e.g. 4 is April)
4040 events // (optional) an Array of form: [{ date: Date, data: { ... } }]
4141 year, // (optional) defaults to current year
42- monthNames, // (optional) an Array of month names
4342 range, // (optional) an Object of form { gte: Date, lt: Date } to highlight
4443 setRange, // (optional) a callback which receives a range on clicks { gte, lt }
4544 styles, // (optional) Object, _see below_
4645 today // (optional) a Date which can be used to over-ride the definition of today
index.jsView
@@ -2,9 +2,8 @@
22 const DayTile = require('./day-tile')
33 const DayLabel = require('./day-label')
44 const getDay = require('./lib/get-day')
55
6-const MONTH_NAMES = [ 'Ja', 'Fe', 'Ma', 'Ap', 'Ma', 'Ju', 'Ju', 'Au', 'Se', 'Oc', 'No', 'De' ]
76 const DAYS = [ 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday' ]
87 const DEFAULT_FORMAT = 'rows'
98
109 module.exports = function Marama (opts = {}) {
@@ -12,9 +11,8 @@
1211 const {
1312 events = [],
1413 month = day.getMonth() + 1, // month number (common defn)
1514 year = day.getFullYear(),
16- monthNames = MONTH_NAMES,
1715 range,
1816 setRange = () => {},
1917 styles = {},
2018 today = day
@@ -37,17 +35,9 @@
3735 range,
3836 setRange
3937 }
4038
41- const setMonthRange = (ev) => {
42- setRange({
43- gte: new Date(year, monthIndex, 1),
44- lt: new Date(year, monthIndex + 1, 1)
45- })
46- }
47-
4839 return h('Marama', [
49- // h('div.month-name', { 'ev-click': setMonthRange }, monthNames[monthIndex]),
5040 h('div.days', { style: getStyles(styles) }, [
5141 DAYS.map((day, i) => DayLabel(day, i, dayOpts.weekFormat)),
5242 days.map(day => {
5343 dayOpts.day = day // note we're mutating this object (might save memory?)
styles/index.mcssView
@@ -1,13 +1,5 @@
11 Marama {
2- div.month-name {
3- font-size: 20px
4- font-weight: bold
5- text-align: left
6- cursor: pointer
7- margin-bottom: 5px
8- }
9-
102 div.days {
113 grid-gap: var(--tile-gap)
124 justify-content: start
135 align-content: start

Built with git-ssb-web