Add event contact email and multi-day occurrences design specifications
- Introduced a new specification for adding an optional contact email field to events, including front-end output and compatibility testing. - Added a comprehensive design document for multi-day event occurrences, detailing the new occurrence data model, validation, normalization, and calendar architecture. - Created specifications for ACF field-key switching compatibility and local ACF override compatibility to ensure seamless integration with existing themes. - Implemented a desktop calendar view toggle design, allowing users to switch between calendar and list views, with persistent preferences and responsive behavior.
This commit is contained in:
+126
-47
@@ -19,6 +19,65 @@
|
||||
margin-bottom: 0.625rem;
|
||||
}
|
||||
|
||||
.aa-events-calendar-utility {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.625rem;
|
||||
justify-content: space-between;
|
||||
margin-bottom: 0.625rem;
|
||||
}
|
||||
|
||||
.aa-events-calendar-view-switcher {
|
||||
display: inline-flex;
|
||||
}
|
||||
|
||||
.aa-events-calendar-view-button {
|
||||
background: #fff;
|
||||
border: 1px solid #767676;
|
||||
border-radius: 0;
|
||||
color: #222;
|
||||
cursor: pointer;
|
||||
font: inherit;
|
||||
margin: 0;
|
||||
padding: 0.5rem 0.75rem;
|
||||
}
|
||||
|
||||
.aa-events-calendar-view-button + .aa-events-calendar-view-button {
|
||||
border-left: 0;
|
||||
}
|
||||
|
||||
.aa-events-calendar-view-button:first-child {
|
||||
border-bottom-left-radius: 0.25rem;
|
||||
border-top-left-radius: 0.25rem;
|
||||
}
|
||||
|
||||
.aa-events-calendar-view-button:last-child {
|
||||
border-bottom-right-radius: 0.25rem;
|
||||
border-top-right-radius: 0.25rem;
|
||||
}
|
||||
|
||||
.aa-events-calendar-view-button[aria-pressed="true"] {
|
||||
background: #245b87;
|
||||
color: #fff;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.aa-events-calendar-view-button:hover {
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.aa-events-calendar-view-button:focus-visible {
|
||||
outline: 3px solid currentColor;
|
||||
outline-offset: 2px;
|
||||
position: relative;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.aa-events-calendar-view-button[aria-pressed="true"]:focus-visible {
|
||||
outline-color: #111;
|
||||
}
|
||||
|
||||
.aa-events-calendar-today-btn {
|
||||
background: #aaa;
|
||||
border-radius: 0.25rem;
|
||||
@@ -149,10 +208,75 @@
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.aa-events-calendar-wrap [hidden] {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
.aa-events-calendar-agenda {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.aa-events-calendar-wrap.is-list-view .aa-events-calendar-desktop {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.aa-events-calendar-wrap.is-list-view .aa-events-calendar-agenda {
|
||||
display: block;
|
||||
}
|
||||
|
||||
.aa-events-calendar-agenda-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.aa-events-agenda-item + .aa-events-agenda-item {
|
||||
margin-top: 0.75rem;
|
||||
}
|
||||
|
||||
.aa-events-agenda-item > a {
|
||||
border: 1px solid #aaa;
|
||||
border-left: 0.25rem solid #245b87;
|
||||
border-radius: 0.25rem;
|
||||
display: block;
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
padding: 0.75rem;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.aa-events-agenda-item > a:hover {
|
||||
background: #f5f5f5;
|
||||
}
|
||||
|
||||
.aa-events-agenda-item > a:focus-visible {
|
||||
outline: 3px solid currentColor;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.aa-events-agenda-title,
|
||||
.aa-events-agenda-item time {
|
||||
display: block;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.aa-events-agenda-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.aa-events-agenda-item .screen-reader-text {
|
||||
border: 0;
|
||||
clip: rect(1px, 1px, 1px, 1px);
|
||||
clip-path: inset(50%);
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
word-wrap: normal !important;
|
||||
}
|
||||
|
||||
.aa-event-item .aa-event-details {
|
||||
border-top: 1px solid #333;
|
||||
margin-top: 1.25rem;
|
||||
@@ -176,56 +300,11 @@
|
||||
@media (max-width: 640px) {
|
||||
.aa-events-wrap .aa-events-grid { grid-template-columns: 1fr; }
|
||||
|
||||
.aa-events-calendar-view-switcher { display: none; }
|
||||
|
||||
.aa-events-calendar-desktop { display: none; }
|
||||
|
||||
.aa-events-calendar-agenda { display: block; }
|
||||
|
||||
.aa-events-calendar-agenda-list {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.aa-events-agenda-item + .aa-events-agenda-item { margin-top: 0.75rem; }
|
||||
|
||||
.aa-events-agenda-item > a {
|
||||
border: 1px solid #aaa;
|
||||
border-left: 0.25rem solid #245b87;
|
||||
border-radius: 0.25rem;
|
||||
display: block;
|
||||
min-width: 0;
|
||||
overflow-wrap: anywhere;
|
||||
padding: 0.75rem;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
.aa-events-agenda-item > a:hover { background: #f5f5f5; }
|
||||
|
||||
.aa-events-agenda-item > a:focus-visible {
|
||||
outline: 3px solid currentColor;
|
||||
outline-offset: 2px;
|
||||
}
|
||||
|
||||
.aa-events-agenda-title,
|
||||
.aa-events-agenda-item time {
|
||||
display: block;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.aa-events-agenda-title { font-weight: bold; }
|
||||
|
||||
.aa-events-agenda-item .screen-reader-text {
|
||||
border: 0;
|
||||
clip: rect(1px, 1px, 1px, 1px);
|
||||
clip-path: inset(50%);
|
||||
height: 1px;
|
||||
margin: -1px;
|
||||
overflow: hidden;
|
||||
padding: 0;
|
||||
position: absolute;
|
||||
width: 1px;
|
||||
word-wrap: normal !important;
|
||||
}
|
||||
}
|
||||
|
||||
.aa-events-wrap .entry-header:has(.entry-thumbnail),
|
||||
|
||||
@@ -0,0 +1,165 @@
|
||||
(function (factory) {
|
||||
'use strict';
|
||||
|
||||
if (typeof module === 'object' && module.exports) {
|
||||
module.exports = factory();
|
||||
return;
|
||||
}
|
||||
|
||||
var controller = factory();
|
||||
|
||||
function boot() {
|
||||
var storage;
|
||||
var mediaQuery;
|
||||
|
||||
try {
|
||||
storage = window.localStorage;
|
||||
} catch (error) {
|
||||
storage = null;
|
||||
}
|
||||
|
||||
if (typeof window.matchMedia === 'function') {
|
||||
mediaQuery = window.matchMedia('(max-width: 640px)');
|
||||
}
|
||||
|
||||
controller.init(document, storage, mediaQuery);
|
||||
}
|
||||
|
||||
if (document.readyState === 'loading') {
|
||||
document.addEventListener('DOMContentLoaded', boot);
|
||||
} else {
|
||||
boot();
|
||||
}
|
||||
})(function () {
|
||||
'use strict';
|
||||
|
||||
var STORAGE_KEY = 'aa-events-calendar-view';
|
||||
var CALENDAR_VIEW = 'calendar';
|
||||
var LIST_VIEW = 'list';
|
||||
|
||||
function isValidView(view) {
|
||||
return view === CALENDAR_VIEW || view === LIST_VIEW;
|
||||
}
|
||||
|
||||
function readPreference(storage) {
|
||||
var preference;
|
||||
|
||||
try {
|
||||
preference = storage && storage.getItem(STORAGE_KEY);
|
||||
} catch (error) {
|
||||
preference = null;
|
||||
}
|
||||
|
||||
return isValidView(preference) ? preference : CALENDAR_VIEW;
|
||||
}
|
||||
|
||||
function writePreference(storage, preference) {
|
||||
try {
|
||||
if (storage) {
|
||||
storage.setItem(STORAGE_KEY, preference);
|
||||
}
|
||||
} catch (error) {
|
||||
// Storage can be unavailable even when the localStorage object exists.
|
||||
}
|
||||
}
|
||||
|
||||
function getInstance(root) {
|
||||
var calendarButton = root.querySelector(
|
||||
'[data-aa-events-view-button="calendar"]'
|
||||
);
|
||||
var listButton = root.querySelector('[data-aa-events-view-button="list"]');
|
||||
var calendarPanel = root.querySelector(
|
||||
'[data-aa-events-view-panel="calendar"]'
|
||||
);
|
||||
var listPanel = root.querySelector('[data-aa-events-view-panel="list"]');
|
||||
|
||||
if (!calendarButton || !listButton || !calendarPanel || !listPanel) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
root: root,
|
||||
calendarButton: calendarButton,
|
||||
listButton: listButton,
|
||||
calendarPanel: calendarPanel,
|
||||
listPanel: listPanel,
|
||||
};
|
||||
}
|
||||
|
||||
function init(documentObject, storage, mediaQuery) {
|
||||
var roots = documentObject.querySelectorAll('[data-aa-events-calendar]');
|
||||
var instances = [];
|
||||
var preference;
|
||||
|
||||
for (var index = 0; index < roots.length; index += 1) {
|
||||
var instance = getInstance(roots[index]);
|
||||
|
||||
if (instance) {
|
||||
instances.push(instance);
|
||||
}
|
||||
}
|
||||
|
||||
if (instances.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
preference = readPreference(storage);
|
||||
|
||||
function applyView() {
|
||||
var mobile = Boolean(mediaQuery && mediaQuery.matches);
|
||||
|
||||
for (var instanceIndex = 0; instanceIndex < instances.length; instanceIndex += 1) {
|
||||
var calendar = instances[instanceIndex];
|
||||
var showList = mobile || preference === LIST_VIEW;
|
||||
|
||||
calendar.root.classList.toggle(
|
||||
'is-list-view',
|
||||
!mobile && preference === LIST_VIEW
|
||||
);
|
||||
calendar.calendarPanel.hidden = showList;
|
||||
calendar.listPanel.hidden = !showList;
|
||||
calendar.calendarButton.setAttribute(
|
||||
'aria-pressed',
|
||||
String(preference === CALENDAR_VIEW)
|
||||
);
|
||||
calendar.listButton.setAttribute(
|
||||
'aria-pressed',
|
||||
String(preference === LIST_VIEW)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function selectView(view) {
|
||||
if (!isValidView(view)) {
|
||||
return;
|
||||
}
|
||||
|
||||
preference = view;
|
||||
writePreference(storage, preference);
|
||||
applyView();
|
||||
}
|
||||
|
||||
for (var buttonIndex = 0; buttonIndex < instances.length; buttonIndex += 1) {
|
||||
(function (calendar) {
|
||||
calendar.calendarButton.addEventListener('click', function () {
|
||||
selectView(CALENDAR_VIEW);
|
||||
});
|
||||
calendar.listButton.addEventListener('click', function () {
|
||||
selectView(LIST_VIEW);
|
||||
});
|
||||
})(instances[buttonIndex]);
|
||||
}
|
||||
|
||||
if (mediaQuery) {
|
||||
if (typeof mediaQuery.addEventListener === 'function') {
|
||||
mediaQuery.addEventListener('change', applyView);
|
||||
} else if (typeof mediaQuery.addListener === 'function') {
|
||||
mediaQuery.addListener(applyView);
|
||||
}
|
||||
}
|
||||
|
||||
applyView();
|
||||
}
|
||||
|
||||
return { init: init };
|
||||
});
|
||||
Reference in New Issue
Block a user