2020-07-31 08:35:14 +00:00
|
|
|
import React from 'react';
|
|
|
|
import styled from 'styled-components';
|
2020-08-06 07:00:41 +00:00
|
|
|
import PropTypes from "prop-types";
|
|
|
|
import Button from "../button";
|
|
|
|
import Text from "../text";
|
|
|
|
import { tablet } from '../../utils/device'
|
2020-08-02 06:38:59 +00:00
|
|
|
|
2020-08-06 07:00:41 +00:00
|
|
|
const StyledSaveCancelButtons = styled.div`
|
2020-07-31 08:35:14 +00:00
|
|
|
position:absolute;
|
|
|
|
bottom:0;
|
|
|
|
width:100%;
|
|
|
|
display:flex;
|
|
|
|
left: 0;
|
|
|
|
padding: 8px 24px 8px 16px;
|
|
|
|
justify-content: space-between;
|
|
|
|
box-sizing: border-box;
|
|
|
|
align-items: center;
|
|
|
|
|
|
|
|
.save-button{
|
|
|
|
margin-right: 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.unsaved-changes{
|
|
|
|
color:#A3A9AE;
|
|
|
|
}
|
2020-08-02 06:38:59 +00:00
|
|
|
|
|
|
|
@media ${tablet} {
|
|
|
|
justify-content:flex-end;
|
|
|
|
|
|
|
|
.unsaved-changes{
|
|
|
|
display:none;
|
|
|
|
}
|
|
|
|
}
|
2020-07-31 08:35:14 +00:00
|
|
|
`;
|
|
|
|
|
2020-08-06 07:00:41 +00:00
|
|
|
class SaveCancelButtons extends React.Component{
|
2020-07-31 08:35:14 +00:00
|
|
|
|
|
|
|
render(){
|
2020-08-06 07:50:04 +00:00
|
|
|
const { onSaveClick, onCancelClick, showReminder, reminderTest, saveButtonLabel, cancelButtonLabel } = this.props
|
2020-07-31 08:35:14 +00:00
|
|
|
return(
|
2020-08-06 07:00:41 +00:00
|
|
|
<StyledSaveCancelButtons>
|
2020-07-31 08:35:14 +00:00
|
|
|
<div>
|
|
|
|
<Button
|
|
|
|
className="save-button"
|
|
|
|
size="big"
|
|
|
|
isDisabled={false}
|
|
|
|
primary
|
|
|
|
onClick={onSaveClick}
|
2020-08-06 07:50:04 +00:00
|
|
|
label={saveButtonLabel}
|
2020-07-31 08:35:14 +00:00
|
|
|
/>
|
|
|
|
<Button
|
|
|
|
size="big"
|
|
|
|
isDisabled={false}
|
2020-08-02 04:54:44 +00:00
|
|
|
onClick={onCancelClick}
|
2020-08-06 07:50:04 +00:00
|
|
|
label={cancelButtonLabel}
|
2020-07-31 08:35:14 +00:00
|
|
|
/>
|
|
|
|
</div>
|
2020-08-06 07:00:41 +00:00
|
|
|
{showReminder && <Text className="unsaved-changes"> {reminderTest} </Text>}
|
|
|
|
</StyledSaveCancelButtons>
|
2020-07-31 08:35:14 +00:00
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-08-06 07:00:41 +00:00
|
|
|
SaveCancelButtons.propTypes = {
|
|
|
|
reminderTest: PropTypes.string,
|
2020-08-06 07:50:04 +00:00
|
|
|
saveButtonLabel: PropTypes.string,
|
|
|
|
cancelButtonLabel: PropTypes.string,
|
2020-08-06 07:00:41 +00:00
|
|
|
onSaveClick: PropTypes.func,
|
|
|
|
onCancelClick: PropTypes.func,
|
|
|
|
showReminder: PropTypes.bool
|
|
|
|
};
|
|
|
|
|
2020-08-06 07:50:04 +00:00
|
|
|
|
|
|
|
SaveCancelButtons.defaultProps = {
|
|
|
|
saveButtonLabel: "Save",
|
|
|
|
cancelButtonLabel: "Cancel"
|
|
|
|
}
|
|
|
|
|
2020-08-06 07:00:41 +00:00
|
|
|
export default SaveCancelButtons
|