Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Roles Intake integration and cleanup #337

Merged
merged 5 commits into from
Jun 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 31 additions & 12 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 @@ -71,7 +71,7 @@
"prop-types": "^15.7.2",
"react": "^16.12.0",
"react-avatar": "^3.9.7",
"react-datepicker": "^3.4.1",
"react-datepicker": "^3.8.0",
"react-dom": "^16.12.0",
"react-final-form": "^6.5.2",
"react-final-form-arrays": "^3.1.3",
Expand Down
10 changes: 10 additions & 0 deletions src/assets/images/icon-information-circle.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions src/assets/images/icon-thick-calendar.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/components/FormField/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ const FormField = ({ field }) => {
onBlur={input.onBlur}
onFocus={input.onFocus}
className={meta.error && meta.touched ? "error" : ""}
maxLength={field.maxLength}
/>
)}
{field.type === FORM_FIELD_TYPE.DATE && (
Expand Down
87 changes: 87 additions & 0 deletions src/components/InformationTooltip/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
/**
* Information Tooltip
* Icon which reveals a tooltip on mouse hover
*/
import React, { useCallback, useState } from "react";
import PT from "prop-types";
import { usePopper } from "react-popper";
import IconInformationCircle from "../../assets/images/icon-information-circle.svg";
import "./styles.module.scss";

function InformationTooltip({ text, iconSize = "16px" }) {
const [isTooltipShown, setIsTooltipShown] = useState(false);
const [referenceElement, setReferenceElement] = useState(null);
const [popperElement, setPopperElement] = useState(null);
const [arrowElement, setArrowElement] = useState(null);
const { styles, attributes } = usePopper(referenceElement, popperElement, {
placement: "top",
modifiers: [
{
name: "flip",
options: {
fallbackPlacements: ["top"],
},
},
{
name: "offset",
options: {
// use offset to move the tooltip slightly up
offset: [0, 12],
},
},
{
name: "arrow",
// padding should be equal to border-radius of the tooltip
options: { element: arrowElement, padding: 5 },
},
],
});

const showTooltip = useCallback(() => {
setIsTooltipShown(true);
}, []);

const hideTooltip = useCallback(() => {
setIsTooltipShown(false);
}, []);

const iconStyle = {
width: iconSize,
height: iconSize,
};

return (
<div>
<div
style={iconStyle}
ref={setReferenceElement}
onMouseEnter={showTooltip}
onMouseLeave={hideTooltip}
>
<IconInformationCircle styleName="circle" />
</div>
{isTooltipShown && (
<div
styleName="tooltip"
ref={setPopperElement}
style={styles.popper}
{...attributes.popper}
>
<div styleName="tooltip-content">{text}</div>
<div
styleName="tooltip-arrow"
ref={setArrowElement}
style={styles.arrow}
/>
</div>
)}
</div>
);
}

InformationTooltip.propTypes = {
iconSize: PT.string,
text: PT.string,
};

export default InformationTooltip;
34 changes: 34 additions & 0 deletions src/components/InformationTooltip/styles.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
@import "styles/include";

.circle {
* {
fill: #aaa;
}
}

.tooltip {
border-radius: 5px;
box-shadow: 0px 5px 25px #c6c6c6;
width: 165px;
z-index: 1000;
}

.tooltip-arrow {
bottom: -9px;
border-style: solid;
border-width: 10px 8px 0 8px;
border-color: #2a2a2a transparent transparent transparent;
height: 0;
width: 0;
}

.tooltip-content {
border-radius: 5px;
@include font-roboto;
font-size: 12px;
line-height: 16px;
font-weight: 400;
color: #fff;
background-color: #2a2a2a;
padding: 10px;
}
3 changes: 3 additions & 0 deletions src/components/MarkdownEditor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ const MarkdownEditor = (props) => {
]}
plugins={[]}
/>
{props.errorMessage && (
<div styleName="message">{props.errorMessage}</div>
)}
</div>
);
};
Expand Down
31 changes: 16 additions & 15 deletions src/components/MarkdownEditor/styles.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,21 +12,6 @@
overflow-y: auto;
background: #fafafb;
}
.message {
@include font-roboto;

width: 100%;
text-align: center;
min-height: 40px;
line-height: 20px;
padding: 9px 10px;
margin: 10px 0 5px;
font-size: 14px;
color: #ff5b52;
border: 1px solid #ffd5d1;
cursor: auto;
outline: none;
}
}
.editor-container {
:global {
Expand Down Expand Up @@ -72,3 +57,19 @@
}
}
}

.message {
@include font-roboto;

width: 100%;
text-align: center;
min-height: 40px;
line-height: 20px;
padding: 9px 10px;
margin: 10px 0 5px;
font-size: 14px;
color: #ff5b52;
border: 1px solid #ffd5d1;
cursor: auto;
outline: none;
}
44 changes: 44 additions & 0 deletions src/components/MonthPicker/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/**
* Month Picker
* An styled input component for selecting date by month.
* Compatible with react-final-form
*/
import React from "react";
import PT from "prop-types";
import DatePicker from "react-datepicker";
import "./styles.module.scss";

function getCurrMonthYear() {
const now = new Date();
const year = now.getFullYear();
const month = now.getMonth();
return new Date(`${year}-${month + 1}`);
}

function MonthPicker({ name, value, onChange, onBlur }) {
return (
<div styleName="month-picker">
<DatePicker
name={name}
selected={value}
onChange={onChange}
dateFormat="MMM, yyyy"
showMonthYearPicker
showPopperArrow={false}
onBlur={onBlur}
popperPlacement="top-end"
showFourColumnMonthYearPicker
minDate={getCurrMonthYear()}
/>
</div>
);
}

MonthPicker.propTypes = {
name: PT.string,
value: PT.any,
onChange: PT.func,
onBlur: PT.func,
};

export default MonthPicker;
Loading