@bytebrand/fe-ui-core 4.2.138 → 4.2.140
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/source/components/Vehicle/VehicleFormattedPrice/VehicleFormattedPrice.tsx +21 -12
- package/source/components/VehicleDetailedSidebar/partials/PriceContent.styl +2 -9
- package/source/components/VehicleDetailedSidebar/partials/PriceContent.tsx +3 -3
- package/source/locales/data.ts +2 -2
package/package.json
CHANGED
|
@@ -23,7 +23,7 @@ export interface IVehiclePriceProps {
|
|
|
23
23
|
size?: 'small' | 'semimedium' | 'medium' | 'large';
|
|
24
24
|
disableStyles?: boolean;
|
|
25
25
|
disablePrice?: boolean;
|
|
26
|
-
|
|
26
|
+
dynamicFontSize?: string;
|
|
27
27
|
|
|
28
28
|
// FormattedNumber props
|
|
29
29
|
toRound?: boolean;
|
|
@@ -38,12 +38,21 @@ const VehicleFormattedPrice: React.FunctionComponent<IVehiclePriceProps> = (prop
|
|
|
38
38
|
const textRef = useRef(null);
|
|
39
39
|
|
|
40
40
|
const updateFontSize = useCallback(() => {
|
|
41
|
-
if (price &&
|
|
41
|
+
if (price && dynamicFontSize && textRef.current) {
|
|
42
|
+
const textWidth = textRef.current.getBoundingClientRect().width;
|
|
42
43
|
const priceLength = Math.round(price).toString().length;
|
|
43
|
-
|
|
44
|
-
|
|
44
|
+
if (textWidth > 110) {
|
|
45
|
+
if (dynamicFontSize === 'small') {
|
|
46
|
+
const newSize = Math.min(60, 165 / priceLength);
|
|
47
|
+
textRef.current.style.fontSize = `${newSize}px`;
|
|
48
|
+
} else {
|
|
49
|
+
const newSize = Math.min(60, (165 / priceLength) + 6);
|
|
50
|
+
textRef.current.style.fontSize = `${newSize}px`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
}
|
|
45
54
|
}
|
|
46
|
-
}, [props.price, props.
|
|
55
|
+
}, [props.price, props.dynamicFontSize]);
|
|
47
56
|
|
|
48
57
|
useEffect(() => {
|
|
49
58
|
updateFontSize();
|
|
@@ -52,10 +61,10 @@ const VehicleFormattedPrice: React.FunctionComponent<IVehiclePriceProps> = (prop
|
|
|
52
61
|
function renderUnit(): React.ReactNode {
|
|
53
62
|
const { postfix, unit, unitClassName } = props;
|
|
54
63
|
return (
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
64
|
+
<span className={classnames(styles.unit, unitClassName)}>
|
|
65
|
+
{unit}
|
|
66
|
+
{postfix ? renderPostfix() : ''}
|
|
67
|
+
</span>);
|
|
59
68
|
}
|
|
60
69
|
|
|
61
70
|
function renderUnitMonthly(): React.ReactNode {
|
|
@@ -93,7 +102,7 @@ const VehicleFormattedPrice: React.FunctionComponent<IVehiclePriceProps> = (prop
|
|
|
93
102
|
// FormattedNumber props
|
|
94
103
|
const {
|
|
95
104
|
unit, sub, numbersAfterDot, toRound, numberContainerClassName,
|
|
96
|
-
afterCommaClassName, beforeCommaClassName, disableFormatting, disablePrice,
|
|
105
|
+
afterCommaClassName, beforeCommaClassName, disableFormatting, disablePrice, dynamicFontSize
|
|
97
106
|
} = props;
|
|
98
107
|
|
|
99
108
|
const decimalsClass = classnames(afterCommaClassName, styles.decimals);
|
|
@@ -109,7 +118,7 @@ const VehicleFormattedPrice: React.FunctionComponent<IVehiclePriceProps> = (prop
|
|
|
109
118
|
disableFormatting,
|
|
110
119
|
numbersAfterDot,
|
|
111
120
|
toRound,
|
|
112
|
-
|
|
121
|
+
dynamicFontSize,
|
|
113
122
|
beforeCommaClassName,
|
|
114
123
|
value: price,
|
|
115
124
|
className: numberContainerClassName,
|
|
@@ -141,7 +150,7 @@ VehicleFormattedPrice.defaultProps = {
|
|
|
141
150
|
unitClassName: '',
|
|
142
151
|
postfixClassName: '',
|
|
143
152
|
subClassName: '',
|
|
144
|
-
|
|
153
|
+
dynamicFontSize: '',
|
|
145
154
|
sub: '',
|
|
146
155
|
// FormattedNumber props
|
|
147
156
|
toRound: false,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
@import '../../../theme/mixins.styl';
|
|
2
2
|
|
|
3
3
|
.newFinancingPriceWrapper
|
|
4
|
-
width:
|
|
4
|
+
width: 159px
|
|
5
5
|
display: flex
|
|
6
6
|
align-items: flex-start;
|
|
7
7
|
color: $lightGreen;
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
font-size: 60px;
|
|
11
11
|
display flex;
|
|
12
12
|
line-height: .8;
|
|
13
|
-
margin 8px 0 0
|
|
13
|
+
margin 8px 0 0 10px;
|
|
14
14
|
[class^="VehicleFormattedPrice__decimals"], [class^="VehicleFormattedPrice__unit"]
|
|
15
15
|
font-size: 16px !important;
|
|
16
16
|
transform: none !important;
|
|
@@ -18,11 +18,9 @@
|
|
|
18
18
|
.tabContentPaddingForBuy
|
|
19
19
|
.newFinancingPriceWrapper
|
|
20
20
|
[class*="VehicleFormattedPrice__large"]
|
|
21
|
-
font-size: 40px;
|
|
22
21
|
margin-left: 0;
|
|
23
22
|
+media-phone-only()
|
|
24
23
|
[class*="VehicleFormattedPrice__large"]
|
|
25
|
-
font-size: 45px!important;
|
|
26
24
|
margin-left: 3px;
|
|
27
25
|
|
|
28
26
|
|
|
@@ -117,13 +115,8 @@
|
|
|
117
115
|
padding-right: 15px;
|
|
118
116
|
|
|
119
117
|
.priceFontSizeSmall
|
|
120
|
-
.financingPriceItem
|
|
121
|
-
display: block;
|
|
122
118
|
.priceInfoLabel
|
|
123
119
|
margin-top:8px!important
|
|
124
|
-
.wrapper
|
|
125
|
-
+media-tablet-landscape-up()
|
|
126
|
-
padding-right: 0px;
|
|
127
120
|
|
|
128
121
|
|
|
129
122
|
.tabContentPaddingForBuy.priceFontSizeSmall
|
|
@@ -46,7 +46,7 @@ const PriceContent: React.FunctionComponent<IPriceContentProps> = ({
|
|
|
46
46
|
isAdditionalOption: true,
|
|
47
47
|
onShowOfferDetails: offerBlockProps.onShowOfferDetails
|
|
48
48
|
};
|
|
49
|
-
const priceFontSize:string = monthlyInstallment ? (getFormattedPrice(monthlyInstallment)?.toString().match(/\d/g).length >= 4 ? 'small' :'large') :'';
|
|
49
|
+
const priceFontSize: string = monthlyInstallment ? (getFormattedPrice(monthlyInstallment)?.toString().match(/\d/g).length >= 4 ? 'small' : 'large') : '';
|
|
50
50
|
|
|
51
51
|
const tabContentPaddingClassName = classnames(
|
|
52
52
|
styles.tabContentPadding,
|
|
@@ -94,7 +94,7 @@ const PriceContent: React.FunctionComponent<IPriceContentProps> = ({
|
|
|
94
94
|
postfix={postfix}
|
|
95
95
|
numbersAfterDot={0}
|
|
96
96
|
size='large'
|
|
97
|
-
|
|
97
|
+
dynamicFontSize={tabContentPaddingClassName.includes('tabContentPaddingForBuy') ? 'large' : 'small'}
|
|
98
98
|
/>
|
|
99
99
|
</div>
|
|
100
100
|
) : null}
|
|
@@ -114,7 +114,7 @@ const PriceContent: React.FunctionComponent<IPriceContentProps> = ({
|
|
|
114
114
|
</span>
|
|
115
115
|
</div>
|
|
116
116
|
</div>
|
|
117
|
-
{offerBlockOpen && <OfferBlockComponent {...{ ...offerBlockProps, priceTabIndex: activeTab }} />
|
|
117
|
+
{offerBlockOpen && <OfferBlockComponent {...{ ...offerBlockProps, priceTabIndex: activeTab }} />}
|
|
118
118
|
<RequestOffer {...requestOfferProps} />
|
|
119
119
|
</>
|
|
120
120
|
);
|
package/source/locales/data.ts
CHANGED
|
@@ -56,7 +56,7 @@ export const vehicleProps = (car?: any, isOfferAvailable: boolean = true) => {
|
|
|
56
56
|
na: 'N/A',
|
|
57
57
|
priceSub: '/mtl.',
|
|
58
58
|
priceSubMtl: '/mtl.',
|
|
59
|
-
prefixOldPrice: '
|
|
59
|
+
prefixOldPrice: 'z.B.',
|
|
60
60
|
vehicleOwners: `${vehicleOption.vehicleOwners} Fahrzeughalter`,
|
|
61
61
|
vehicleOwners_plural: `${count} Fahrzeughalter`,
|
|
62
62
|
doorsOnly: `${vehicleOption.doorsOnly} Türen`,
|
|
@@ -164,7 +164,7 @@ export const vehicleProps = (car?: any, isOfferAvailable: boolean = true) => {
|
|
|
164
164
|
'firstRegistration': 'Erstzulassung',
|
|
165
165
|
'mileage': 'Kilometerstand',
|
|
166
166
|
'consumptionAndCo2': 'Kraftstoffverbrauch*',
|
|
167
|
-
'monthlyFrom': 'monatlich
|
|
167
|
+
'monthlyFrom': 'monatlich z.B.',
|
|
168
168
|
'buy': 'Kaufen',
|
|
169
169
|
'financingDescription': 'Bei der Finanzierung zahlen Sie lediglich die Zinsen des Darlehens und einen geringen Tilgungsanteil. Zum Vertragsende können Sie entscheiden, ob Sie den Restbetrag ablösen oder weiter finanzieren wollen.',
|
|
170
170
|
'leasingDescription': 'Beim Leasing zahlen Sie lediglich die Zinsen des Darlehens und einen geringen Tilgungsanteil. Zum Vertragsende geben Sie das Auto einfach wieder zurück.',
|