@bytebrand/fe-ui-core-autobahn 1.0.227 → 1.0.228
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/campaign/CampaignBand.tsx +26 -26
- package/campaign/campaignVars.ts +12 -12
- package/campaign/campaigns.ts +74 -74
- package/campaign/index.ts +6 -18
- package/cards/CarCard.tsx +393 -369
- package/cards/CarRow.tsx +21 -41
- package/cards/cardParts.tsx +23 -48
- package/cards/dealSignals.ts +36 -36
- package/cards/index.ts +0 -6
- package/chrome/Footer.tsx +3 -16
- package/chrome/TopBar.tsx +266 -139
- package/compat/CookieModal/CookieModal.tsx +6 -20
- package/compat/CookieModal/Modal.tsx +3 -6
- package/compat/CookieModal/modals/ManageCookieModal/ManageCookieModal.tsx +15 -43
- package/compat/CookieModal/modals/PreviewCookieModal/PreviewCookieModal.tsx +3 -4
- package/compat/CookieModal/useModal.ts +1 -5
- package/compat/Loader/Loader.tsx +7 -1
- package/compat/MdField/MdField.tsx +4 -28
- package/compat/PriceRating/PriceRating.styl +7 -5
- package/compat/PriceRatingDetailed/PriceRatingDetailed.styl +6 -8
- package/compat/TimePicker/TimePicker.tsx +2 -12
- package/compat/legacy-theme/priceReviewColors.styl +5 -18
- package/constants/app.ts +11 -1
- package/constants/autobahn.ts +0 -39
- package/constants/core.ts +12 -1
- package/data/fieldMapping.ts +3 -3
- package/data/toAutobahnCar.ts +14 -30
- package/iconsvg/IconSVG.tsx +5 -1
- package/index.ts +19 -19
- package/locales/de/autobahn.json +862 -926
- package/locales/en/autobahn.json +862 -926
- package/package.json +2 -2
- package/theme/md3.css +11808 -16516
- package/ui/Dropdown.tsx +10 -29
- package/ui/FormCheckbox.tsx +2 -22
- package/ui/FormField.tsx +1 -2
- package/ui/Icon.tsx +0 -6
- package/ui/Modal.tsx +6 -84
- package/ui/Skeleton.tsx +20 -79
- package/ui/Stars.tsx +18 -36
- package/ui/StatChip.tsx +3 -8
- package/ui/index.ts +0 -3
- package/ui/usePortalMenuPosition.ts +15 -27
- package/utils/index.ts +0 -10
- package/vdp/FinanceCalculator.tsx +34 -162
- package/vdp/VdpModules.tsx +976 -348
- package/vdp/index.ts +3 -6
- package/vdp/types.ts +15 -25
- package/vehiclesProps/decoratedLightProps.tsx +0 -4
- package/vehiclesProps/decoratedProps.tsx +0 -4
- package/campaign/CampaignBanner.tsx +0 -86
- package/campaign/CampaignBar.tsx +0 -37
- package/campaign/CampaignHero.tsx +0 -50
- package/campaign/CampaignSwitch.tsx +0 -43
- package/campaign/openInApp.ts +0 -8
- package/campaign/useCountdown.ts +0 -28
- package/cards/CarCardSkeleton.tsx +0 -103
- package/cards/CarRowSkeleton.tsx +0 -152
- package/chrome/AccountMenuIcon.tsx +0 -109
- package/ui/MfieldCheckIcon.tsx +0 -13
- package/ui/ratingLink.ts +0 -36
- package/ui/scrollFieldIntoView.ts +0 -41
- package/utils/cookieConsent.ts +0 -84
- package/vehiclesProps/accidentDisclosure.ts +0 -25
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
// Autobahn (auto.de redesign) — the campaign band on top of a car card or the vehicle page's gallery
|
|
2
|
-
// (see campaigns.ts).
|
|
3
|
-
//
|
|
4
|
-
// Looks only: the colours come from the campaign as CSS variables, the size and the type from md3.css
|
|
5
|
-
// (.campaign-band). Renders correctly only inside a `<div className="md3">` subtree.
|
|
6
|
-
|
|
7
|
-
import React from 'react';
|
|
8
|
-
import { TranslationFunction } from '../types';
|
|
9
|
-
|
|
10
|
-
import { Icon } from '../ui';
|
|
11
|
-
import { Campaign } from './campaigns';
|
|
12
|
-
import { campaignVars } from './campaignVars';
|
|
13
|
-
|
|
14
|
-
export interface CampaignBandProps {
|
|
15
|
-
campaign: Campaign;
|
|
16
|
-
t: TranslationFunction;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const CampaignBand: React.FunctionComponent<CampaignBandProps> = ({ campaign, t }) => (
|
|
20
|
-
<div className={'campaign-band campaign-band--' + campaign.id} style={campaignVars(campaign)}>
|
|
21
|
-
{campaign.icon && <Icon name={campaign.icon} size={15} stroke={2.2} />}
|
|
22
|
-
<span className="campaign-band-label">{t(campaign.texts + '.label')}</span>
|
|
23
|
-
</div>
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
export default CampaignBand;
|
|
1
|
+
// Autobahn (auto.de redesign) — the campaign band on top of a car card or the vehicle page's gallery
|
|
2
|
+
// (see campaigns.ts).
|
|
3
|
+
//
|
|
4
|
+
// Looks only: the colours come from the campaign as CSS variables, the size and the type from md3.css
|
|
5
|
+
// (.campaign-band). Renders correctly only inside a `<div className="md3">` subtree.
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { TranslationFunction } from '../types';
|
|
9
|
+
|
|
10
|
+
import { Icon } from '../ui';
|
|
11
|
+
import { Campaign } from './campaigns';
|
|
12
|
+
import { campaignVars } from './campaignVars';
|
|
13
|
+
|
|
14
|
+
export interface CampaignBandProps {
|
|
15
|
+
campaign: Campaign;
|
|
16
|
+
t: TranslationFunction;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const CampaignBand: React.FunctionComponent<CampaignBandProps> = ({ campaign, t }) => (
|
|
20
|
+
<div className={'campaign-band campaign-band--' + campaign.id} style={campaignVars(campaign)}>
|
|
21
|
+
{campaign.icon && <Icon name={campaign.icon} size={15} stroke={2.2} />}
|
|
22
|
+
<span className="campaign-band-label">{t(campaign.texts + '.label')}</span>
|
|
23
|
+
</div>
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
export default CampaignBand;
|
package/campaign/campaignVars.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type React from 'react';
|
|
2
|
-
import { Campaign } from './campaigns';
|
|
3
|
-
|
|
4
|
-
/** .mcard--campaign uses the campaign's background as one of several layers, and only the last layer may be a
|
|
5
|
-
* plain colour — so a colour becomes a one-colour gradient. */
|
|
6
|
-
const asImage = (background: string): string =>
|
|
7
|
-
/gradient\(|url\(/.test(background) ? background : `linear-gradient(${background} 0 0)`;
|
|
8
|
-
|
|
9
|
-
/** A campaign's colours as CSS variables (md3.css: .campaign-band, .campaign-hero). A card sets them too (with
|
|
10
|
-
* .mcard--campaign), so that its border takes the band's colour and the band reaches the edge of the card. */
|
|
11
|
-
export const campaignVars = (campaign: Campaign): React.CSSProperties =>
|
|
12
|
-
({ '--campaign-bg': asImage(campaign.background), '--campaign-fg': campaign.color || '#fff' } as React.CSSProperties);
|
|
1
|
+
import type React from 'react';
|
|
2
|
+
import { Campaign } from './campaigns';
|
|
3
|
+
|
|
4
|
+
/** .mcard--campaign uses the campaign's background as one of several layers, and only the last layer may be a
|
|
5
|
+
* plain colour — so a colour becomes a one-colour gradient. */
|
|
6
|
+
const asImage = (background: string): string =>
|
|
7
|
+
/gradient\(|url\(/.test(background) ? background : `linear-gradient(${background} 0 0)`;
|
|
8
|
+
|
|
9
|
+
/** A campaign's colours as CSS variables (md3.css: .campaign-band, .campaign-hero). A card sets them too (with
|
|
10
|
+
* .mcard--campaign), so that its border takes the band's colour and the band reaches the edge of the card. */
|
|
11
|
+
export const campaignVars = (campaign: Campaign): React.CSSProperties =>
|
|
12
|
+
({ '--campaign-bg': asImage(campaign.background), '--campaign-fg': campaign.color || '#fff' } as React.CSSProperties);
|
package/campaign/campaigns.ts
CHANGED
|
@@ -1,74 +1,74 @@
|
|
|
1
|
-
// Autobahn (auto.de redesign) — campaigns ("Black Friday"): the band on top of the car cards and of the
|
|
2
|
-
// vehicle page's gallery (CampaignBand), the hero with the countdown (CampaignHero), the switch "only its cars"
|
|
3
|
-
// (CampaignSwitch), the bar under the site header (CampaignBar) and the banner with cars (CampaignBanner).
|
|
4
|
-
//
|
|
5
|
-
// A campaign is data; the cards and the hero do not know any campaign by name. Which campaign runs is the
|
|
6
|
-
// app's decision (fe-main: source/framework/constants/campaign.ts); without one nothing is shown.
|
|
7
|
-
//
|
|
8
|
-
// A new campaign (e.g. New Year) = one entry in CAMPAIGNS + its texts under "campaign" in
|
|
9
|
-
// locales/{de,en}/autobahn.json. The components and md3.css stay as they are.
|
|
10
|
-
|
|
11
|
-
import type { AutobahnCar } from '../cards/types';
|
|
12
|
-
import { dealSignals, DealSource } from '../cards/dealSignals';
|
|
13
|
-
|
|
14
|
-
/** What a campaign may look at: the part a card's AutobahnCar and the vehicle page's VehicleDetail share. */
|
|
15
|
-
export type CampaignCar = DealSource & Pick<AutobahnCar, 'make' | 'model' | 'trim' | 'km' | 'price' | 'fuel'>;
|
|
16
|
-
|
|
17
|
-
export interface Campaign {
|
|
18
|
-
/** kebab-case id; also the modifier class `campaign-band--<id>` / `campaign-hero--<id>`. */
|
|
19
|
-
id: string;
|
|
20
|
-
/** i18n path of the campaign's texts: label (band, bar), period, title, text, legal (hero), only (switch),
|
|
21
|
-
* offer (bar), bannerTitle, cta (banner, with the hero's period and text). */
|
|
22
|
-
texts: string;
|
|
23
|
-
/** icon in front of the label of the band and the bar — a name from the ui/Icon registry. */
|
|
24
|
-
icon?: string;
|
|
25
|
-
/** a dark colour or gradient: it carries `color` and the white text of the hero and the switch. */
|
|
26
|
-
background: string;
|
|
27
|
-
/** band label and icon, the hero's period line, the switch when it is on; white by default. */
|
|
28
|
-
color?: string;
|
|
29
|
-
/** first and last moment, with the German UTC offset. Outside of it neither the band nor the hero is shown;
|
|
30
|
-
* the hero's period line and its countdown come from here too. */
|
|
31
|
-
startsAt: string;
|
|
32
|
-
endsAt: string;
|
|
33
|
-
/** which cars carry the band. */
|
|
34
|
-
appliesTo: (car: CampaignCar) => boolean;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** the card shows both the green "−X € zum UVP" and the red "−X %" chip. */
|
|
38
|
-
export const hasPriceDropChips = (car: CampaignCar): boolean => {
|
|
39
|
-
const { drop, percent } = dealSignals(car);
|
|
40
|
-
return drop && percent;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const blackFriday: Campaign = {
|
|
44
|
-
id: 'black-friday',
|
|
45
|
-
texts: 'autobahn:campaign.blackFriday',
|
|
46
|
-
icon: 'tag',
|
|
47
|
-
// black and gold of the Black Friday design ("auto.de SRL Black Friday", A · Dark Edition)
|
|
48
|
-
background: '#111317',
|
|
49
|
-
color: '#f7c544',
|
|
50
|
-
// 24.11.–01.12.2026, the last day included
|
|
51
|
-
startsAt: '2026-11-24T00:00:00+01:00',
|
|
52
|
-
endsAt: '2026-12-02T00:00:00+01:00',
|
|
53
|
-
appliesTo: hasPriceDropChips,
|
|
54
|
-
};
|
|
55
|
-
|
|
56
|
-
export const CAMPAIGNS = { blackFriday };
|
|
57
|
-
|
|
58
|
-
export const isCampaignRunning = (campaign: Campaign, now: number = Date.now()): boolean =>
|
|
59
|
-
now >= Date.parse(campaign.startsAt) && now < Date.parse(campaign.endsAt);
|
|
60
|
-
|
|
61
|
-
/** the campaign whose band this car carries, if any. */
|
|
62
|
-
export const campaignFor = (car: CampaignCar, campaign?: Campaign | null): Campaign | null =>
|
|
63
|
-
campaign && isCampaignRunning(campaign) && campaign.appliesTo(car) ? campaign : null;
|
|
64
|
-
|
|
65
|
-
/** first and last day as the hero shows them, e.g. { from: '24.11.', to: '01.12.2026' } — German days,
|
|
66
|
-
* wherever the visitor is. */
|
|
67
|
-
export const campaignPeriod = (campaign: Campaign): { from: string; to: string } => {
|
|
68
|
-
const day = (at: number, year: boolean): string =>
|
|
69
|
-
new Intl.DateTimeFormat('de-DE', {
|
|
70
|
-
day: '2-digit', month: '2-digit', year: year ? 'numeric' : undefined, timeZone: 'Europe/Berlin',
|
|
71
|
-
}).format(at);
|
|
72
|
-
// endsAt is the first moment after the campaign
|
|
73
|
-
return { from: day(Date.parse(campaign.startsAt), false), to: day(Date.parse(campaign.endsAt) - 1, true) };
|
|
74
|
-
};
|
|
1
|
+
// Autobahn (auto.de redesign) — campaigns ("Black Friday"): the band on top of the car cards and of the
|
|
2
|
+
// vehicle page's gallery (CampaignBand), the hero with the countdown (CampaignHero), the switch "only its cars"
|
|
3
|
+
// (CampaignSwitch), the bar under the site header (CampaignBar) and the banner with cars (CampaignBanner).
|
|
4
|
+
//
|
|
5
|
+
// A campaign is data; the cards and the hero do not know any campaign by name. Which campaign runs is the
|
|
6
|
+
// app's decision (fe-main: source/framework/constants/campaign.ts); without one nothing is shown.
|
|
7
|
+
//
|
|
8
|
+
// A new campaign (e.g. New Year) = one entry in CAMPAIGNS + its texts under "campaign" in
|
|
9
|
+
// locales/{de,en}/autobahn.json. The components and md3.css stay as they are.
|
|
10
|
+
|
|
11
|
+
import type { AutobahnCar } from '../cards/types';
|
|
12
|
+
import { dealSignals, DealSource } from '../cards/dealSignals';
|
|
13
|
+
|
|
14
|
+
/** What a campaign may look at: the part a card's AutobahnCar and the vehicle page's VehicleDetail share. */
|
|
15
|
+
export type CampaignCar = DealSource & Pick<AutobahnCar, 'make' | 'model' | 'trim' | 'km' | 'price' | 'fuel'>;
|
|
16
|
+
|
|
17
|
+
export interface Campaign {
|
|
18
|
+
/** kebab-case id; also the modifier class `campaign-band--<id>` / `campaign-hero--<id>`. */
|
|
19
|
+
id: string;
|
|
20
|
+
/** i18n path of the campaign's texts: label (band, bar), period, title, text, legal (hero), only (switch),
|
|
21
|
+
* offer (bar), bannerTitle, cta (banner, with the hero's period and text). */
|
|
22
|
+
texts: string;
|
|
23
|
+
/** icon in front of the label of the band and the bar — a name from the ui/Icon registry. */
|
|
24
|
+
icon?: string;
|
|
25
|
+
/** a dark colour or gradient: it carries `color` and the white text of the hero and the switch. */
|
|
26
|
+
background: string;
|
|
27
|
+
/** band label and icon, the hero's period line, the switch when it is on; white by default. */
|
|
28
|
+
color?: string;
|
|
29
|
+
/** first and last moment, with the German UTC offset. Outside of it neither the band nor the hero is shown;
|
|
30
|
+
* the hero's period line and its countdown come from here too. */
|
|
31
|
+
startsAt: string;
|
|
32
|
+
endsAt: string;
|
|
33
|
+
/** which cars carry the band. */
|
|
34
|
+
appliesTo: (car: CampaignCar) => boolean;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/** the card shows both the green "−X € zum UVP" and the red "−X %" chip. */
|
|
38
|
+
export const hasPriceDropChips = (car: CampaignCar): boolean => {
|
|
39
|
+
const { drop, percent } = dealSignals(car);
|
|
40
|
+
return drop && percent;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const blackFriday: Campaign = {
|
|
44
|
+
id: 'black-friday',
|
|
45
|
+
texts: 'autobahn:campaign.blackFriday',
|
|
46
|
+
icon: 'tag',
|
|
47
|
+
// black and gold of the Black Friday design ("auto.de SRL Black Friday", A · Dark Edition)
|
|
48
|
+
background: '#111317',
|
|
49
|
+
color: '#f7c544',
|
|
50
|
+
// 24.11.–01.12.2026, the last day included
|
|
51
|
+
startsAt: '2026-11-24T00:00:00+01:00',
|
|
52
|
+
endsAt: '2026-12-02T00:00:00+01:00',
|
|
53
|
+
appliesTo: hasPriceDropChips,
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const CAMPAIGNS = { blackFriday };
|
|
57
|
+
|
|
58
|
+
export const isCampaignRunning = (campaign: Campaign, now: number = Date.now()): boolean =>
|
|
59
|
+
now >= Date.parse(campaign.startsAt) && now < Date.parse(campaign.endsAt);
|
|
60
|
+
|
|
61
|
+
/** the campaign whose band this car carries, if any. */
|
|
62
|
+
export const campaignFor = (car: CampaignCar, campaign?: Campaign | null): Campaign | null =>
|
|
63
|
+
campaign && isCampaignRunning(campaign) && campaign.appliesTo(car) ? campaign : null;
|
|
64
|
+
|
|
65
|
+
/** first and last day as the hero shows them, e.g. { from: '24.11.', to: '01.12.2026' } — German days,
|
|
66
|
+
* wherever the visitor is. */
|
|
67
|
+
export const campaignPeriod = (campaign: Campaign): { from: string; to: string } => {
|
|
68
|
+
const day = (at: number, year: boolean): string =>
|
|
69
|
+
new Intl.DateTimeFormat('de-DE', {
|
|
70
|
+
day: '2-digit', month: '2-digit', year: year ? 'numeric' : undefined, timeZone: 'Europe/Berlin',
|
|
71
|
+
}).format(at);
|
|
72
|
+
// endsAt is the first moment after the campaign
|
|
73
|
+
return { from: day(Date.parse(campaign.startsAt), false), to: day(Date.parse(campaign.endsAt) - 1, true) };
|
|
74
|
+
};
|
package/campaign/index.ts
CHANGED
|
@@ -1,18 +1,6 @@
|
|
|
1
|
-
export { default as CampaignBand } from './CampaignBand';
|
|
2
|
-
export type { CampaignBandProps } from './CampaignBand';
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
export type {
|
|
6
|
-
|
|
7
|
-
export { default as CampaignBar } from './CampaignBar';
|
|
8
|
-
export type { CampaignBarProps } from './CampaignBar';
|
|
9
|
-
|
|
10
|
-
export { default as CampaignHero } from './CampaignHero';
|
|
11
|
-
export type { CampaignHeroProps } from './CampaignHero';
|
|
12
|
-
|
|
13
|
-
export { default as CampaignSwitch } from './CampaignSwitch';
|
|
14
|
-
export type { CampaignSwitchProps } from './CampaignSwitch';
|
|
15
|
-
|
|
16
|
-
export { CAMPAIGNS, campaignFor, campaignPeriod, hasPriceDropChips, isCampaignRunning } from './campaigns';
|
|
17
|
-
export type { Campaign, CampaignCar } from './campaigns';
|
|
18
|
-
export { campaignVars } from './campaignVars';
|
|
1
|
+
export { default as CampaignBand } from './CampaignBand';
|
|
2
|
+
export type { CampaignBandProps } from './CampaignBand';
|
|
3
|
+
|
|
4
|
+
export { CAMPAIGNS, campaignFor, campaignPeriod, hasPriceDropChips, isCampaignRunning } from './campaigns';
|
|
5
|
+
export type { Campaign, CampaignCar } from './campaigns';
|
|
6
|
+
export { campaignVars } from './campaignVars';
|