소스 검색

Give the discount and tax fields room for the amount beside its unit (#460)

Bernt Christian Egeland 2 주 전
부모
커밋
ba71b5435d
1개의 변경된 파일과 7개의 추가작업 그리고 1개의 파일을 삭제
  1. 7 1
      src/features/vehicles/Components/service-edit/TotalsSection.tsx

+ 7 - 1
src/features/vehicles/Components/service-edit/TotalsSection.tsx

@@ -127,7 +127,13 @@ export function TotalsSection({
         aria-label={label}
         disabled={inert}
         onChange={(e) => onChange(e.target.value === '' ? 0 : Number(e.target.value))}
-        className="h-7 w-20 pr-7 text-right text-xs"
+        // Wide enough for a five-figure amount beside its unit. The room
+        // kept for the unit follows the unit's length: "%" is one character,
+        // "kr" is two and a currency code three, and a fixed inset left a
+        // discount in kroner with space for two digits. The browser's own
+        // step arrows are hidden, since the unit stands where they would.
+        className="h-7 w-28 text-right text-xs [appearance:textfield] [&::-webkit-inner-spin-button]:appearance-none [&::-webkit-outer-spin-button]:appearance-none"
+        style={{ paddingRight: `${1 + unit.length * 0.5}rem` }}
       />
       <span className="pointer-events-none absolute inset-y-0 right-2 flex items-center text-xs text-muted-foreground">
         {unit}