Skip to content
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

PopUp Modal as separate component #129

Merged
merged 5 commits into from
Oct 24, 2018
Merged

PopUp Modal as separate component #129

merged 5 commits into from
Oct 24, 2018

Conversation

ChaitanyaGadodia
Copy link
Contributor

@ChaitanyaGadodia ChaitanyaGadodia commented Oct 23, 2018

@vercel
Copy link

vercel bot commented Oct 23, 2018

This pull request is automatically deployed with Now.
To access deployments, click Details below or on the icon next to each push.

@ChaitanyaGadodia ChaitanyaGadodia changed the title Confirmation Modal as seperate component Confirmation Modal as separate component Oct 23, 2018
@codecov
Copy link

codecov bot commented Oct 23, 2018

Codecov Report

Merging #129 into master will increase coverage by 0.25%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #129      +/-   ##
==========================================
+ Coverage   74.13%   74.39%   +0.25%     
==========================================
  Files          69       69              
  Lines         812      824      +12     
  Branches      157      161       +4     
==========================================
+ Hits          602      613      +11     
  Misses        195      195              
- Partials       15       16       +1
Impacted Files Coverage Δ
src/components/PhoneNumberInput.tsx 96.29% <0%> (-3.71%) ⬇️
src/components/styles/PhoneNumberInput.styles.ts 100% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7e191dd...a4c5575. Read the comment docs.

@ritz078
Copy link
Contributor

ritz078 commented Oct 24, 2018

@ChaitanyaGadodia link to the design system.

No
</Button>
<Button size="large" type="primary" onClick={onApprove}>
Yes
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Create a PopUp component rather than ConfirmationModal .
  • Yes, No etc should be dynamic text taken as prop.
  • you might not always have both buttons. Sometimes there can be simple text with "Ok, Got it" button.
  • Get this added to design system.

import * as styles from "./styles/PopUp.styles";
import { PopUpProps } from "./typings/PopUp";

export default class PopUp extends React.Component<PopUpProps> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

convert this into a functional component

<Modal visible={visible}>
<div className={styles.modalContainer}>
<div
className={cx(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cx should only be used in case any conditional style is present

minWidth: "360px",
alignSelf: "center",
border: `1px solid ${colors.gray.light}`,
borderRadius: "4px",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constants.borderRadius


export const buttonsContainer = css({
display: "flex",
justifyContent: "space-between",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mixins.flexSpaceBetween

@@ -17,3 +17,12 @@ storiesOf("Modal", module).add("simple", () => (
<div className={style} />
</Modal>
));

storiesOf("Modal", module).add("PopUp", () => (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

storiesOf("PopUp")

background: "white",
minWidth: "360px",
alignSelf: "center",
border: `1px solid ${colors.gray.light}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

don't see border in design.

src/components/styles/PopUp.styles.ts Show resolved Hide resolved
visible={true}
headingText="Are you sure?"
onApprove={() => {}}
onClose={() => {}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add action logger

<div className={styles.buttonsContainer}>
{onClose && (
<Button size="large" type="secondary" onClick={onClose}>
{closeButtonText || "No"}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can assign defaultProps above itself

import Modal from "./Modal";
import Button from "./Button";
import { mixins } from "../theme";
import * as styles from "./styles/PopUp.styles";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not actually styles but classNames. Returns a string. name might be confusing.

<PopUp
visible={true}
headingText="Are you sure?"
onApprove={action("click")}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onApprove={action("click")}
onApprove={action("onApprove")}

visible={true}
headingText="Are you sure?"
onApprove={action("click")}
onClose={action("click")}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
onClose={action("click")}
onClose={action("onClose")}

@ritz078 ritz078 changed the title Confirmation Modal as separate component PopUp Modal as separate component Oct 24, 2018
@ritz078 ritz078 merged commit feb4df0 into master Oct 24, 2018
@ritz078 ritz078 deleted the confirmationModal branch October 24, 2018 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants