DocSpace-buildtools/packages/components/selected-item/styled-selected-item.js

56 lines
1.2 KiB
JavaScript
Raw Normal View History

2023-06-13 07:29:01 +00:00
import React from "react";
import { Base } from "@docspace/components/themes";
import styled, { css } from "styled-components";
import NoUserSelect from "@docspace/components/utils/commonStyles";
const StyledSelectedItem = styled.div`
2023-06-13 07:29:01 +00:00
width: ${(props) => (props.isInline ? "fit-content" : "100%")};
height: 32px;
display: inline-flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
2023-06-13 07:29:01 +00:00
border-radius: 3px;
2023-06-13 07:29:01 +00:00
padding: 6px 8px;
2023-06-13 07:29:01 +00:00
margin-right: 4px;
margin-bottom: 4px;
2023-06-13 07:29:01 +00:00
background: ${(props) => props.theme.filterInput.selectedItems.background};
${(props) =>
!props.isDisabled &&
css`
:hover {
background: ${(props) =>
props.theme.filterInput.selectedItems.hoverBackground};
}
`}
`;
const StyledLabel = styled.div`
line-height: 20px;
margin-right: 10px;
max-width: 23ch;
color: ${(props) => props.isDisabled && props.theme.text.disableColor};
${() => NoUserSelect}
${(props) =>
props.truncate &&
css`
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
`}
`;
2023-06-13 07:29:01 +00:00
StyledSelectedItem.defaultProps = { theme: Base };
export { StyledSelectedItem, StyledLabel };