2022-03-18 14:01:27 +00:00
|
|
|
import styled, { css } from "styled-components";
|
2021-02-25 21:19:45 +00:00
|
|
|
import Base from "../themes/base";
|
2022-03-16 14:20:46 +00:00
|
|
|
import { tablet } from "../utils/device";
|
2022-03-24 17:47:22 +00:00
|
|
|
import { isMobileOnly, isTablet } from "react-device-detect";
|
2021-02-08 08:04:27 +00:00
|
|
|
|
2022-03-18 14:01:27 +00:00
|
|
|
const displaySettings = css`
|
2022-03-24 17:47:22 +00:00
|
|
|
position: absolute;
|
2022-03-18 14:01:27 +00:00
|
|
|
display: block;
|
|
|
|
flex-direction: column-reverse;
|
|
|
|
align-items: flex-start;
|
|
|
|
border-top: ${(props) =>
|
2022-03-22 10:42:52 +00:00
|
|
|
props.hasScroll && !props.showReminder ? "1px solid #ECEEF1" : "none"};
|
2022-03-18 14:01:27 +00:00
|
|
|
|
2022-03-24 17:47:22 +00:00
|
|
|
${(props) =>
|
|
|
|
!props.hasScroll &&
|
|
|
|
!isMobileOnly &&
|
|
|
|
css`
|
|
|
|
padding-left: 24px;
|
|
|
|
`}
|
|
|
|
|
|
|
|
${(props) =>
|
|
|
|
props.hasScroll &&
|
|
|
|
css`
|
|
|
|
bottom: auto;
|
|
|
|
`}
|
|
|
|
|
2022-03-18 14:01:27 +00:00
|
|
|
.buttons-flex {
|
|
|
|
display: flex;
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
.save-button,
|
|
|
|
.cancel-button {
|
|
|
|
width: 100%;
|
|
|
|
height: auto;
|
|
|
|
line-height: 16px;
|
|
|
|
padding-top: 11px;
|
|
|
|
padding-bottom: 11px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.unsaved-changes {
|
|
|
|
position: absolute;
|
2022-03-22 10:42:52 +00:00
|
|
|
padding-top: 16px;
|
2022-03-24 17:47:22 +00:00
|
|
|
padding-bottom: 16px;
|
2022-03-18 14:01:27 +00:00
|
|
|
font-size: 12px;
|
|
|
|
font-weight: 600;
|
2022-03-23 19:10:01 +00:00
|
|
|
width: calc(100% - 32px);
|
2022-03-22 10:42:52 +00:00
|
|
|
bottom: 56px;
|
2022-03-25 08:06:57 +00:00
|
|
|
background-color: ${(props) =>
|
|
|
|
props.hasScroll
|
|
|
|
? props.theme.mainButtonMobile.buttonWrapper.background
|
|
|
|
: "none"};
|
2022-03-18 14:01:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
${(props) =>
|
|
|
|
props.showReminder &&
|
2022-03-22 10:42:52 +00:00
|
|
|
props.hasScroll &&
|
2022-03-18 14:01:27 +00:00
|
|
|
css`
|
|
|
|
.unsaved-changes {
|
|
|
|
border-top: 1px solid #eceef1;
|
2022-03-23 19:10:01 +00:00
|
|
|
width: calc(100% - 16px);
|
2022-03-22 18:18:11 +00:00
|
|
|
left: 0px;
|
|
|
|
padding-left: 16px;
|
2022-03-18 14:01:27 +00:00
|
|
|
}
|
|
|
|
`}
|
|
|
|
`;
|
|
|
|
|
2022-03-23 19:10:01 +00:00
|
|
|
const tabletButtons = css`
|
2022-03-16 14:20:46 +00:00
|
|
|
position: static;
|
2022-03-22 10:42:52 +00:00
|
|
|
display: flex;
|
2022-03-16 14:20:46 +00:00
|
|
|
max-width: none;
|
|
|
|
flex-direction: row;
|
|
|
|
justify-content: flex-start;
|
|
|
|
align-items: center;
|
2022-03-23 19:10:01 +00:00
|
|
|
padding: 0;
|
2022-03-24 17:47:22 +00:00
|
|
|
border-top: none;
|
2022-03-23 19:10:01 +00:00
|
|
|
|
2022-03-16 14:20:46 +00:00
|
|
|
.buttons-flex {
|
|
|
|
width: auto;
|
|
|
|
}
|
|
|
|
|
|
|
|
.save-button,
|
|
|
|
.cancel-button {
|
2022-04-08 13:32:33 +00:00
|
|
|
width: auto;
|
2022-03-16 14:20:46 +00:00
|
|
|
padding-left: 28px;
|
|
|
|
padding-right: 28px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.unsaved-changes {
|
2022-03-22 10:42:52 +00:00
|
|
|
border-top: none;
|
2022-03-16 14:20:46 +00:00
|
|
|
margin-left: 8px;
|
|
|
|
margin-bottom: 0;
|
2022-03-22 10:42:52 +00:00
|
|
|
position: static;
|
2022-03-24 17:47:22 +00:00
|
|
|
padding: 0;
|
2022-03-16 14:20:46 +00:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2021-02-08 08:04:27 +00:00
|
|
|
const StyledSaveCancelButtons = styled.div`
|
|
|
|
display: flex;
|
2022-03-10 11:46:55 +00:00
|
|
|
position: absolute;
|
2021-02-08 08:04:27 +00:00
|
|
|
justify-content: space-between;
|
|
|
|
box-sizing: border-box;
|
|
|
|
align-items: center;
|
|
|
|
bottom: ${(props) => props.theme.saveCancelButtons.bottom};
|
2022-03-18 14:01:27 +00:00
|
|
|
width: ${(props) => props.theme.saveCancelButtons.width};
|
2022-03-24 17:47:22 +00:00
|
|
|
left: ${(props) => props.theme.saveCancelButtons.left};
|
2022-02-10 14:07:50 +00:00
|
|
|
padding: ${(props) =>
|
2022-03-24 17:47:22 +00:00
|
|
|
props.displaySettings ? "16px" : props.theme.saveCancelButtons.padding};
|
2021-02-08 08:04:27 +00:00
|
|
|
|
|
|
|
.save-button {
|
|
|
|
margin-right: ${(props) => props.theme.saveCancelButtons.marginRight};
|
|
|
|
}
|
|
|
|
.unsaved-changes {
|
|
|
|
color: ${(props) => props.theme.saveCancelButtons.unsavedColor};
|
|
|
|
}
|
|
|
|
|
2022-03-18 14:01:27 +00:00
|
|
|
${(props) => props.displaySettings && displaySettings}
|
2022-02-10 14:07:50 +00:00
|
|
|
|
2022-03-23 19:10:01 +00:00
|
|
|
@media (min-width: 600px), isTablet {
|
|
|
|
${(props) =>
|
|
|
|
props.displaySettings &&
|
|
|
|
`
|
|
|
|
${tabletButtons}
|
|
|
|
`}
|
2022-03-22 18:18:11 +00:00
|
|
|
}
|
|
|
|
|
2022-03-10 11:46:55 +00:00
|
|
|
@media ${tablet} {
|
|
|
|
${(props) =>
|
|
|
|
!props.displaySettings &&
|
|
|
|
`
|
2022-03-16 14:20:46 +00:00
|
|
|
justify-content: flex-end;
|
|
|
|
position: fixed;
|
2022-03-10 11:46:55 +00:00
|
|
|
|
2022-03-16 14:20:46 +00:00
|
|
|
.unsaved-changes {
|
|
|
|
display: none;
|
|
|
|
}
|
2022-02-13 16:33:20 +00:00
|
|
|
`}
|
2022-03-10 11:46:55 +00:00
|
|
|
}
|
2022-03-16 08:18:56 +00:00
|
|
|
|
2022-03-23 19:10:01 +00:00
|
|
|
@media (min-width: 1024px) {
|
|
|
|
${(props) =>
|
|
|
|
props.displaySettings &&
|
|
|
|
!isTablet &&
|
|
|
|
`
|
2022-03-16 14:20:46 +00:00
|
|
|
.save-button, .cancel-button {
|
|
|
|
font-size: 13px;
|
|
|
|
line-height: 20px;
|
|
|
|
padding-top: 5px;
|
|
|
|
padding-bottom: 5px;
|
|
|
|
}
|
2022-03-22 10:42:52 +00:00
|
|
|
|
2022-03-16 14:20:46 +00:00
|
|
|
`}
|
2022-03-23 19:10:01 +00:00
|
|
|
}
|
2021-02-08 08:04:27 +00:00
|
|
|
`;
|
|
|
|
StyledSaveCancelButtons.defaultProps = { theme: Base };
|
|
|
|
export default StyledSaveCancelButtons;
|