-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: fable test app homepage #39
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks really cool! I love seeing the Next Holiday on the home page. I just have a few questions around that specific component
fable-test-app/package.json
Outdated
"@cdssnc/gcds-components": "^0.26.0", | ||
"@cdssnc/gcds-components-react": "^0.26.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use another version bump 😜
isCurrentHoliday? : boolean; | ||
nextHoliday: { | ||
date: string; | ||
nameEn: string; | ||
} | null; | ||
federal?: boolean; | ||
observedIn?: Provinces[]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this one better for clarity, what do you think?
observedIn?: Provinces[]; | |
provincesObservedIn?: Provinces[]; |
@@ -23,6 +29,27 @@ const NextHoliday: React.FC<NextHolidayProps> = ({ | |||
return Math.floor((holidayDate.getTime() - today.getTime()) / (1000 * 3600 * 24)); | |||
}; | |||
|
|||
// Get long version of date | |||
const nextHolidayDate = (dateString: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see potential for this to be generalized, especially seeing the function call is nextHolidayDate(holidayDate)
when it only returns formatting. Can we change it?
const nextHolidayDate = (dateString: string) => { | |
const formatDate = (dateString: string) => { |
fable-test-app/src/pages/Home.tsx
Outdated
data.holidays.map((holiday: holidayObject) => { | ||
if (holiday.federal === 1) { | ||
const holidayDate = new Date (holiday.date).getTime(); | ||
if (holidayDate > currentDate && !fedAssigned) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small suggestion to do the boolean check first so it doesn't have to do the second check if it's already been assigned
if (holidayDate > currentDate && !fedAssigned) { | |
if (!fedAssigned && holidayDate > currentDate) { |
fable-test-app/src/pages/Home.tsx
Outdated
let nationwideAssigned = false; | ||
data.holidays.map((holiday: holidayObject) => { | ||
const holidayDate = new Date (holiday.date).getTime(); | ||
if (holidayDate > currentDate && !nationwideAssigned) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same comment as above :)
}; | ||
|
||
// Create formatted list of <abbr> elements for provinces | ||
const formatObservedIn = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const formatObservedIn = () => { | |
const getObservedInProvinces = () => { |
or something similar; format*
typically means you pass it something it'll change but this one just simply returns a block of html
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Summary | Résumé
Create homepage for the fable test app (holidays app) based on figma prototype.