All files / src/components/ui/form EditableText.tsx

0% Statements 0/12
100% Branches 0/0
0% Functions 0/9
0% Lines 0/12

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59                                                                                                                     
import styled from "styled-components";
 
export const EditableText = styled.input`
  color: ${(props) => props.theme.colors.text};
  border: 1px solid transparent;
  background: transparent;
  padding: 5px;
  font-size: 14px;
  height: 30px;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
  font-weight: bold;
 
  &:hover {
    background: rgba(128, 128, 128, 0.2);
  }
 
  &:focus {
    background: ${(props) => props.theme.colors.input.background};
    color: ${(props) => props.theme.colors.input.text};
    border: 1px solid ${(props) => props.theme.colors.highlight};
  }
`;
 
export const EditableTextOverlay = styled.div`
  position: relative;
  color: ${(props) => props.theme.colors.text};
  border: 1px solid transparent;
  background: ${(props) => props.theme.colors.sidebar.background};
  padding: 5px;
  font-size: 14px;
  height: 30px;
  line-height: 19px;
  border-radius: 4px;
  width: 100%;
  box-sizing: border-box;
  font-weight: bold;
  margin-top: -30px;
  pointer-events: none;
  display: block;
  align-items: center;
  z-index: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
 
  &:focus {
    background: ${(props) => props.theme.colors.input.background};
    color: ${(props) => props.theme.colors.input.text};
    border: 1px solid ${(props) => props.theme.colors.highlight};
  }
 
  ${EditableText}:hover ~ &,
  ${EditableText}:focus ~ & {
    opacity: 0;
  }
`;