-
Notifications
You must be signed in to change notification settings - Fork 76
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
Showing
91 changed files
with
1,429 additions
and
704 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 |
---|---|---|
|
@@ -44,3 +44,6 @@ WISE_PROFILE_ID="123456" | |
|
||
#Feature Flags | ||
ENABLE_WEEKLY_REMINDER= | ||
|
||
# Sentry | ||
SENTRY_DSN= |
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
File renamed without changes.
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
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
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
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
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
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
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
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
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
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,74 @@ | ||
import React, { useState, useEffect } from "react"; | ||
|
||
import classnames from "classnames"; | ||
|
||
const avatar = require("../../../assets/images/NavAvatar.svg"); //eslint-disable-line | ||
|
||
type AvatarProps = { | ||
url?: string; | ||
name?: string; | ||
classNameImg?: string; | ||
classNameInitials?: string; | ||
classNameInitialsWrapper?: string; | ||
}; | ||
|
||
const Avatar = ({ | ||
url = "", | ||
name = "", | ||
classNameImg = "", | ||
classNameInitials = "", | ||
classNameInitialsWrapper = "" | ||
}: AvatarProps) => { | ||
const [initials, setInitials] = useState<string>(null); | ||
const DEFAULT_STYLE_IMAGE = "inline-block md:h-10 md:w-10 h-5 w-5 rounded-full"; | ||
const DEFAULT_STYLE_INITIALS = "md:text-xl text-xs md:font-medium font-light leading-none text-white"; | ||
const DEFAULT_STYLE_INITIALS_WRAPPER = "inline-flex md:h-10 md:w-10 h-6 w-6 rounded-full items-center justify-center bg-gray-500"; | ||
|
||
const getInitials = () => { | ||
if (name) { | ||
const parts = name.match(/\b(\w)/g); | ||
const initials = parts.join("").slice(0,2); | ||
setInitials(initials.toUpperCase()); | ||
} | ||
}; | ||
|
||
useEffect(() => getInitials(), []); | ||
|
||
if (url) { | ||
return ( | ||
<img | ||
className={classnames(DEFAULT_STYLE_IMAGE, classNameImg)} | ||
src={url} | ||
alt="profile_pic" | ||
/> | ||
); | ||
} | ||
if (initials) { | ||
return ( | ||
<div className={classnames("inline-block")}> | ||
<span | ||
className={classnames( | ||
DEFAULT_STYLE_INITIALS_WRAPPER, | ||
classNameInitialsWrapper | ||
)} | ||
> | ||
<span | ||
className={classnames(DEFAULT_STYLE_INITIALS, classNameInitials)} | ||
> | ||
{initials} | ||
</span> | ||
</span> | ||
</div> | ||
); | ||
} | ||
|
||
return ( | ||
<img | ||
src={avatar} | ||
className={classnames(DEFAULT_STYLE_IMAGE, classNameImg)} | ||
alt="avatar" | ||
/> | ||
); | ||
}; | ||
|
||
export default Avatar; |
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,52 @@ | ||
import React, { useState } from "react"; | ||
|
||
import classnames from "classnames"; | ||
|
||
type TooltipProps = { | ||
content?: string; | ||
placeBottom?: boolean; | ||
delay?: number; | ||
className?: string; | ||
children?: object; | ||
}; | ||
|
||
const Tooltip = ({ | ||
content, | ||
placeBottom = false, | ||
delay = 400, | ||
className, | ||
...restprops | ||
}: TooltipProps) => { | ||
let timeout; | ||
const [active, setActive] = useState<boolean>(false); | ||
const DEFAULT_STYLE = `before:h-0 before:w-0 before:absolute before:pointer-events-none before:border-4 before:mr-4 before:content-none before:left-1/2 | ||
absolute left-1/2 z-10 rounded-md p-2 text-miru-dark-purple-1000 bg-miru-gray-1000 text-sm leading-none whitespace-nowrap ${ | ||
placeBottom ? "top-full mt-2" : "bottom-full mb-2" | ||
}`; | ||
|
||
const showTip = () => { | ||
timeout = setTimeout(() => { | ||
setActive(true); | ||
}, delay); | ||
}; | ||
|
||
const hideTip = () => { | ||
clearInterval(timeout); | ||
setActive(false); | ||
}; | ||
|
||
return ( | ||
<div | ||
className={classnames("block relative")} | ||
onMouseEnter={showTip} | ||
onMouseLeave={hideTip} | ||
> | ||
{restprops.children} | ||
{active && ( | ||
<div className={classnames(DEFAULT_STYLE, className)}>{content}</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
|
||
export default Tooltip; |
Oops, something went wrong.