feat: attrs on product

This commit is contained in:
2024-05-11 00:24:52 +03:00
parent 004ad9a562
commit 270f96bf8d
10 changed files with 29 additions and 4 deletions

View File

@@ -8,12 +8,13 @@ type Props = {
attributes: BarcodeAttributeSchema[]
barcode?: string;
quantity: number;
additionalField?: string | null;
}
type Ref = HTMLDivElement;
const PrintBarcodeContainer = forwardRef<Ref, Props>(function PrintBarcodeContainer(props: Props, ref) {
const {attributes, barcode, quantity} = props;
const {attributes, barcode, quantity, additionalField} = props;
const MAX_ATTRIBUTES = 6;
const MAX_ATTRIBUTES = additionalField ? 5 : 6;
const MIN_BARCODE_SIZE = 30;
const MAX_BARCODE_SIZE = 100;
const STEP = (MAX_BARCODE_SIZE - MIN_BARCODE_SIZE) / MAX_ATTRIBUTES;
@@ -52,6 +53,14 @@ const PrintBarcodeContainer = forwardRef<Ref, Props>(function PrintBarcodeContai
{getAttributeText(attr)}
</Text>
))}
{props.additionalField && (
<Text
className={styles['barcode-attribute-text']}
size={"xs"}
>
{props.additionalField}
</Text>
)}
</Flex>
</>
))}

View File

@@ -9,6 +9,7 @@
.barcode-container {
max-height: 1.45in;
text-align: left;
margin: 1.25mm;
padding: 1.25mm;

View File

@@ -126,7 +126,7 @@ const PrintBarcodeModal = ({
quantity={quantity}
ref={barcodeRef}
attributes={barcodeData?.attributes || []}
additionalField={barcodeData?.additionalField}
/>
</>
)