This repository was archived by the owner on Mar 13, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Modal component, payment cancelling, processing errors in popovers and other improvements #62
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
4701efd
Implemented error messages in popovers for failed working period rows.
MadOPcode 9a4057c
Changed endpoint for user handle suggestions.
MadOPcode ead7ac8
Fixed: billing account was reset in UI after reopening working period…
MadOPcode 02c6a82
Added working period alert column.
MadOPcode 4b77b44
Implemented Modal component and payment cancelling.
MadOPcode 519a289
Fixed: closing modal sometimes closed popover.
MadOPcode 213c774
Added comments for Modal. Disabled payment Cancel button for payments…
MadOPcode fbf0f35
Merge branch 'dev' of https://github.com/topcoder-platform/micro-fron…
MadOPcode 7ccac08
Merge branch 'topcoder-platform-dev' into dev
MadOPcode b50ea7a
Added comments for PaymentCancel component.
MadOPcode 3b061c0
Added bullet lists to selection checkbox and alerts tooltips.
MadOPcode d2d1a1c
Fixed: working period rows got taller on small screens.
MadOPcode File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,20 @@ | ||
import React from "react"; | ||
import PT from "prop-types"; | ||
import cn from "classnames"; | ||
import styles from "./styles.module.scss"; | ||
|
||
/** | ||
* Displays a white exclamation mark inside red circle. | ||
* | ||
* @param {Object} props component properties | ||
* @returns {JSX.Element} | ||
*/ | ||
const ExclamationMarkCircled = (props) => ( | ||
<span {...props} className={cn(styles.icon, props.className)} /> | ||
); | ||
|
||
ExclamationMarkCircled.propTypes = { | ||
className: PT.string, | ||
}; | ||
|
||
export default ExclamationMarkCircled; |
22 changes: 22 additions & 0 deletions
22
src/components/Icons/ExclamationMarkCircled/styles.module.scss
This file contains hidden or 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,22 @@ | ||
@import "styles/mixins"; | ||
@import "styles/variables"; | ||
|
||
.icon { | ||
display: inline-block; | ||
padding: 2px 0 0; | ||
font-size: 12px; | ||
width: 16px; | ||
height: 16px; | ||
border-radius: 8px; | ||
line-height: 14px; | ||
@include roboto-bold; | ||
text-align: center; | ||
background: $error-color; | ||
color: #fff; | ||
cursor: pointer; | ||
|
||
&::before { | ||
content: "!"; | ||
display: inline; | ||
} | ||
} |
This file contains hidden or 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,95 @@ | ||
import React from "react"; | ||
import PT from "prop-types"; | ||
import { Modal as ReactModal } from "react-responsive-modal"; | ||
import Button from "components/Button"; | ||
import IconCross from "../../assets/images/icon-cross-light.svg"; | ||
import { stopImmediatePropagation } from "utils/misc"; | ||
import styles from "./styles.module.scss"; | ||
import "react-responsive-modal/styles.css"; | ||
|
||
const classNames = { | ||
modal: styles.modal, | ||
modalContainer: styles.modalContainer, | ||
}; | ||
const closeIcon = <IconCross />; | ||
|
||
/** | ||
* Displays a modal with Approve- and Dismiss-button and an overlay. | ||
* | ||
* @param {Object} props component properties | ||
* @param {string} [props.approveText] text for Approve-button | ||
* @param {Object} props.children elements that will be shown inside modal | ||
* @param {?Object} [props.controls] custom controls that will be shown below | ||
* modal's contents | ||
* @param {string} [props.dismissText] text for Dismiss-button | ||
* @param {boolean} props.isOpen whether to show or hide the modal | ||
* @param {() => void} [props.onApprove] function called on approve action | ||
* @param {() => void} props.onDismiss function called on dismiss action | ||
* @param {string} [props.title] text for modal title | ||
* @returns {JSX.Element} | ||
*/ | ||
const Modal = ({ | ||
approveText = "Apply", | ||
children, | ||
controls, | ||
dismissText = "Cancel", | ||
isOpen, | ||
onApprove, | ||
onDismiss, | ||
title, | ||
}) => ( | ||
<ReactModal | ||
center | ||
classNames={classNames} | ||
onClose={onDismiss} | ||
open={isOpen} | ||
onOverlayClick={stopImmediatePropagation} | ||
showCloseIcon={false} | ||
> | ||
<div | ||
className={styles.wrapper} | ||
onMouseDown={stopImmediatePropagation} | ||
onMouseUp={stopImmediatePropagation} | ||
onClick={stopImmediatePropagation} | ||
role="button" | ||
tabIndex={0} | ||
> | ||
{title && <div className={styles.title}>{title}</div>} | ||
<div className={styles.content}>{children}</div> | ||
{controls || controls === null ? ( | ||
controls | ||
) : ( | ||
<div className={styles.controls}> | ||
<Button | ||
className={styles.button} | ||
color="warning" | ||
variant="contained" | ||
onClick={onApprove} | ||
> | ||
{approveText} | ||
</Button> | ||
<Button className={styles.button} onClick={onDismiss}> | ||
{dismissText} | ||
</Button> | ||
</div> | ||
)} | ||
<button className={styles.closeButton} type="button" onClick={onDismiss}> | ||
{closeIcon} | ||
</button> | ||
</div> | ||
</ReactModal> | ||
); | ||
|
||
Modal.propTypes = { | ||
approveText: PT.string, | ||
children: PT.node, | ||
container: PT.element, | ||
controls: PT.node, | ||
dismissText: PT.string, | ||
isOpen: PT.bool.isRequired, | ||
onApprove: PT.func, | ||
onDismiss: PT.func.isRequired, | ||
title: PT.string, | ||
}; | ||
|
||
export default Modal; |
This file contains hidden or 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,69 @@ | ||
@import "styles/mixins"; | ||
|
||
div.modalContainer { | ||
padding: 20px; | ||
} | ||
|
||
div.modal { | ||
margin: 0; | ||
border-radius: 8px; | ||
border: none; | ||
padding: 0; | ||
width: 640px; | ||
max-width: 100%; | ||
} | ||
|
||
.wrapper { | ||
padding: 32px 32px 22px; | ||
} | ||
|
||
button.closeButton { | ||
display: inline-block; | ||
position: absolute; | ||
top: 14px; | ||
right: 14px; | ||
border: none; | ||
padding: 0; | ||
width: 15px; | ||
background: transparent; | ||
outline: none !important; | ||
box-shadow: none !important; | ||
|
||
svg { | ||
display: block; | ||
width: 100%; | ||
height: auto; | ||
} | ||
} | ||
|
||
.title { | ||
margin: 0 0 24px; | ||
font-size: 34px; | ||
line-height: 38px; | ||
text-transform: uppercase; | ||
@include barlow-condensed; | ||
} | ||
|
||
.content { | ||
margin: 0 0 10px; | ||
font-size: 16px; | ||
line-height: 22px; | ||
@include roboto-regular; | ||
|
||
+ .controls { | ||
margin-top: 24px; | ||
} | ||
} | ||
|
||
.controls { | ||
display: flex; | ||
flex-wrap: wrap; | ||
} | ||
|
||
.button { | ||
margin: 0 10px 10px 0; | ||
|
||
&:last-child { | ||
margin-right: 0; | ||
} | ||
} |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.