Adds month view design and styling

Introduces basic month view structure and styling with week numbers.

Creates expanded month view with event details and duration-based sizing.

Moves event color handling to CSS classes for better flexibility and theming.
This commit is contained in:
Janus Knudsen 2025-08-21 22:09:15 +02:00
parent 0ea4e47324
commit 18c12cd3e6
8 changed files with 1735 additions and 15 deletions

View file

@ -35,18 +35,20 @@
--color-grid-line: #e0e0e0;
--color-grid-line-light: rgba(0, 0, 0, 0.05);
--color-hour-line: rgba(0, 0, 0, 0.2);
--color-work-hours: rgba(0, 100, 0, 0.06);
--color-work-hours: rgba(242, 242, 242, 1);
--color-current-time: #ff0000;
/* Event colors */
--color-event-meeting: #e3f2fd;
--color-event-meeting-border: #2196f3;
--color-event-meal: #fff3e0;
/* Event colors - Updated with month-view-expanded.html color scheme */
--color-event-meeting: #e8f5e8;
--color-event-meeting-border: #4caf50;
--color-event-meal: #fff8e1;
--color-event-meal-border: #ff9800;
--color-event-work: #f3e5f5;
--color-event-work-border: #9c27b0;
--color-event-milestone: #e8f5e9;
--color-event-milestone-border: #4caf50;
--color-event-work: #fff8e1;
--color-event-work-border: #ff9800;
--color-event-milestone: #ffebee;
--color-event-milestone-border: #f44336;
--color-event-personal: #f3e5f5;
--color-event-personal-border: #9c27b0;
/* UI colors */
--color-background: #ffffff;

View file

@ -10,7 +10,7 @@ swp-event {
z-index: 10;
left: 2px;
right: 2px;
color: white;
color: var(--color-text);
font-size: 12px;
padding: 2px 4px;
@ -18,28 +18,44 @@ swp-event {
&[data-type="meeting"] {
background: var(--color-event-meeting);
border-left: 4px solid var(--color-event-meeting-border);
color: var(--color-text);
}
&[data-type="meal"] {
background: var(--color-event-meal);
border-left: 4px solid var(--color-event-meal-border);
color: var(--color-text);
}
&[data-type="work"] {
background: var(--color-event-work);
border-left: 4px solid var(--color-event-work-border);
color: var(--color-text);
}
&[data-type="milestone"] {
background: var(--color-event-milestone);
border-left: 4px solid var(--color-event-milestone-border);
color: var(--color-text);
}
&[data-type="personal"] {
background: var(--color-event-personal);
border-left: 4px solid var(--color-event-personal-border);
color: var(--color-text);
}
&[data-type="deadline"] {
background: var(--color-event-milestone);
border-left: 4px solid var(--color-event-milestone-border);
color: var(--color-text);
}
}
swp-event:hover {
box-shadow: var(--shadow-md);
filter: brightness(0.95);
transform: translateX(2px);
z-index: 20;
}

View file

@ -0,0 +1,316 @@
/* Calendar Month View Styles */
/* Month view specific container - extends swp-calendar-container for month layout */
swp-calendar[data-view="month"] swp-calendar-container {
overflow: hidden;
background: var(--color-background);
}
/* Month grid layout with week numbers column */
.month-grid {
display: grid;
grid-template-columns: 40px repeat(7, 1fr); /* Week numbers + 7 days */
grid-template-rows: 40px repeat(6, 1fr);
min-height: 600px;
border: 1px solid var(--color-border);
border-radius: var(--border-radius);
overflow: hidden;
}
/* Week number header cell */
.month-week-header {
grid-column: 1;
grid-row: 1;
background: var(--color-surface);
border-right: 1px solid var(--color-border);
border-bottom: 1px solid var(--color-border);
display: flex;
align-items: center;
justify-content: center;
font-size: 0.75rem;
font-weight: 600;
color: var(--color-text-secondary);
height: 40px;
}
/* Month day headers - only day names, right aligned */
.month-day-header {
background: var(--color-surface);
border-right: 1px solid var(--color-border);
border-bottom: 1px solid var(--color-border);
display: flex;
align-items: center;
justify-content: flex-end;
padding: 8px 12px;
font-weight: 600;
color: var(--color-text-secondary);
font-size: 0.875rem;
height: 40px;
}
.month-day-header:last-child {
border-right: none;
}
/* Week number cells */
.month-week-number {
grid-column: 1;
background: var(--color-surface);
border-right: 1px solid var(--color-border);
border-bottom: 1px solid var(--color-border);
display: flex;
align-items: center;
justify-content: center;
font-size: 0.75rem;
font-weight: 600;
color: var(--color-text-secondary);
}
/* Month day cells */
.month-day-cell {
border-right: 1px solid var(--color-border);
border-bottom: 1px solid var(--color-border);
padding: 8px;
background: var(--color-background);
transition: background-color var(--transition-fast);
position: relative;
min-height: 100px;
cursor: pointer;
}
.month-day-cell:hover {
background: var(--color-hover);
}
.month-day-cell:last-child {
border-right: none;
}
/* Other month dates (previous/next month) */
.month-day-cell.other-month {
background: var(--color-surface);
color: var(--color-text-secondary);
}
/* Today highlighting - subtle with left border */
.month-day-cell.today {
background: #f0f8ff;
border-left: 3px solid var(--color-primary);
}
/* Weekend styling */
.month-day-cell.weekend {
background: #fafbfc;
}
/* Day number in each cell */
.month-day-number {
font-weight: 600;
margin-bottom: 6px;
font-size: 0.875rem;
}
.month-day-cell.today .month-day-number {
color: var(--color-primary);
font-weight: 700;
}
/* Events container within each day */
.month-events {
display: flex;
flex-direction: column;
gap: 2px;
max-height: 70px;
overflow: hidden;
}
/* Individual month events - compact version */
.month-event {
background: #e3f2fd;
color: var(--color-primary);
padding: 1px 4px;
border-radius: 2px;
font-size: 10px;
font-weight: 500;
cursor: pointer;
transition: all var(--transition-fast);
border-left: 2px solid var(--color-primary);
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: 1.2;
}
.month-event:hover {
transform: translateY(-1px);
}
/* Event categories using existing color scheme */
.month-event.category-meeting {
background: #e8f5e8;
color: var(--color-success);
border-left-color: var(--color-success);
}
.month-event.category-deadline {
background: #ffebee;
color: var(--color-error);
border-left-color: var(--color-error);
}
.month-event.category-work {
background: #fff8e1;
color: var(--color-secondary);
border-left-color: var(--color-secondary);
}
.month-event.category-personal {
background: #f3e5f5;
color: #7b1fa2;
border-left-color: #9c27b0;
}
/* "More events" indicator */
.month-event-more {
background: var(--color-surface);
color: var(--color-text-secondary);
padding: 1px 4px;
border-radius: 2px;
font-size: 9px;
text-align: center;
cursor: pointer;
border: 1px dashed var(--color-border);
margin-top: 1px;
}
.month-event-more:hover {
background: var(--color-hover);
}
/* Expanded month view - duration-based events */
.month-grid.expanded {
min-height: 800px;
}
.month-grid.expanded .month-day-cell {
min-height: 120px;
padding: 4px;
}
.month-grid.expanded .month-events {
max-height: none;
overflow: visible;
}
.month-grid.expanded .month-event {
padding: 2px 6px;
font-size: 11px;
min-height: 16px;
display: flex;
flex-direction: column;
white-space: normal;
text-overflow: clip;
overflow: visible;
}
/* Duration-based event sizing (30px per hour) */
.month-event.duration-30min { min-height: 15px; }
.month-event.duration-1h { min-height: 30px; }
.month-event.duration-1h30 { min-height: 45px; }
.month-event.duration-2h { min-height: 60px; }
.month-event.duration-3h { min-height: 90px; }
.month-event.duration-4h { min-height: 120px; }
/* Event time display for expanded view */
.month-event-time {
font-size: 9px;
opacity: 0.8;
font-weight: 400;
}
.month-event-title {
font-weight: 600;
font-size: 10px;
}
.month-event-subtitle {
font-size: 9px;
opacity: 0.7;
font-weight: 400;
}
/* All-day events */
.month-event.all-day {
background: linear-gradient(90deg, var(--color-primary), rgba(33, 150, 243, 0.7));
color: white;
border-left-color: var(--color-primary);
font-weight: 600;
}
/* Responsive adjustments */
@media (max-width: 768px) {
.month-grid {
grid-template-columns: 30px repeat(7, 1fr);
min-height: 400px;
}
.month-day-cell {
min-height: 60px;
padding: 4px;
}
.month-day-header {
padding: 8px 4px;
font-size: 0.75rem;
}
.month-event {
font-size: 9px;
padding: 1px 3px;
}
.month-events {
max-height: 40px;
}
.month-week-number {
font-size: 0.6rem;
}
}
/* Loading state for month view */
swp-calendar[data-view="month"][data-loading="true"] .month-grid {
opacity: 0.5;
pointer-events: none;
}
/* Month view navigation animation support */
.month-grid {
transition: transform var(--transition-normal);
}
.month-grid.sliding-out-left {
transform: translateX(-100%);
}
.month-grid.sliding-out-right {
transform: translateX(100%);
}
.month-grid.sliding-in-left {
transform: translateX(-100%);
animation: slideInFromLeft var(--transition-normal) forwards;
}
.month-grid.sliding-in-right {
transform: translateX(100%);
animation: slideInFromRight var(--transition-normal) forwards;
}
@keyframes slideInFromLeft {
to { transform: translateX(0); }
}
@keyframes slideInFromRight {
to { transform: translateX(0); }
}

View file

@ -10,6 +10,7 @@
<link rel="stylesheet" href="css/calendar-layout-css.css">
<link rel="stylesheet" href="css/calendar-components-css.css">
<link rel="stylesheet" href="css/calendar-events-css.css">
<link rel="stylesheet" href="css/calendar-month-css.css">
<link rel="stylesheet" href="css/calendar-popup-css.css">
</head>
<body>