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

create recognition component #170

Draft
wants to merge 26 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
a075aa3
added core value component
onkar-josh May 29, 2020
d464d21
added core value component
onkar-josh May 29, 2020
0dd6b98
created file for core values component
onkar-josh May 29, 2020
e6bd67c
added card component as core component
onkar-josh May 29, 2020
0d6aac5
exported card
onkar-josh May 29, 2020
9e13f8f
created card body
onkar-josh May 29, 2020
2903096
created card body component for create recognition
onkar-josh Jun 1, 2020
04b1c21
updated core values by updation in core value
onkar-josh Jun 1, 2020
8414ca9
updated styling of core value component
onkar-josh Jun 1, 2020
856667c
created recognitio card component
onkar-josh Jun 1, 2020
bc3fd30
created create recognition card header component
onkar-josh Jun 1, 2020
2f5df4b
created a panel to show user profile and create recognition button
onkar-josh Jun 1, 2020
e54c061
updated changes in card body
onkar-josh Jun 2, 2020
a251fae
updated core value component for styling
onkar-josh Jun 2, 2020
61ace43
updated create recognition by handling state
onkar-josh Jun 2, 2020
618ded7
updated create recognition card body
onkar-josh Jun 4, 2020
bdeb221
created core value text component
onkar-josh Jun 4, 2020
e2dc0be
updated create recognition by removing old structure
onkar-josh Jun 4, 2020
e9d61eb
updated core values
onkar-josh Jun 4, 2020
60bf3ac
updated core value component
onkar-josh Jun 4, 2020
73123b0
deleted left panel
onkar-josh Jun 4, 2020
3e6c72c
updated card body of create recognition by adding modal button inside it
onkar-josh Jun 4, 2020
f0ad077
created a component to show popup of comment
onkar-josh Jun 4, 2020
12b7d6e
added props
onkar-josh Jun 5, 2020
df9423e
added props for create recognition image component and comments
onkar-josh Jun 5, 2020
105ae5c
added a modal in core components
onkar-josh Jun 5, 2020
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
1 change: 1 addition & 0 deletions react-frontend/src/core-components/card/card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Card } from "react-bootstrap";
1 change: 1 addition & 0 deletions react-frontend/src/core-components/modal/ModalComponent.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Modal } from "react-bootstrap";
49 changes: 49 additions & 0 deletions react-frontend/src/create-recognition/AddRecognitionPopup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import React from "react";
import PropTypes from "prop-types";
import styled from "styled-components";

import Image from "shared-components/user-image-name/UserImageName";
import { Modal } from "core-components/modal/ModalComponent";
import { Button } from "core-components/button/ButtonComponent";

const Border = styled.fieldset`
border: 1px solid;
border-radius: 8px;
opacity: 1;
margin-left: 5%;
margin-right: 5%;
`;

const Legend = styled.legend`
width: auto;
margin-left: 10%;
font-size: 0.75em;
`;

const AddRecognition = ({ show, handleClose, recognitionToImage, comment }) => (
<Modal show={show} onHide={handleClose} centered={true} size="xl">
<Modal.Header closeButton />
<Image imageSrc={recognitionToImage} />
<Modal.Body>
<Border>
<Legend>Your Note</Legend>
{comment}
</Border>
</Modal.Body>
<Button variant="secondary" onClick={handleClose}>
Close
</Button>
<Button variant="primary" onClick={handleClose}>
Save Changes
</Button>
</Modal>
);

AddRecognition.propTypes = {
show: PropTypes.bool,
handleClose: PropTypes.func,
comment: PropTypes.string,
recognitionToImage: PropTypes.string,
};

export default AddRecognition;
12 changes: 12 additions & 0 deletions react-frontend/src/create-recognition/CreateRecognitionCard.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from "react";

import { Card } from "core-components/card/card";
import CardBody from "create-recognition/CreateRecognitionCardBody";

const CreateRecognitionCard = () => (
<Card>
<CardBody />
</Card>
);

export default CreateRecognitionCard;
107 changes: 107 additions & 0 deletions react-frontend/src/create-recognition/CreateRecognitionCardBody.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
import React from "react";
import { useState } from "react";
import styled from "styled-components";
import PropTypes from "prop-types";
import { ListGroup } from "react-bootstrap";

import ImageComponent from "core-components/image/ImageComponent";
import { Card } from "core-components/card/card";
import { Form } from "core-components/form/FormComponent";
import CoreValue from "create-recognition/coreValues";
import { Button } from "core-components/button/ButtonComponent";
import Image from "shared-components/user-image-name/UserImageName";
import AddRecognition from "create-recognition/AddRecognitionPopup";

const Wrapper = styled.section`
margin-left: 10%;
margin-right: 10%;
align-items: center;
`;
const WrapperForSelectValue = styled.section`
margin-left: 18%;
margin-right: 18%;
`;

const coreValues = [
{
id: 1,
coreValueName: "core Value Name 1",
},
{
id: 2,
coreValueName: "core Value Name 2",
},
{
id: 3,
coreValueName: "core Value Name 3",
},
{
id: 4,
coreValueName: "core Value Name 4",
},
];

const CreateRecognitionCardBody = ({
EmployeeName,
EmployeeImage,
Hi5Image,
recognitionToImage,
}) => {
const [comment, addComment] = useState(false);
const [show, setShow] = useState(false);
const handleClose = () => setShow(false);
const handleShow = () => setShow(true);
const onClickAddComment = () => {
addComment(true);
};
const addCommentText = (event) => {
addComment(event.target.value);
};
return (
<Card>
<WrapperForSelectValue>
<Image imageSrc={EmployeeImage} EmployeeName={EmployeeName}></Image>
<ImageComponent alt="Hi5Image" img={Hi5Image} src="" />
<div> Select Value </div>
</WrapperForSelectValue>
<Wrapper>
<ListGroup horizontal>
<CoreValue coreValues={coreValues} />
</ListGroup>
<div className="text-center">
{comment ? (
<Form.Control
as="textarea"
rows="3"
onChange={(event) => {
addCommentText(event);
}}
></Form.Control>
) : (
<Button onClick={onClickAddComment}> Add Comments </Button>
)}
</div>
<div className="text-center">
<Button onClick={handleShow}> Done </Button>
</div>
</Wrapper>
<AddRecognition
show={show}
handleClose={handleClose}
recognitionToImage={recognitionToImage}
EmployeeName={EmployeeName}
addComment={addComment}
/>
</Card>
);
};

CreateRecognitionCardBody.propTypes = {
EmployeeName: PropTypes.string,
EmployeeImage: PropTypes.string,
recognitionToImage: PropTypes.string,
comment: PropTypes.string,
Hi5Image: PropTypes.string,
};

export default CreateRecognitionCardBody;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import React from "react";

import { Card } from "core-components/card/card";

const CreateRecognitionCardHeader = () => <Card.Header> </Card.Header>;

export default CreateRecognitionCardHeader;
26 changes: 26 additions & 0 deletions react-frontend/src/create-recognition/coreValues.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import React from "react";
import PropTypes from "prop-types";

import CoreValue from "shared-components/core-value/coreValue";

const CoreValues = ({ coreValues, fontSize, backgroundColor }) =>
coreValues.map((coreValue, index) => (
<CoreValue
key={index}
coreValueName={coreValue.coreValueName}
fontSize={fontSize}
backgroundColor={backgroundColor}
/>
));

CoreValues.propTypes = {
coreValues: PropTypes.arrayOf(
PropTypes.shape({
coreValueName: PropTypes.string.isRequired,
fontSize: PropTypes.string,
backgroundColor: PropTypes.string,
})
),
};

export default CoreValues;
22 changes: 22 additions & 0 deletions react-frontend/src/shared-components/core-value/CoreValueText.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import React from "react";
import PropTypes from "prop-types";
import Styled from "styled-components";

const Wrapper = Styled.div`
font-size: ${({ fontSize }) => fontSize};
`;

const CoreValueComponent = ({ coreValueName, fontSize }) => {
return <Wrapper fontSize={fontSize}>{coreValueName}</Wrapper>;
};

CoreValueComponent.defaultProps = {
fontSize: "1em",
};

CoreValueComponent.propTypes = {
coreValueName: PropTypes.string.isRequired,
fontSize: PropTypes.string,
};

export default CoreValueComponent;
43 changes: 43 additions & 0 deletions react-frontend/src/shared-components/core-value/coreValue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import React from "react";
import PropTypes from "prop-types";
import Styled from "styled-components";

import CoreValueIcon from "shared-components/core-value-icon/coreValueIconComponent"; //todo: will work after core value addition
import CoreValueText from "shared-components/core-value/CoreValueText";

const Wrapper = Styled.div`
max-width: 70px;
min-height: 100px;
border-radius: 10px;
text-align: center;
background-color: ${({ backgroundColor }) => backgroundColor};
opacity: 1;
`;

const CoreValueComponent = ({ coreValueName, fontSize, backgroundColor }) => {
const onClick = () => {
// todo
};
return (
<Wrapper
className="m-auto"
onClick={onClick}
backgroundColor={backgroundColor}
>
<CoreValueIcon size="50" color="red" />
<CoreValueText coreValueName={coreValueName} fontSize={fontSize} />
</Wrapper>
);
};

CoreValueComponent.defaultProps = {
backgroundColor: "var(--rust)",
};

CoreValueComponent.propTypes = {
coreValueName: PropTypes.string.isRequired,
fontSize: PropTypes.string,
backgroundColor: PropTypes.string,
};

export default CoreValueComponent;