feat: attrs on product
This commit is contained in:
@@ -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>
|
||||
</>
|
||||
))}
|
||||
|
||||
Reference in New Issue
Block a user