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

0% Statements 0/20
0% Branches 0/10
0% Functions 0/13
0% Lines 0/20

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 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155                                                                                                                                                                                                                                                                                                                     
import styled, { css } from "styled-components";
import { CardHeading } from "ui/cards/Card";
 
interface SettingRowProps {
  $indent?: number;
  $isCheckbox?: boolean;
}
 
interface SettingRowLabelProps {
  $sectionHeading?: boolean;
  $disabled?: boolean;
}
 
export const SettingRowLabel = styled.label<SettingRowLabelProps>`
  min-height: 28px;
  padding: 5px 0px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  flex-shrink: 0;
  font-size: ${(props) => props.theme.typography.fontSize};
  ${(props) =>
    props.$sectionHeading
      ? css`
          font-weight: bold;
        `
      : ""}
 
  ${(props) =>
    props.$disabled
      ? css`
          opacity: 0.5;
          text-decoration: line-through;
        `
      : ""}
 
  max-width: 300px;
  min-width: 150px;
  width: 50%;
  padding-right: 5px;
 
  @container (max-width: 300px) {
    min-height: 0px;
    width: 100%;
  }
`;
 
export const SettingRowInput = styled.div`
  width: 300px;
  min-height: 28px;
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-self: center;
 
  @container (max-width: 300px) {
    width: 100%;
    padding-bottom: 4px;
  }
`;
 
export const SettingRowUnits = styled.label`
  min-height: 28px;
  min-width: 30px;
  padding: 5px 0px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  margin-left: 10px;
  font-size: ${(props) => props.theme.typography.fontSize};
`;
 
export const SettingRow = styled.div<SettingRowProps>`
  position: relative;
  display: flex;
  padding-bottom: 3px;
  padding-top: 3px;
  border-bottom: 1px solid ${(props) => props.theme.colors.card.divider};
  align-items: flex-start;
  padding: 3px 5px;
  box-sizing: border-box;
  min-height: 34px;
 
  ${CardHeading} + & {
    border-top: 1px solid ${(props) => props.theme.colors.card.divider};
  }
 
  ${(props) =>
    props.$indent
      ? css`
          ${SettingRowLabel} {
            padding-left: ${props.$indent * 20}px;
          }
        `
      : ""}
 
  @container (max-width: 300px) {
    flex-direction: column;
    padding-top: 0px;
    min-height: 0;
 
    &&& ${SettingRowLabel} {
      padding-left: 0px;
    }
 
    ${(props) =>
      props.$indent
        ? css`
            &&& {
              padding-left: ${props.$indent * 24 + 10}px;
            }
          `
        : ""}
 
    ${(props) =>
      props.$isCheckbox
        ? css`
            &&& {
              flex-direction: row-reverse;
              justify-content: flex-end;
              align-items: center;
            }
            &&& ${SettingRowLabel} {
              padding-left: 5px;
            }
            &&& ${SettingRowInput} {
              padding-bottom: 0px;
            }
          `
        : ""}
  }
`;
 
export const SettingsSidebarContainer = styled.div`
  background: ${(props) => props.theme.colors.card.background};
  color: ${(props) => props.theme.colors.card.text};
  padding: 0px;
  border-top: 1px solid ${(props) => props.theme.colors.card.border};
  border-bottom: 1px solid ${(props) => props.theme.colors.card.border};
  width: 100%;
  box-sizing: border-box;
  container-type: inline-size;
 
  ${SettingRow} {
    padding-left: 10px;
    padding-right: 10px;
  }
 
  ${SettingRow}:last-child {
    border-bottom: 0;
  }
`;