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,
|
2024-06-27 00:40:53 +08:00
|
|
|
colorOffWhite,
|
2022-02-19 04:45:16 +08:00
|
|
|
} from '/imports/ui/stylesheets/styled-components/palette';
|
|
|
|
import {
|
|
|
|
borderSizeLarge,
|
|
|
|
lgPaddingX,
|
|
|
|
statusIconSize,
|
|
|
|
borderSize,
|
|
|
|
statusInfoHeight,
|
|
|
|
} from '/imports/ui/stylesheets/styled-components/general';
|
|
|
|
|
|
|
|
const DropdownButton = styled.button`
|
2024-06-27 00:40:53 +08:00
|
|
|
background-color: ${colorOffWhite};
|
2022-02-19 04:45:16 +08:00
|
|
|
border: none;
|
2024-06-27 00:40:53 +08:00
|
|
|
border-radius: 13px;
|
|
|
|
box-shadow: 0px 0px 2px rgba(0, 0, 0, 0.16),
|
|
|
|
0px 2px 3px rgba(0, 0, 0, 0.24),
|
|
|
|
0px 2px 6px rgba(0, 0, 0, 0.1);
|
|
|
|
color: #2d2d2d;
|
2022-02-19 04:45:16 +08:00
|
|
|
cursor: pointer;
|
2022-06-12 23:53:43 +08:00
|
|
|
padding: .3rem .5rem;
|
2024-06-06 03:29:24 +08:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
2022-06-12 23:53:43 +08:00
|
|
|
tab-index: 0;
|
2022-02-19 04:45:16 +08:00
|
|
|
|
2022-06-12 23:53:43 +08:00
|
|
|
&:hover {
|
2024-06-27 00:40:53 +08:00
|
|
|
background-color: ${colorGrayLightest};
|
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;
|
2024-06-27 00:40:53 +08:00
|
|
|
left: 2px;
|
|
|
|
top: 2px;
|
2022-02-19 04:45:16 +08:00
|
|
|
z-index: 999;
|
|
|
|
|
2022-10-27 21:15:09 +08:00
|
|
|
> div {
|
|
|
|
width: 50px;
|
2024-06-27 00:40:53 +08:00
|
|
|
height: 40px;
|
2024-06-06 03:29:24 +08:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
2022-10-27 21:15:09 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
button {
|
2023-02-10 21:05:34 +08:00
|
|
|
height: 100%;
|
|
|
|
width: 100%;
|
2024-06-06 03:29:24 +08:00
|
|
|
display: flex;
|
|
|
|
align-items: center;
|
|
|
|
justify-content: center;
|
2022-10-27 21:15:09 +08:00
|
|
|
}
|
|
|
|
|
2022-02-19 04:45:16 +08:00
|
|
|
[dir="rtl"] & {
|
2024-06-27 00:40:53 +08:00
|
|
|
right: 2px;
|
2023-08-12 04:10:16 +08:00
|
|
|
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,
|
|
|
|
};
|