Here’s one of the “many” pages I am struggling with.
This in particular is a custom calendar component I wrote for an Ionic 3 app; it’s pretty simple.
Component TS File
calendar-view.component.ts
import { Component, OnInit, ViewEncapsulation, Output, EventEmitter, Input, SimpleChanges } from '@angular/core';
import { CalendarMonth, CalendarDay, Locations } from '../../library/library';
import { Database } from '../../database.service';
import { } from '@angular/compiler';
@Component({
selector: 'calendar-view',
templateUrl: './calendar-view.component.html',
styleUrls: ['./calendar-view.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class CalendarViewComponent implements OnInit { ... )
HTML File
calendar-view.component.html
<div class="calendar-header">
<ion-row class="calendar-month" text-center>
<ion-col size="2" (click)="goToLastMonth()" style="margin:auto; display:block;">
<ion-icon name="arrow-back"></ion-icon>
</ion-col>
<ion-col size="8" slot>
<h3><strong>{{thisMonth.original.monthString}}</strong></h3> {{thisMonth.original.year}}
</ion-col>
<ion-col size="2" (click)="goToNextMonth()" style="margin:auto; display:block;">
<ion-icon name="arrow-forward"></ion-icon>
</ion-col>
</ion-row>
</div>
<div class="calendar-body">
<ion-grid style="--ion-grid-columns: 7">
<ion-row class="calendar-weekday" text-center>
<ion-col>Su</ion-col>
<ion-col>Mo</ion-col>
<ion-col>Tu</ion-col>
<ion-col>We</ion-col>
<ion-col>Th</ion-col>
<ion-col>Fr</ion-col>
<ion-col>Sa</ion-col>
</ion-row>
<ion-row class="calendar-date" text-center>
<ion-col size="1" *ngFor="let lastDay of lastMonth.days">
<div class="{{lastDay.cssClass}}">{{lastDay.date}}</div>
</ion-col>
<ion-col size="1" *ngFor="let day of thisMonth.days" (click)="onChanged(day)">
<div class="{{day.cssClass}}" id="{{day.cssId}}">{{day.date}} </div>
<div class="event-bullet" *ngIf="checkEvent(day)"></div>
</ion-col>
<ion-col size="1" *ngFor="let nextDay of nextMonth.days" class="next-month" (click)="goToNextMonth()"
class="{{nextDay.cssClass}}">{{nextDay.date}}</ion-col>
</ion-row>
</ion-grid>
</div>
CSS File / Component Styles
calendar-view.component.scss
[col-1] {
-webkit-box-flex: 0;
-webkit-flex: 0 0 8.33333%;
-ms-flex: 0 0 8.33333%;
flex: 0 0 14.285714285714286%;
width: 14.285714285714286%;
max-width: 14.285714285714286%;
}
.col {
text-align: center;
padding: 5px;
}
.last-month,
.next-month {
--color: #999999;
font-size: 90%;
}
.currentDate,
.otherDate {
padding: 5px;
}
/*.currentDate{
font-weight: bold;
background-color: #CE0E2D;
color: #ffffff;
border-radius: 30px;
}*/
.calendar-header {
display: block;
width: auto;
margin: auto;
--background-color: #ffffff;
--color: #212121;
}
.calendar-month {
margin: auto;
width: 90%;
--border-bottom: solid 3px #ce0e2d;
}
.event-bullet {
display: block;
margin: 2px auto;
height: 5px;
width: 5px;
--background-color: #ce0e2d;
--border-radius: 30px;
}
.selected-date {
--color: white;
--background-color: #ce0e2d;
--border-radius: 50px;
.event-bullet {
margin: 2px auto;
height: 5px;
width: 5px;
--background-color: #ffffff;
--border-radius: 30px;
}
}
.unselected-date {
border: none;
}
.calendar-body {
.grid {
padding: 0;
}
.col:last-child {
border-right: none;
}
.calendar-weekday,
.calendar-date {
text-align: center;
margin: 0;
}
.calendar-weekday {
font-weight: bold;
--color: #999999;
}
/*.calendar-date {
// border-top: solid 1px #1a732d;
// border-bottom: solid 1px #212121;
}*/
}
Some of the issues I see, are the lack of any properties being passed to my html elements placed inside an ion-row
or ion-col
. Also, notice I have a special <div class="event-bullet"/>
If a date has an event, there should be a nice, tiny ellipsis that renders below the date. I can’t seem to get those to propagate on screen either.
Thanks for taking a look. I’m curious if I am missing something easy? I attached the Ionic v3 look / feel compared to the upgrade, Ionic v4 app as screenshots to this post so you can see what should be, and what isn’t quite happening.
Ionic 3
Ionic 4