Skip to content

Commit

Permalink
progress
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmojicatech committed Jan 22, 2023
1 parent ed4e809 commit 05cf4d2
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 111 deletions.
18 changes: 9 additions & 9 deletions libs/pmt-calendar/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { HTMLStencilElement, JSXBase } from "@stencil/core/internal";
export namespace Components {
interface PmtCalendar {
}
interface PmtCalendarHeader {
interface PmtCalendarSubHeader {
}
}
declare global {
Expand All @@ -18,33 +18,33 @@ declare global {
prototype: HTMLPmtCalendarElement;
new (): HTMLPmtCalendarElement;
};
interface HTMLPmtCalendarHeaderElement extends Components.PmtCalendarHeader, HTMLStencilElement {
interface HTMLPmtCalendarSubHeaderElement extends Components.PmtCalendarSubHeader, HTMLStencilElement {
}
var HTMLPmtCalendarHeaderElement: {
prototype: HTMLPmtCalendarHeaderElement;
new (): HTMLPmtCalendarHeaderElement;
var HTMLPmtCalendarSubHeaderElement: {
prototype: HTMLPmtCalendarSubHeaderElement;
new (): HTMLPmtCalendarSubHeaderElement;
};
interface HTMLElementTagNameMap {
"pmt-calendar": HTMLPmtCalendarElement;
"pmt-calendar-header": HTMLPmtCalendarHeaderElement;
"pmt-calendar-sub-header": HTMLPmtCalendarSubHeaderElement;
}
}
declare namespace LocalJSX {
interface PmtCalendar {
}
interface PmtCalendarHeader {
interface PmtCalendarSubHeader {
}
interface IntrinsicElements {
"pmt-calendar": PmtCalendar;
"pmt-calendar-header": PmtCalendarHeader;
"pmt-calendar-sub-header": PmtCalendarSubHeader;
}
}
export { LocalJSX as JSX };
declare module "@stencil/core" {
export namespace JSX {
interface IntrinsicElements {
"pmt-calendar": LocalJSX.PmtCalendar & JSXBase.HTMLAttributes<HTMLPmtCalendarElement>;
"pmt-calendar-header": LocalJSX.PmtCalendarHeader & JSXBase.HTMLAttributes<HTMLPmtCalendarHeaderElement>;
"pmt-calendar-sub-header": LocalJSX.PmtCalendarSubHeader & JSXBase.HTMLAttributes<HTMLPmtCalendarSubHeaderElement>;
}
}
}

This file was deleted.

This file was deleted.

23 changes: 0 additions & 23 deletions libs/pmt-calendar/src/components/calendar-header/readme.md

This file was deleted.

10 changes: 10 additions & 0 deletions libs/pmt-calendar/src/components/calendar-sub-header/readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# pmt-calendar-sub-header



<!-- Auto Generated Below -->


----------------------------------------------

*Built with [StencilJS](https://stenciljs.com/)*
24 changes: 23 additions & 1 deletion libs/pmt-calendar/src/components/calendar/calendar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,32 @@

.container {
padding: 1rem;
display: inline-flex;
display: flex;
flex-direction: column;
justify-content: center;
width: 100vw;
pmt-calendar-header {
width: 100%;
}
}


.calendar-header-container {
display: inline-flex;
justify-content: center;
justify-self: center;
width: 100%;
span {
padding: 1rem;

}
button {
background-color: #fff;
padding: 1rem;
font-size: 1.25rem;
&.selected {
background-color: blue;
color: #fff;
}
}
}
47 changes: 43 additions & 4 deletions libs/pmt-calendar/src/components/calendar/calendar.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,57 @@
import { Component, h } from '@stencil/core';

import { Component, h, State } from '@stencil/core';
import { CALENDAR_VIEW } from '../../models/calendar.const';
import { CalendarView } from '../../models/calendar.types';
import { format } from 'date-fns';
@Component({
tag: 'pmt-calendar',
styleUrl: 'calendar.scss',
shadow: true,
})
export class CalendarComponent {

@State()
currentView: CalendarView = 'Month';

@State()
currentSubTitle: string = format(new Date(new Date().getFullYear(), new Date().getMonth()), 'MMMM yyyy');

updateCurrentView(view: CalendarView) {
this.currentView = view;
const today = new Date();
switch (view) {
case 'Day': {
this.currentSubTitle = format(today, 'MMMM dd, yyyy');
break;
}
case 'Year': {
this.currentSubTitle = format(today, 'yyyy');
break;
}
default:
this.currentSubTitle = format(today, 'MMMM yyyy');
break;
}
}

render() {
return (
<section class="container">
<div class="header">
<pmt-calendar-header></pmt-calendar-header>
</div>
<div class="calendar-header-container">
{Object.keys(CALENDAR_VIEW).map(key => {
return (
<button
class={CALENDAR_VIEW[key] === this.currentView ? 'selected' : ''}
onClick={() => this.updateCurrentView(CALENDAR_VIEW[key])} key={key}>
{CALENDAR_VIEW[key]}
</button>
);
})}
</div>
</div>
<div class="subb-header">
<h1>{this.currentSubTitle}</h1>
</div>
</section>

)
Expand Down
13 changes: 0 additions & 13 deletions libs/pmt-calendar/src/components/calendar/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,6 @@
<!-- Auto Generated Below -->


## Dependencies

### Depends on

- [pmt-calendar-header](../calendar-header)

### Graph
```mermaid
graph TD;
pmt-calendar --> pmt-calendar-header
style pmt-calendar fill:#f9f,stroke:#333,stroke-width:4px
```

----------------------------------------------

*Built with [StencilJS](https://stenciljs.com/)*
6 changes: 3 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
"chart.js": "^3.9.1",
"cheerio": "^1.0.0-rc.12",
"core-js": "^3.6.5",
"date-fns": "^2.28.0",
"date-fns": "^2.29.3",
"dotenv": "^16.0.1",
"express": "^4.18.1",
"ionicons": "^6.0.1",
Expand Down

0 comments on commit 05cf4d2

Please sign in to comment.