-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9efddd1
commit 8a85570
Showing
2 changed files
with
34 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,42 @@ | ||
import styles from './WelcomeHeading.module.scss'; | ||
import { ProfileName } from '../../components/MainHeader/ProfileName'; | ||
import { PageHeadingV2 } from '../../components/PageHeading/PageHeadingV2'; | ||
|
||
const HELLO = 'Welkom,'; | ||
const NOON = 12; | ||
const EVENING = 18; | ||
const NIGHT = 5; | ||
|
||
export function WelcomeHeading() { | ||
const hours = new Date().getHours(); | ||
const isMorning = hours < NOON && hours >= NIGHT; | ||
const isEvening = hours >= EVENING; | ||
const isNight = hours < NIGHT; | ||
const isAfternoon = hours >= NOON && hours < EVENING; | ||
|
||
let hello = HELLO; | ||
|
||
switch (true) { | ||
case isMorning: | ||
hello = 'Goedemorgen,'; | ||
break; | ||
case isAfternoon: | ||
hello = 'Goedemiddag,'; | ||
break; | ||
case isEvening: | ||
hello = 'Goedenavond,'; | ||
break; | ||
case isNight: | ||
hello = 'Goedenacht,'; | ||
break; | ||
} | ||
|
||
return ( | ||
<PageHeadingV2 showBacklink={false}> | ||
{HELLO} | ||
<br /> <ProfileName /> | ||
{hello}{' '} | ||
<span className={styles.ProfileNameWrap}> | ||
<ProfileName /> | ||
</span> | ||
</PageHeadingV2> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.ProfileNameWrap { | ||
white-space: nowrap; | ||
} |