Web:Components:Styling SaveCancelButtons.

This commit is contained in:
Vlada Gazizova 2022-03-18 17:01:27 +03:00
parent 4bbc3e2b5e
commit 2c4601db70

View File

@ -1,8 +1,61 @@
import styled from "styled-components";
import styled, { css } from "styled-components";
import Base from "../themes/base";
import { tablet } from "../utils/device";
import { isMobile, isTablet } from "react-device-detect";
const displaySettings = css`
position: relative;
display: block;
flex-direction: column-reverse;
align-items: flex-start;
border-top: ${(props) =>
props.border && !props.showReminder ? "1px solid #ECEEF1" : "none"};
.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;
padding-top: 16px
font-size: 12px;
font-weight: 600;
}
${(props) =>
props.showReminder &&
props.border &&
css`
.unsaved-changes {
background-color: white;
border-top: 1px solid #eceef1;
width: 100%;
bottom: 56px;
padding-top: 16px;
}
`}
@media (orientation: landscape) {
display: flex;
.unsaved-changes {
font-size: 12px;
position: static;
padding-bottom: 16px;
}
}
`;
const staticButtons = `
position: static;
max-width: none;
@ -35,15 +88,12 @@ const StyledSaveCancelButtons = styled.div`
box-sizing: border-box;
align-items: center;
bottom: ${(props) => props.theme.saveCancelButtons.bottom};
width: ${(props) =>
props.displaySettings
? "calc(100% - 40px)"
: props.theme.saveCancelButtons.width};
width: ${(props) => props.theme.saveCancelButtons.width};
left: ${(props) =>
props.displaySettings ? "auto" : props.theme.saveCancelButtons.left};
padding: ${(props) =>
props.displaySettings
? "0px 0px 16px 0px"
? "16px 0px 0px 0px"
: props.theme.saveCancelButtons.padding};
.save-button {
@ -53,31 +103,7 @@ const StyledSaveCancelButtons = styled.div`
color: ${(props) => props.theme.saveCancelButtons.unsavedColor};
}
${(props) =>
props.displaySettings &&
`
flex-direction: column-reverse;
align-items: flex-start;
.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 {
margin-bottom: 12px;
font-size: 12px;
font-weight: 600;
}
`}
${(props) => props.displaySettings && displaySettings}
${(props) =>
props.displaySettings &&