2022-02-19 04:45:16 +08:00
|
|
|
import styled, { css, keyframes } from 'styled-components';
|
|
|
|
import Icon from '/imports/ui/components/common/icon/component';
|
|
|
|
import { headingsFontWeight } from '/imports/ui/stylesheets/styled-components/typography';
|
|
|
|
import {
|
|
|
|
colorDanger,
|
|
|
|
colorGray,
|
|
|
|
colorGrayDark,
|
|
|
|
colorSuccess,
|
|
|
|
colorGrayLightest,
|
2022-10-27 21:15:09 +08:00
|
|
|
colorWhite,
|
2022-02-19 04:45:16 +08:00
|
|
|
} from '/imports/ui/stylesheets/styled-components/palette';
|
|
|
|
import {
|
|
|
|
borderSizeLarge,
|
|
|
|
lgPaddingX,
|
|
|
|
statusIconSize,
|
|
|
|
borderSize,
|
|
|
|
statusInfoHeight,
|
2023-02-10 21:37:29 +08:00
|
|
|
presentationMenuHeight,
|
2022-02-19 04:45:16 +08:00
|
|
|
} from '/imports/ui/stylesheets/styled-components/general';
|
|
|
|
|
|
|
|
const DropdownButton = styled.button`
|
2022-06-12 23:53:43 +08:00
|
|
|
background-color: #FFF;
|
2022-02-19 04:45:16 +08:00
|
|
|
border: none;
|
2022-06-12 23:53:43 +08:00
|
|
|
border-radius: 7px;
|
2022-02-19 04:45:16 +08:00
|
|
|
color: ${colorGrayDark};
|
|
|
|
cursor: pointer;
|
2022-06-12 23:53:43 +08:00
|
|
|
padding: .3rem .5rem;
|
|
|
|
padding-bottom: 6px;
|
|
|
|
tab-index: 0;
|
2022-02-19 04:45:16 +08:00
|
|
|
|
2022-06-12 23:53:43 +08:00
|
|
|
&:hover {
|
|
|
|
background-color: #ececec;
|
2022-02-19 04:45:16 +08:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
2023-08-12 04:10:16 +08:00
|
|
|
const Left = styled.div`
|
2022-02-19 04:45:16 +08:00
|
|
|
cursor: pointer;
|
|
|
|
position: absolute;
|
2023-08-12 04:10:16 +08:00
|
|
|
left: 0px;
|
2022-02-19 04:45:16 +08:00
|
|
|
z-index: 999;
|
2023-02-10 21:05:34 +08:00
|
|
|
box-shadow: 0 4px 2px -2px rgba(0, 0, 0, 0.05);
|
|
|
|
border-bottom: 1px solid ${colorWhite};
|
2023-02-14 11:28:36 +08:00
|
|
|
height: 44px;
|
2022-02-19 04:45:16 +08:00
|
|
|
|
2022-10-27 21:15:09 +08:00
|
|
|
> div {
|
2023-02-10 21:05:34 +08:00
|
|
|
padding: 2px 4px 2px 4px;
|
2022-10-27 21:15:09 +08:00
|
|
|
background-color: ${colorWhite};
|
|
|
|
width: 50px;
|
2023-02-10 21:05:34 +08:00
|
|
|
height: 100%;
|
2022-10-27 21:15:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
button {
|
2023-02-10 21:05:34 +08:00
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
2022-10-27 21:15:09 +08:00
|
|
|
}
|
|
|
|
|
2022-02-19 04:45:16 +08:00
|
|
|
[dir="rtl"] & {
|
2023-08-12 04:10:16 +08:00
|
|
|
right: 0px;
|
|
|
|
left: auto;
|
2022-02-19 04:45:16 +08:00
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const ToastText = styled.span`
|
|
|
|
overflow: hidden;
|
|
|
|
text-overflow: ellipsis;
|
|
|
|
text-align: left;
|
|
|
|
white-space: nowrap;
|
|
|
|
position: relative;
|
|
|
|
top: ${borderSizeLarge};
|
|
|
|
width: auto;
|
|
|
|
font-weight: ${headingsFontWeight};
|
|
|
|
|
|
|
|
[dir="rtl"] & {
|
|
|
|
text-align: right;
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const StatusIcon = styled.span`
|
|
|
|
margin-left: auto;
|
|
|
|
|
|
|
|
[dir="rtl"] & {
|
|
|
|
margin-right: auto;
|
|
|
|
margin-left: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
& > i {
|
|
|
|
position: relative;
|
|
|
|
top: 1px;
|
|
|
|
height: ${statusIconSize};
|
|
|
|
width: ${statusIconSize};
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const rotate = keyframes`
|
|
|
|
0% { transform: rotate(0); }
|
|
|
|
100% { transform: rotate(360deg); }
|
|
|
|
`;
|
|
|
|
|
|
|
|
const ToastIcon = styled(Icon)`
|
|
|
|
position: relative;
|
|
|
|
width: ${statusIconSize};
|
|
|
|
height: ${statusIconSize};
|
|
|
|
font-size: 117%;
|
|
|
|
bottom: ${borderSize};
|
|
|
|
left: ${statusInfoHeight};
|
|
|
|
|
|
|
|
[dir="rtl"] & {
|
|
|
|
left: auto;
|
|
|
|
right: ${statusInfoHeight};
|
|
|
|
}
|
|
|
|
|
|
|
|
${({ done }) => done && `
|
|
|
|
color: ${colorSuccess};
|
|
|
|
`}
|
|
|
|
|
|
|
|
${({ error }) => error && `
|
|
|
|
color: ${colorDanger};
|
|
|
|
`}
|
|
|
|
|
|
|
|
${({ loading }) => loading && css`
|
|
|
|
color: ${colorGrayLightest};
|
|
|
|
border: 1px solid;
|
|
|
|
border-radius: 50%;
|
|
|
|
border-right-color: ${colorGray};
|
|
|
|
animation: ${rotate} 1s linear infinite;
|
|
|
|
`}
|
|
|
|
`;
|
|
|
|
|
|
|
|
const Line = styled.div`
|
|
|
|
display: flex;
|
|
|
|
width: 100%;
|
|
|
|
flex-wrap: nowrap;
|
|
|
|
padding: ${lgPaddingX} 0;
|
|
|
|
`;
|
|
|
|
|
|
|
|
const ButtonIcon = styled(Icon)`
|
|
|
|
width: 1em;
|
|
|
|
text-align: center;
|
|
|
|
`;
|
|
|
|
|
|
|
|
export default {
|
|
|
|
DropdownButton,
|
2023-08-12 04:10:16 +08:00
|
|
|
Left,
|
2022-02-19 04:45:16 +08:00
|
|
|
ToastText,
|
|
|
|
StatusIcon,
|
|
|
|
ToastIcon,
|
|
|
|
Line,
|
|
|
|
ButtonIcon,
|
|
|
|
};
|