@bytebrand/fe-ui-core-autobahn 1.0.226 → 1.0.227

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.
@@ -0,0 +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;
@@ -0,0 +1,86 @@
1
+ // Autobahn (auto.de redesign) — the campaign's banner: headline and link on the left, cut-out cars on a wedge in
2
+ // the campaign's colour on the right; the car in front reaches over the upper edge. Used on fe-main's home page.
3
+ //
4
+ // Texts, colours and dates come from the campaign, the cars from the page, the look from md3.css
5
+ // (.campaign-banner). Nothing is shown before the campaign starts and after it has ended. Renders correctly only
6
+ // inside a `<div className="md3">` subtree.
7
+
8
+ import React, { useEffect, useRef, useState } from 'react';
9
+ import { TranslationFunction } from '../types';
10
+
11
+ import { Icon } from '../ui';
12
+ import { Campaign, campaignPeriod, isCampaignRunning } from './campaigns';
13
+ import { campaignVars } from './campaignVars';
14
+ import { openInApp } from './openInApp';
15
+ import { useCountdown } from './useCountdown';
16
+
17
+ export interface CampaignBannerProps {
18
+ campaign: Campaign;
19
+ /** pictures of cars with a transparent background; the first one stands in front. */
20
+ cars: string[];
21
+ /** where the offers are; a real link (new tab, crawlers). */
22
+ href: string;
23
+ /** plain click: the app opens href itself, without loading the page anew. */
24
+ onOpen: () => void;
25
+ t: TranslationFunction;
26
+ }
27
+
28
+ /** true once a part of the element has been on screen (at once without IntersectionObserver). */
29
+ const useSeen = (ref: React.RefObject<HTMLElement | null>): boolean => {
30
+ const [seen, setSeen] = useState(false);
31
+ useEffect(() => {
32
+ const el = ref.current;
33
+ if (!el || typeof IntersectionObserver === 'undefined') {
34
+ setSeen(true);
35
+ return undefined;
36
+ }
37
+ const observer = new IntersectionObserver((entries) => {
38
+ if (!entries.some((entry) => entry.isIntersecting)) return;
39
+ setSeen(true);
40
+ observer.disconnect();
41
+ }, { threshold: 0.3 });
42
+ observer.observe(el);
43
+ return () => observer.disconnect();
44
+ }, [ref]);
45
+ return seen;
46
+ };
47
+
48
+ const CampaignBanner: React.FunctionComponent<CampaignBannerProps> = ({ campaign, cars, href, onOpen, t }) => {
49
+ const ref = useRef<HTMLAnchorElement>(null);
50
+ const seen = useSeen(ref);
51
+ const left = useCountdown(campaign.endsAt);
52
+ if (!left || !isCampaignRunning(campaign)) return null;
53
+ return (
54
+ <a
55
+ ref={ref}
56
+ className={'campaign-banner campaign-banner--' + campaign.id + (seen ? ' campaign-banner--in' : '')}
57
+ style={campaignVars(campaign)}
58
+ href={href}
59
+ onClick={openInApp(onOpen)}
60
+ >
61
+ <span className="campaign-banner-cars" aria-hidden="true">
62
+ {cars.map((src, i) => (
63
+ <img key={src} className={'campaign-banner-car campaign-banner-car--' + (i + 1)} src={src} alt="" decoding="async" />
64
+ ))}
65
+ <span className="campaign-banner-note">{t('autobahn:campaign.exampleCars')}</span>
66
+ </span>
67
+ <span className="campaign-banner-body">
68
+ <span className="campaign-banner-period">{t(campaign.texts + '.period', { ...campaignPeriod(campaign) })}</span>
69
+ <strong className="campaign-banner-title">{t(campaign.texts + '.bannerTitle')}</strong>
70
+ <span className="campaign-banner-text">{t(campaign.texts + '.text')}</span>
71
+ <span className="campaign-banner-foot">
72
+ <span className="campaign-banner-cta">
73
+ {t(campaign.texts + '.cta')}
74
+ <Icon name="arrow-right" size={18} stroke={2.2} />
75
+ </span>
76
+ <span className="campaign-banner-ends">
77
+ <Icon name="clock" size={16} stroke={2} />
78
+ {t(left.days ? 'autobahn:campaign.endsInDays' : 'autobahn:campaign.endsInHours', { ...left })}
79
+ </span>
80
+ </span>
81
+ </span>
82
+ </a>
83
+ );
84
+ };
85
+
86
+ export default CampaignBanner;
@@ -0,0 +1,37 @@
1
+ // Autobahn (auto.de redesign) — the campaign's bar right under the site header, one link to its offers
2
+ // (see campaigns.ts). Used on fe-main's home page.
3
+ //
4
+ // Texts, colours and dates come from the campaign, the look from md3.css (.campaign-bar). Nothing is shown before
5
+ // the campaign starts and after it has ended. 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, isCampaignRunning } from './campaigns';
12
+ import { campaignVars } from './campaignVars';
13
+ import { openInApp } from './openInApp';
14
+ import { useCountdown } from './useCountdown';
15
+
16
+ export interface CampaignBarProps {
17
+ campaign: Campaign;
18
+ /** where the offers are; a real link (new tab, crawlers). */
19
+ href: string;
20
+ /** plain click: the app opens href itself, without loading the page anew. */
21
+ onOpen: () => void;
22
+ t: TranslationFunction;
23
+ }
24
+
25
+ const CampaignBar: React.FunctionComponent<CampaignBarProps> = ({ campaign, href, onOpen, t }) => {
26
+ const left = useCountdown(campaign.endsAt); // the bar goes by itself when the campaign ends
27
+ if (!left || !isCampaignRunning(campaign)) return null;
28
+ return (
29
+ <a className={'campaign-bar campaign-bar--' + campaign.id} style={campaignVars(campaign)} href={href} onClick={openInApp(onOpen)}>
30
+ {campaign.icon && <Icon name={campaign.icon} size={16} stroke={2.2} />}
31
+ <span className="campaign-bar-label">{t(campaign.texts + '.label')}:</span>
32
+ <span className="campaign-bar-offer">{t(campaign.texts + '.offer')}</span>
33
+ </a>
34
+ );
35
+ };
36
+
37
+ export default CampaignBar;
@@ -0,0 +1,50 @@
1
+ // Autobahn (auto.de redesign) — the campaign hero: period, headline and a running countdown to the end of the
2
+ // campaign (design "auto.de SRL Black Friday", A · Dark Edition). Used on fe-main's /search.
3
+ //
4
+ // Texts and dates come from the campaign (campaigns.ts), the look from md3.css (.campaign-hero). Nothing is
5
+ // shown before the campaign starts and after it has ended. Renders correctly only inside a
6
+ // `<div className="md3">` subtree.
7
+
8
+ import React from 'react';
9
+ import { TranslationFunction } from '../types';
10
+
11
+ import { Campaign, campaignPeriod, isCampaignRunning } from './campaigns';
12
+ import { campaignVars } from './campaignVars';
13
+ import { useCountdown } from './useCountdown';
14
+
15
+ export interface CampaignHeroProps {
16
+ campaign: Campaign;
17
+ t: TranslationFunction;
18
+ }
19
+
20
+ const twoDigits = (n: number): string => (n < 10 ? '0' + n : String(n));
21
+
22
+ const CampaignHero: React.FunctionComponent<CampaignHeroProps> = ({ campaign, t }) => {
23
+ const left = useCountdown(campaign.endsAt);
24
+ if (!left || !isCampaignRunning(campaign)) return null;
25
+ const units: Array<[string, number]> = [['days', left.days], ['hours', left.hours], ['minutes', left.minutes]];
26
+ return (
27
+ <section
28
+ className={'campaign-hero campaign-hero--' + campaign.id}
29
+ style={campaignVars(campaign)}
30
+ aria-label={t(campaign.texts + '.label')}
31
+ >
32
+ <div>
33
+ <div className="campaign-hero-period">{t(campaign.texts + '.period', { ...campaignPeriod(campaign) })}</div>
34
+ <h2 className="campaign-hero-title">{t(campaign.texts + '.title')}</h2>
35
+ <p className="campaign-hero-text">{t(campaign.texts + '.text')}</p>
36
+ </div>
37
+ <div className="campaign-hero-timer" role="timer" aria-label={t('autobahn:campaign.timeLeft', { ...left })}>
38
+ {units.map(([unit, value]) => (
39
+ <div key={unit} className="campaign-hero-unit" aria-hidden="true">
40
+ <b>{twoDigits(value)}</b>
41
+ <small>{t('autobahn:campaign.' + unit, { count: value })}</small>
42
+ </div>
43
+ ))}
44
+ </div>
45
+ <div className="campaign-hero-legal">{t(campaign.texts + '.legal')}</div>
46
+ </section>
47
+ );
48
+ };
49
+
50
+ export default CampaignHero;
@@ -0,0 +1,43 @@
1
+ // Autobahn (auto.de redesign) — "only the campaign's cars", the switch above the filters of /search
2
+ // (see campaigns.ts). Which search filter it turns on is the page's business.
3
+ //
4
+ // The md3 Switch on the campaign's dark card: the whole card is its label, so all of it can be clicked.
5
+ // Renders correctly only inside a `<div className="md3">` subtree.
6
+
7
+ import React from 'react';
8
+ import { TranslationFunction } from '../types';
9
+
10
+ import { Switch } from '../ui';
11
+ import { Campaign } from './campaigns';
12
+ import { campaignVars } from './campaignVars';
13
+
14
+ export interface CampaignSwitchProps {
15
+ campaign: Campaign;
16
+ checked: boolean;
17
+ onChange: (checked: boolean) => void;
18
+ /** how many cars the switch leaves; null = not known yet (the line stays free). */
19
+ count: number | null;
20
+ language: string;
21
+ t: TranslationFunction;
22
+ }
23
+
24
+ const CampaignSwitch: React.FunctionComponent<CampaignSwitchProps> = ({ campaign, checked, onChange, count, language, t }) => (
25
+ <div className={'campaign-switch campaign-switch--' + campaign.id} style={campaignVars(campaign)}>
26
+ <Switch
27
+ checked={checked}
28
+ onChange={(event) => onChange(event.target.checked)}
29
+ label={(
30
+ <>
31
+ {t(campaign.texts + '.only')}
32
+ <span className="campaign-switch-count">
33
+ {count != null
34
+ ? t('autobahn:campaign.vehicles', { count, number: count.toLocaleString(language === 'en' ? 'en-IN' : 'de-DE') })
35
+ : '\u00a0'}
36
+ </span>
37
+ </>
38
+ )}
39
+ />
40
+ </div>
41
+ );
42
+
43
+ export default CampaignSwitch;
@@ -0,0 +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);
@@ -0,0 +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
+ };
@@ -0,0 +1,18 @@
1
+ export { default as CampaignBand } from './CampaignBand';
2
+ export type { CampaignBandProps } from './CampaignBand';
3
+
4
+ export { default as CampaignBanner } from './CampaignBanner';
5
+ export type { CampaignBannerProps } from './CampaignBanner';
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';
@@ -0,0 +1,8 @@
1
+ import type React from 'react';
2
+
3
+ /** Click on a campaign's link: a plain click opens it in the app, a new tab or window stays the browser's. */
4
+ export const openInApp = (onOpen: () => void) => (event: React.MouseEvent): void => {
5
+ if (event.button !== 0 || event.metaKey || event.ctrlKey || event.shiftKey || event.altKey) return;
6
+ event.preventDefault();
7
+ onOpen();
8
+ };
@@ -0,0 +1,28 @@
1
+ import { useEffect, useState } from 'react';
2
+
3
+ export interface Countdown {
4
+ days: number;
5
+ hours: number;
6
+ minutes: number;
7
+ }
8
+
9
+ const MINUTE = 60 * 1000;
10
+
11
+ const minutesLeft = (endsAt: string): number => Math.floor((Date.parse(endsAt) - Date.now()) / MINUTE);
12
+
13
+ /**
14
+ * The time left until `endsAt` in whole minutes, counting down by itself; null once it is over.
15
+ * It looks at the clock every second instead of adding up minutes, so it is right again at once after the
16
+ * tab slept or the computer woke up; React renders only when the minute changes.
17
+ */
18
+ export const useCountdown = (endsAt: string): Countdown | null => {
19
+ const [left, setLeft] = useState(() => minutesLeft(endsAt));
20
+ useEffect(() => {
21
+ const tick = (): void => setLeft(minutesLeft(endsAt));
22
+ tick();
23
+ const timer = setInterval(tick, 1000);
24
+ return () => clearInterval(timer);
25
+ }, [endsAt]);
26
+ if (!(left >= 0)) return null;
27
+ return { days: Math.floor(left / 1440), hours: Math.floor(left / 60) % 24, minutes: left % 60 };
28
+ };
package/cards/CarCard.tsx CHANGED
@@ -41,6 +41,10 @@ import {
41
41
  callDealerSalesPhone,
42
42
  DEALER_SALES_PHONE,
43
43
  } from './cardParts';
44
+ import CampaignBand from '../campaign/CampaignBand';
45
+ import { Campaign, campaignFor } from '../campaign/campaigns';
46
+ import { campaignVars } from '../campaign/campaignVars';
47
+ import { dealSignals } from './dealSignals';
44
48
  import { AutobahnCar } from './types';
45
49
  import VdpViewer from '../vdp/VdpViewer';
46
50
 
@@ -104,6 +108,12 @@ export interface CarCardProps {
104
108
  * when omitted the badge is not a link (a click opens the car via onOpen, as before).
105
109
  */
106
110
  onShowPriceRating?: (car: AutobahnCar) => void;
111
+ /**
112
+ * The campaign (campaign/campaigns.ts), e.g. CAMPAIGNS.blackFriday: its band is put on top of the card
113
+ * while the campaign runs and applies to this car. The band takes its height from the photo, so the card is as
114
+ * tall as its neighbours and the rows of a grid stay aligned.
115
+ */
116
+ campaign?: Campaign | null;
107
117
  }
108
118
 
109
119
  const CarCard: React.FunctionComponent<CarCardProps> = ({
@@ -120,6 +130,7 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
120
130
  onOpenRateAdjust,
121
131
  onShowFinancingDetails,
122
132
  onShowPriceRating,
133
+ campaign,
123
134
  }) => {
124
135
  const [mode, setMode] = useState<PaymentMode>('financing');
125
136
  const [photoIndex, setPhotoIndex] = useState(0);
@@ -153,23 +164,15 @@ const CarCard: React.FunctionComponent<CarCardProps> = ({
153
164
  observer.observe(el);
154
165
  return () => observer.disconnect();
155
166
  }, [eagerMedia]);
156
- // as-good-as-new gate (mileage < 1,000 km AND first registration unknown or < 12 months) —
157
- // undefined (older AutobahnCar producer not yet updated) fails OPEN, keeping prior behaviour.
158
- const asGoodAsNew = car.asGoodAsNew !== false;
159
- const showDrop = asGoodAsNew && car.drop != null;
160
- const showSave = asGoodAsNew && !showDrop && car.savings != null && car.savings > 600;
161
- const showPct = asGoodAsNew && car.dropPct != null && car.dropPct > 0;
162
- const showOfferBadge = !!(car.isNew || showDrop || showSave || showPct || car.zeroDown);
163
- // PM call: the badge row only fits 3 pills — when Drop/Save + Percent + ZeroDown are all
164
- // active that's already 3, so NEU is dropped rather than causing a 4th to overflow.
165
- const activeDealChips = [showDrop || showSave, showPct, !!car.zeroDown].filter(Boolean).length;
166
- const showNeu = asGoodAsNew && car.isNew && activeDealChips < 3;
167
+ const { drop: showDrop, save: showSave, percent: showPct, offer: showOfferBadge, neu: showNeu } = dealSignals(car);
168
+ const activeCampaign = campaignFor(car, campaign);
167
169
  return (
168
170
  <article
169
- className="mcard mcard--interactive cc-card"
171
+ className={'mcard mcard--interactive cc-card' + (activeCampaign ? ' mcard--campaign' : '')}
170
172
  onClick={() => onOpen(car)}
171
- style={{ display: 'flex', flexDirection: 'column' }}
173
+ style={{ display: 'flex', flexDirection: 'column', ...(activeCampaign ? campaignVars(activeCampaign) : {}) }}
172
174
  >
175
+ {activeCampaign && <CampaignBand campaign={activeCampaign} t={t} />}
173
176
  <div
174
177
  className="cc-media"
175
178
  ref={mediaRef}
package/cards/CarRow.tsx CHANGED
@@ -44,6 +44,10 @@ import {
44
44
  PaymentMode,
45
45
  ratingTone,
46
46
  } from './cardParts';
47
+ import CampaignBand from '../campaign/CampaignBand';
48
+ import { Campaign, campaignFor } from '../campaign/campaigns';
49
+ import { campaignVars } from '../campaign/campaignVars';
50
+ import { dealSignals } from './dealSignals';
47
51
  import { AutobahnCar } from './types';
48
52
 
49
53
  export interface CarRowProps {
@@ -83,6 +87,8 @@ export interface CarRowProps {
83
87
  onShowFinancingDetails?: (car: AutobahnCar, mode: PaymentMode) => void;
84
88
  /** the price-rating chip + bar were clicked — see CarCard's identically-named prop. */
85
89
  onShowPriceRating?: (car: AutobahnCar) => void;
90
+ /** The running campaign, its band spans the whole row — see CarCard's identically-named prop. */
91
+ campaign?: Campaign | null;
86
92
  }
87
93
 
88
94
  const CarRow: React.FunctionComponent<CarRowProps> = ({
@@ -96,6 +102,7 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
96
102
  adminAction,
97
103
  onShowFinancingDetails,
98
104
  onShowPriceRating,
105
+ campaign,
99
106
  }) => {
100
107
  const [mode, setMode] = useState<PaymentMode>('financing');
101
108
  const [photoIndex, setPhotoIndex] = useState(0);
@@ -136,16 +143,8 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
136
143
  observer.observe(el);
137
144
  return () => observer.disconnect();
138
145
  }, [eagerMedia]);
139
- // as-good-as-new gate (mileage < 1,000 km AND first registration unknown or < 12 months) —
140
- // undefined (older AutobahnCar producer not yet updated) fails OPEN, keeping prior behaviour.
141
- const asGoodAsNew = car.asGoodAsNew !== false;
142
- const showDrop = asGoodAsNew && car.drop != null;
143
- const showSave = asGoodAsNew && !showDrop && car.savings != null && car.savings > 600;
144
- const showPct = asGoodAsNew && car.dropPct != null && car.dropPct > 0;
145
- const showOfferBadge = !!(car.isNew || showDrop || showSave || showPct || car.zeroDown);
146
- // same overflow rule as CarCard: the row only fits 3 pills, so NEU drops when the other 3 are all active.
147
- const activeDealChips = [showDrop || showSave, showPct, !!car.zeroDown].filter(Boolean).length;
148
- const showNeu = asGoodAsNew && car.isNew && activeDealChips < 3;
146
+ const { drop: showDrop, save: showSave, percent: showPct, offer: showOfferBadge, neu: showNeu } = dealSignals(car);
147
+ const activeCampaign = campaignFor(car, campaign);
149
148
  const facts: Array<[icon: string, value: string]> = [
150
149
  ['gauge', fmtKm(car.km)],
151
150
  ['calendar', t('autobahn:card.specs.firstRegistration', { reg: car.reg })],
@@ -160,16 +159,17 @@ const CarRow: React.FunctionComponent<CarRowProps> = ({
160
159
  if (car.availability) facts.push(['circle-check', car.availability]);
161
160
  return (
162
161
  <article
163
- className="mcard mcard--interactive listcard"
162
+ className={'mcard mcard--interactive listcard' + (activeCampaign ? ' mcard--campaign' : '')}
164
163
  onClick={() => onOpen(car)}
165
- style={{ background: 'var(--md-sc-lowest)' }}
164
+ style={activeCampaign ? campaignVars(activeCampaign) : { background: 'var(--md-sc-lowest)' }}
166
165
  >
166
+ {activeCampaign && <CampaignBand campaign={activeCampaign} t={t} />}
167
167
  <div className="listcard-media" ref={mediaRef} style={{ position: 'relative' }} onMouseEnter={onMediaEnter} onTouchStart={onMediaEnter}>
168
168
  {/* 'auto': desktop picks cover/contain per photo (crops only when it wouldn't lose too
169
169
  much of the shot); below 601px this is identical to 'contain', so mobile is unchanged. */}
170
170
  <CardCarousel images={car.gallery} height="100%" fit="auto" onChange={setPhotoIndex} />
171
171
  {/* deal badges — ONE compact line, Figma order: −€ (drop/save) · −% · 0 € Anz. · NEU
172
- (NEU always last, dropped first on overflow — see activeDealChips below), plus the
172
+ (NEU always last, dropped first on overflow — see dealSignals.ts), plus the
173
173
  "⚡ Angebot" badge (Figma) on its own line below. The price RATING ('Guter Preis') is
174
174
  NOT here — it lives in the price column (PriceMeter). */}
175
175
  <div
@@ -0,0 +1,36 @@
1
+ // Autobahn (auto.de redesign) — which deal signals a card shows for a car.
2
+ //
3
+ // One rule for CarCard, CarRow, the vehicle page's gallery and the campaigns (campaign/campaigns.ts), so "this card shows the green −X € and the
4
+ // red −X % chip" means the same everywhere.
5
+
6
+ import { AutobahnCar } from './types';
7
+
8
+ export type DealSource = Pick<AutobahnCar, 'asGoodAsNew' | 'drop' | 'dropPct' | 'savings' | 'isNew' | 'zeroDown'>;
9
+
10
+ export interface DealSignals {
11
+ /** DropChip, "−X € zum UVP". */
12
+ drop: boolean;
13
+ /** SaveChip (only without a drop). */
14
+ save: boolean;
15
+ /** PercentChip, "−X %". */
16
+ percent: boolean;
17
+ /** OfferBadge, "Angebot". */
18
+ offer: boolean;
19
+ /** NEU badge. */
20
+ neu: boolean;
21
+ }
22
+
23
+ export const dealSignals = (car: DealSource): DealSignals => {
24
+ // as-good-as-new gate (mileage < 1,000 km AND first registration unknown or < 12 months) —
25
+ // undefined (older AutobahnCar producer not yet updated) fails OPEN, keeping prior behaviour.
26
+ const asGoodAsNew = car.asGoodAsNew !== false;
27
+ const drop = asGoodAsNew && car.drop != null;
28
+ const save = asGoodAsNew && !drop && car.savings != null && car.savings > 600;
29
+ const percent = asGoodAsNew && car.dropPct != null && car.dropPct > 0;
30
+ const offer = !!(car.isNew || drop || save || percent || car.zeroDown);
31
+ // PM call: the badge row only fits 3 pills — when Drop/Save + Percent + ZeroDown are all
32
+ // active that's already 3, so NEU is dropped rather than causing a 4th to overflow.
33
+ const activeChips = [drop || save, percent, !!car.zeroDown].filter(Boolean).length;
34
+ const neu = asGoodAsNew && !!car.isNew && activeChips < 3;
35
+ return { drop, save, percent, offer, neu };
36
+ };
package/index.ts CHANGED
@@ -11,6 +11,7 @@
11
11
  // - navigation is injected (TopBar `onNavigate`) — no router dependency.
12
12
  export * from './ui';
13
13
  export * from './cards';
14
+ export * from './campaign';
14
15
  export * from './chrome';
15
16
  export * from './vdp';
16
17
  export * from './widgets';
@@ -64,6 +64,29 @@
64
64
  "offer": "Angebot"
65
65
  }
66
66
  },
67
+ "campaign": {
68
+ "days": "Tag",
69
+ "days_plural": "Tage",
70
+ "hours": "Std",
71
+ "minutes": "Min",
72
+ "timeLeft": "Noch {{days}} Tage, {{hours}} Stunden und {{minutes}} Minuten",
73
+ "vehicles": "{{number}} Fahrzeug",
74
+ "vehicles_plural": "{{number}} Fahrzeuge",
75
+ "endsInDays": "Endet in {{days}} T {{hours}} Std",
76
+ "endsInHours": "Endet in {{hours}} Std {{minutes}} Min",
77
+ "exampleCars": "Beispielfahrzeuge",
78
+ "blackFriday": {
79
+ "label": "Black Friday",
80
+ "only": "Nur Black-Friday-Angebote",
81
+ "offer": "Spare bis zu 35 %",
82
+ "bannerTitle": "Bis zu 35 % sparen",
83
+ "cta": "Angebote ansehen",
84
+ "period": "Black Friday Week · {{from}}–{{to}}",
85
+ "title": "Bis zu 35 % günstiger.",
86
+ "text": "Ausgewählte Fahrzeuge mit reduziertem Kaufpreis. Nur solange die Aktion läuft.",
87
+ "legal": "Durchgestrichene Preise zeigen den niedrigsten Gesamtpreis des jeweiligen Fahrzeugs in den letzten 30 Tagen vor der Preisermäßigung (§ 11 PAngV)."
88
+ }
89
+ },
67
90
  "finance": {
68
91
  "creditCostWarning": "Achtung! Kreditaufnahme kostet Geld.",
69
92
  "kfMonths": "{{months}} Mon.",
@@ -64,6 +64,29 @@
64
64
  "offer": "Offer"
65
65
  }
66
66
  },
67
+ "campaign": {
68
+ "days": "Day",
69
+ "days_plural": "Days",
70
+ "hours": "Hrs",
71
+ "minutes": "Min",
72
+ "timeLeft": "{{days}} days, {{hours}} hours and {{minutes}} minutes left",
73
+ "vehicles": "{{number}} vehicle",
74
+ "vehicles_plural": "{{number}} vehicles",
75
+ "endsInDays": "Ends in {{days}}d {{hours}}h",
76
+ "endsInHours": "Ends in {{hours}}h {{minutes}}m",
77
+ "exampleCars": "Example vehicles",
78
+ "blackFriday": {
79
+ "label": "Black Friday",
80
+ "only": "Black Friday offers only",
81
+ "offer": "Save up to 35%",
82
+ "bannerTitle": "Save up to 35%",
83
+ "cta": "View offers",
84
+ "period": "Black Friday Week · {{from}}–{{to}}",
85
+ "title": "Save up to 35%.",
86
+ "text": "Selected vehicles at a reduced purchase price. Only while the campaign lasts.",
87
+ "legal": "Struck-through prices show the lowest total price of the respective vehicle in the 30 days before the price reduction (Section 11 PAngV)."
88
+ }
89
+ },
67
90
  "finance": {
68
91
  "creditCostWarning": "Warning! Financing comes at a cost.",
69
92
  "kfMonths": "{{months}} mo.",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytebrand/fe-ui-core-autobahn",
3
- "version": "1.0.226",
3
+ "version": "1.0.227",
4
4
  "description": "auto.de md3 (Autobahn) design system — UI primitives, cards, chrome, VDP modules, theme CSS and locales. Ships raw TypeScript source (like fe-ui-core before it); each consumer's bundler compiles it.",
5
5
  "main": "index.ts",
6
6
  "license": "UNLICENSED",
package/theme/md3.css CHANGED
@@ -7958,6 +7958,652 @@ line-height: 31px;
7958
7958
  box-shadow: var(--md-e1);
7959
7959
  }
7960
7960
 
7961
+ /* campaign band on top of a car card (campaign/CampaignBand.tsx, e.g. "Black Friday"). The campaign brings the
7962
+ colours (--campaign-bg / --campaign-fg); the size and the type (spaced capitals, like the eyebrow of the
7963
+ Black Friday hero) are the same for every campaign. */
7964
+ .md3 .campaign-band,
7965
+ .md3 .mcard--campaign {
7966
+ --campaign-h: 32px;
7967
+ }
7968
+ .md3 .campaign-band {
7969
+ flex: none;
7970
+ display: flex;
7971
+ align-items: center;
7972
+ justify-content: center;
7973
+ gap: 7px;
7974
+ box-sizing: border-box;
7975
+ height: var(--campaign-h);
7976
+ padding: 0 14px;
7977
+ background: var(--campaign-bg);
7978
+ color: var(--campaign-fg);
7979
+ font-family: Arial, Helvetica, Arimo, sans-serif;
7980
+ font-weight: 700;
7981
+ font-size: 13px;
7982
+ line-height: 16px;
7983
+ letter-spacing: 1.4px;
7984
+ text-transform: uppercase;
7985
+ }
7986
+ .md3 .campaign-band .lucide {
7987
+ flex: none;
7988
+ }
7989
+ .md3 .campaign-band-label {
7990
+ min-width: 0;
7991
+ margin-right: -1.4px; /* the letter-spacing after the last letter */
7992
+ overflow: hidden;
7993
+ text-overflow: ellipsis;
7994
+ white-space: nowrap;
7995
+ }
7996
+ /* the band reaches the edge of the card: .mcard clips its content inside the 1px border, so the border is
7997
+ transparent here and painted by the background instead (band colour beside the band, the card's line below).
7998
+ The white starts under the band, else it shines through its rounded corners. */
7999
+ .md3 .mcard--campaign {
8000
+ --card-line: var(--md-outline-variant);
8001
+ border-color: transparent;
8002
+ background: linear-gradient(var(--md-sc-lowest) 0 0) 0 var(--campaign-h) / 100% 100% no-repeat padding-box,
8003
+ var(--campaign-bg) top / 100% calc(var(--campaign-h) + 1px) no-repeat border-box,
8004
+ linear-gradient(var(--card-line) 0 0) border-box;
8005
+ }
8006
+ .md3 .mcard--campaign.mcard--interactive:hover {
8007
+ --card-line: var(--md-sc-lowest); /* .mcard--interactive:hover: no border */
8008
+ }
8009
+ .md3 .listcard > .campaign-band {
8010
+ grid-column: 1 / -1;
8011
+ }
8012
+ /* grid card: the band takes its height from the photo (4:3 + the carousel's 14px, what .cc-media is without
8013
+ a band), so the card is as tall as its neighbours and titles, tabs and prices stay in line */
8014
+ .md3 .cc-card.mcard--campaign .cc-media {
8015
+ aspect-ratio: auto;
8016
+ padding-bottom: calc(75% + 14px - var(--campaign-h));
8017
+ }
8018
+ .md3 .cc-card.mcard--campaign .cc-media .cardcar {
8019
+ position: absolute !important;
8020
+ inset: 0;
8021
+ }
8022
+ /* the campaign's bar right under the site header (campaign/CampaignBar.tsx): the label as on the band, the
8023
+ offer as a link; the whole bar is the link. */
8024
+ .md3 a.campaign-bar {
8025
+ display: flex;
8026
+ align-items: center;
8027
+ justify-content: center;
8028
+ gap: 8px;
8029
+ box-sizing: border-box;
8030
+ min-height: 36px;
8031
+ padding: 8px 16px;
8032
+ background: var(--campaign-bg);
8033
+ color: #fff;
8034
+ font-family: var(--md-font);
8035
+ font-weight: 600;
8036
+ font-size: 14px;
8037
+ line-height: 20px;
8038
+ text-decoration: none;
8039
+ }
8040
+ .md3 .campaign-bar .lucide {
8041
+ flex: none;
8042
+ color: var(--campaign-fg);
8043
+ }
8044
+ .md3 .campaign-bar-label {
8045
+ color: var(--campaign-fg);
8046
+ font-weight: 700;
8047
+ font-size: 13px;
8048
+ letter-spacing: 1.4px;
8049
+ text-transform: uppercase;
8050
+ white-space: nowrap;
8051
+ }
8052
+ .md3 .campaign-bar-offer {
8053
+ text-decoration: underline;
8054
+ text-decoration-color: rgba(255, 255, 255, 0.5);
8055
+ text-underline-offset: 4px;
8056
+ white-space: nowrap;
8057
+ transition: color var(--dur-2) var(--ease-standard), text-decoration-color var(--dur-2) var(--ease-standard);
8058
+ }
8059
+ .md3 a.campaign-bar:focus-visible {
8060
+ outline: 2px solid var(--campaign-fg);
8061
+ outline-offset: -4px;
8062
+ }
8063
+ /* a shine in the campaign's colour runs over the white offer, then rests; still for reduced motion */
8064
+ @keyframes campaign-shine {
8065
+ 0%,
8066
+ 20% {
8067
+ background-position: 100% 0;
8068
+ }
8069
+ 100% {
8070
+ background-position: 0 0;
8071
+ }
8072
+ }
8073
+ @media (prefers-reduced-motion: no-preference) {
8074
+ .md3 .campaign-bar-offer {
8075
+ background: linear-gradient(100deg, #fff 34%, var(--campaign-fg) 46%, var(--campaign-fg) 54%, #fff 66%) 100% 0 / 300% 100% no-repeat;
8076
+ -webkit-background-clip: text;
8077
+ background-clip: text;
8078
+ color: transparent;
8079
+ animation: campaign-shine 2.8s ease-in-out infinite;
8080
+ }
8081
+ }
8082
+ @media (hover: hover) {
8083
+ .md3 .campaign-bar:hover .campaign-bar-offer {
8084
+ background: none;
8085
+ color: var(--campaign-fg);
8086
+ text-decoration-color: currentColor;
8087
+ animation: none;
8088
+ }
8089
+ }
8090
+ @media (max-width: 600px) {
8091
+ .md3 a.campaign-bar {
8092
+ gap: 6px;
8093
+ min-height: 44px;
8094
+ padding: 8px 12px;
8095
+ }
8096
+ .md3 .campaign-bar-label {
8097
+ font-size: 12px;
8098
+ letter-spacing: 0.8px;
8099
+ }
8100
+ }
8101
+ /* the campaign's banner (campaign/CampaignBanner.tsx): text on the campaign's dark background, cars on a wedge in
8102
+ its colour. All of the picture is in .campaign-banner-cars; its clip-path cuts the cars at the sides and the
8103
+ bottom but not at the top, where the car in front may stand out of the frame. The dark background ends under
8104
+ the edge of the wedge, else it shows as a dark hairline around the wedge. */
8105
+ .md3 a.campaign-banner {
8106
+ position: relative;
8107
+ display: block;
8108
+ box-sizing: border-box;
8109
+ min-height: 300px;
8110
+ margin-top: 46px;
8111
+ border-radius: 20px;
8112
+ color: #fff;
8113
+ text-decoration: none;
8114
+ }
8115
+ .md3 a.campaign-banner::before {
8116
+ content: "";
8117
+ position: absolute;
8118
+ inset: 0;
8119
+ border-radius: 20px;
8120
+ background: var(--campaign-bg);
8121
+ clip-path: polygon(0 0, 58.6% 0, 48.6% 100%, 0 100%);
8122
+ }
8123
+ .md3 a.campaign-banner:focus-visible {
8124
+ outline: 3px solid var(--md-primary);
8125
+ outline-offset: 3px;
8126
+ }
8127
+ .md3 .campaign-banner-body {
8128
+ position: relative;
8129
+ box-sizing: border-box;
8130
+ display: flex;
8131
+ flex-direction: column;
8132
+ align-items: flex-start;
8133
+ justify-content: center;
8134
+ width: 38%;
8135
+ min-height: 300px;
8136
+ padding: 24px 0 24px 36px;
8137
+ }
8138
+ .md3 .campaign-banner-period {
8139
+ color: var(--campaign-fg);
8140
+ font-weight: 700;
8141
+ font-size: 12px;
8142
+ line-height: 14px;
8143
+ letter-spacing: 1.4px;
8144
+ text-transform: uppercase;
8145
+ }
8146
+ .md3 .campaign-banner-title {
8147
+ max-width: 6.4em;
8148
+ margin: 10px 0 12px;
8149
+ font-family: var(--md-font-display);
8150
+ font-weight: 700;
8151
+ font-size: clamp(34px, 4.6vw, 56px);
8152
+ line-height: 1;
8153
+ letter-spacing: -0.02em;
8154
+ }
8155
+ .md3 .campaign-banner-text {
8156
+ max-width: 350px;
8157
+ color: #c4c8d0;
8158
+ font-size: 15px;
8159
+ line-height: 21px;
8160
+ }
8161
+ .md3 .campaign-banner-foot {
8162
+ display: flex;
8163
+ flex-wrap: wrap;
8164
+ align-items: center;
8165
+ gap: 12px 18px;
8166
+ margin-top: 22px;
8167
+ }
8168
+ .md3 .campaign-banner-cta {
8169
+ display: inline-flex;
8170
+ align-items: center;
8171
+ justify-content: center;
8172
+ gap: 8px;
8173
+ height: 46px;
8174
+ padding: 0 22px;
8175
+ border-radius: var(--md-r-full);
8176
+ background: var(--campaign-fg);
8177
+ color: #111317;
8178
+ font-weight: 700;
8179
+ font-size: 15px;
8180
+ white-space: nowrap;
8181
+ }
8182
+ .md3 .campaign-banner-cta .lucide {
8183
+ flex: none;
8184
+ transition: transform var(--dur-2) var(--ease-standard);
8185
+ }
8186
+ .md3 .campaign-banner-ends {
8187
+ display: inline-flex;
8188
+ align-items: center;
8189
+ gap: 6px;
8190
+ color: #c4c8d0;
8191
+ font-weight: 600;
8192
+ font-size: 14px;
8193
+ font-variant-numeric: tabular-nums;
8194
+ white-space: nowrap;
8195
+ }
8196
+ .md3 .campaign-banner-ends .lucide {
8197
+ flex: none;
8198
+ color: var(--campaign-fg);
8199
+ }
8200
+ .md3 .campaign-banner-cars {
8201
+ position: absolute;
8202
+ inset: 0;
8203
+ clip-path: inset(-80px 0 0 0 round 20px);
8204
+ pointer-events: none;
8205
+ }
8206
+ /* the wedge and, beside it, two lines at the same angle */
8207
+ .md3 .campaign-banner-cars::before,
8208
+ .md3 .campaign-banner-cars::after {
8209
+ content: "";
8210
+ position: absolute;
8211
+ inset: 0;
8212
+ border-radius: 20px;
8213
+ background: radial-gradient(60% 110% at 72% 36%, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0) 70%),
8214
+ linear-gradient(90deg, rgba(0, 0, 0, 0) 70%, rgba(0, 0, 0, 0.08)), var(--campaign-fg);
8215
+ clip-path: polygon(58% 0, 100% 0, 100% 100%, 48% 100%);
8216
+ }
8217
+ .md3 .campaign-banner-cars::after {
8218
+ background: var(--campaign-fg);
8219
+ clip-path: polygon(56.4% 0, 56.9% 0, 46.9% 100%, 46.4% 100%, 56.4% 0, 55.2% 0, 55.45% 0, 45.45% 100%, 45.2% 100%, 55.2% 0);
8220
+ }
8221
+ .md3 .campaign-banner-car {
8222
+ position: absolute;
8223
+ z-index: 1;
8224
+ display: block;
8225
+ height: auto;
8226
+ }
8227
+ .md3 .campaign-banner-car--1 {
8228
+ z-index: 2;
8229
+ right: 0.6%;
8230
+ bottom: 0;
8231
+ width: 50.5%;
8232
+ }
8233
+ .md3 .campaign-banner-car--2 {
8234
+ right: 25.5%;
8235
+ bottom: 15%;
8236
+ width: 35%;
8237
+ }
8238
+ .md3 .campaign-banner-note {
8239
+ position: absolute;
8240
+ right: 18px;
8241
+ bottom: 12px;
8242
+ z-index: 3;
8243
+ color: rgba(17, 19, 23, 0.74);
8244
+ font-size: 11px;
8245
+ line-height: 14px;
8246
+ }
8247
+ @media (hover: hover) {
8248
+ .md3 a.campaign-banner:hover .campaign-banner-cta .lucide {
8249
+ transform: translateX(4px);
8250
+ }
8251
+ }
8252
+ /* when it comes into view, the cars drive in, once */
8253
+ @media (prefers-reduced-motion: no-preference) {
8254
+ .md3 .campaign-banner-car {
8255
+ transition: transform 1s cubic-bezier(0.16, 0.84, 0.3, 1) 0.12s, opacity 0.4s linear 0.12s;
8256
+ }
8257
+ .md3 .campaign-banner-car--2 {
8258
+ transition-delay: 0.3s;
8259
+ }
8260
+ .md3 .campaign-banner:not(.campaign-banner--in) .campaign-banner-car {
8261
+ opacity: 0;
8262
+ transform: translateX(22%);
8263
+ }
8264
+ @media (hover: hover) {
8265
+ .md3 a.campaign-banner--in:hover .campaign-banner-car--1 {
8266
+ transform: translateX(-10px);
8267
+ transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
8268
+ }
8269
+ .md3 a.campaign-banner--in:hover .campaign-banner-car--2 {
8270
+ transform: translateX(-4px);
8271
+ transition: transform 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
8272
+ }
8273
+ }
8274
+ }
8275
+ /* tablet: one car */
8276
+ @media (max-width: 900px) {
8277
+ .md3 a.campaign-banner,
8278
+ .md3 .campaign-banner-body {
8279
+ min-height: 280px;
8280
+ }
8281
+ .md3 a.campaign-banner {
8282
+ margin-top: 16px;
8283
+ }
8284
+ .md3 .campaign-banner-body {
8285
+ width: 44%;
8286
+ padding-left: 28px;
8287
+ }
8288
+ .md3 .campaign-banner-car--1 {
8289
+ right: -2%;
8290
+ width: 56%;
8291
+ }
8292
+ .md3 .campaign-banner-car--2 {
8293
+ display: none;
8294
+ }
8295
+ }
8296
+ /* phone: text above, cars below on a wedge over the whole width */
8297
+ @media (max-width: 600px) {
8298
+ .md3 a.campaign-banner {
8299
+ min-height: 0;
8300
+ margin-top: 14px;
8301
+ }
8302
+ .md3 a.campaign-banner::before {
8303
+ clip-path: inset(0 0 40px);
8304
+ }
8305
+ .md3 .campaign-banner-body {
8306
+ width: auto;
8307
+ min-height: 0;
8308
+ padding: 24px 20px calc(58% + 10px);
8309
+ }
8310
+ .md3 .campaign-banner-title {
8311
+ font-size: 42px;
8312
+ }
8313
+ .md3 .campaign-banner-foot {
8314
+ width: 100%;
8315
+ margin-top: 18px;
8316
+ }
8317
+ .md3 .campaign-banner-cta {
8318
+ height: 48px;
8319
+ }
8320
+ .md3 .campaign-banner-cars {
8321
+ inset: auto 0 0;
8322
+ height: 0;
8323
+ padding-bottom: 62%;
8324
+ clip-path: inset(-80px 0 0 0 round 0 0 20px 20px);
8325
+ }
8326
+ .md3 .campaign-banner-cars::before {
8327
+ border-radius: 0 0 20px 20px;
8328
+ clip-path: polygon(0 52%, 100% 18%, 100% 100%, 0 100%);
8329
+ }
8330
+ .md3 .campaign-banner-cars::after {
8331
+ border-radius: 0;
8332
+ clip-path: polygon(0 47%, 100% 13%, 100% 14.4%, 0 48.4%, 0 47%, 0 44%, 100% 10%, 100% 10.7%, 0 44.7%, 0 44%);
8333
+ }
8334
+ .md3 .campaign-banner-car--1 {
8335
+ right: -2%;
8336
+ bottom: 3%;
8337
+ width: 80%;
8338
+ }
8339
+ .md3 .campaign-banner-car--2 {
8340
+ display: block;
8341
+ right: 41%;
8342
+ bottom: 21%;
8343
+ width: 56%;
8344
+ }
8345
+ .md3 .campaign-banner-note {
8346
+ right: 14px;
8347
+ bottom: 8px;
8348
+ }
8349
+ }
8350
+ /* "only the campaign's cars" above the filters of /search (campaign/CampaignSwitch.tsx), the design's dark card:
8351
+ the same light veil over the campaign's background as the hero's tiles. 13px, not the rail's 14px: the label
8352
+ has to stay on one line in the 244px rail. */
8353
+ .md3 .campaign-switch {
8354
+ overflow: hidden;
8355
+ border-radius: var(--md-r-md);
8356
+ background: linear-gradient(rgba(255, 255, 255, 0.04) 0 0), var(--campaign-bg);
8357
+ color: #fff;
8358
+ }
8359
+ .md3 .campaign-switch .mswitch {
8360
+ display: flex;
8361
+ flex-direction: row-reverse;
8362
+ align-items: center;
8363
+ justify-content: space-between;
8364
+ gap: 8px;
8365
+ padding: 12px;
8366
+ }
8367
+ .md3 .campaign-switch .mswitch-label {
8368
+ flex: 1;
8369
+ min-width: 0;
8370
+ color: inherit;
8371
+ font-weight: 700;
8372
+ font-size: 13px;
8373
+ line-height: 18px;
8374
+ }
8375
+ .md3 .campaign-switch-count {
8376
+ display: block;
8377
+ margin-top: 2px;
8378
+ color: #c4c8d0;
8379
+ font-weight: 400;
8380
+ font-size: 12px;
8381
+ line-height: 16px;
8382
+ }
8383
+ .md3 .campaign-switch .mswitch-track {
8384
+ flex: none;
8385
+ width: 40px;
8386
+ height: 24px;
8387
+ background: rgba(255, 255, 255, 0.28);
8388
+ }
8389
+ .md3 .campaign-switch .mswitch-thumb {
8390
+ width: 18px;
8391
+ height: 18px;
8392
+ }
8393
+ .md3 .campaign-switch .mswitch input:checked + .mswitch-track {
8394
+ background: var(--campaign-fg);
8395
+ }
8396
+ .md3 .campaign-switch .mswitch input:checked + .mswitch-track .mswitch-thumb {
8397
+ background: linear-gradient(rgba(255, 255, 255, 0.04) 0 0), var(--campaign-bg);
8398
+ transform: translateX(16px);
8399
+ }
8400
+ .md3 .campaign-switch .mswitch input:focus-visible + .mswitch-track {
8401
+ outline: 2px solid #fff;
8402
+ outline-offset: 2px;
8403
+ }
8404
+ /* an invitation to turn it on: every few seconds the thumb peeks over and the track lights up with a ring. Quiet
8405
+ under the pointer, with the keyboard focus and once it is on; turning it on answers with one ring. */
8406
+ @keyframes campaign-switch-peek {
8407
+ 0%,
8408
+ 58%,
8409
+ 86%,
8410
+ 100% {
8411
+ transform: translateX(0);
8412
+ }
8413
+ 65% {
8414
+ transform: translateX(11px);
8415
+ }
8416
+ 73% {
8417
+ transform: translateX(0);
8418
+ }
8419
+ 79% {
8420
+ transform: translateX(6px);
8421
+ }
8422
+ }
8423
+ @keyframes campaign-switch-glow {
8424
+ 0%,
8425
+ 58%,
8426
+ 92%,
8427
+ 100% {
8428
+ background-color: rgba(255, 255, 255, 0.28);
8429
+ box-shadow: 0 0 0 0 transparent;
8430
+ }
8431
+ 65% {
8432
+ background-color: color-mix(in srgb, var(--campaign-fg) 82%, transparent);
8433
+ box-shadow: 0 0 0 0 color-mix(in srgb, var(--campaign-fg) 70%, transparent);
8434
+ }
8435
+ 80% {
8436
+ box-shadow: 0 0 0 9px transparent;
8437
+ }
8438
+ }
8439
+ @keyframes campaign-switch-on {
8440
+ from {
8441
+ box-shadow: 0 0 0 0 color-mix(in srgb, var(--campaign-fg) 80%, transparent);
8442
+ }
8443
+ to {
8444
+ box-shadow: 0 0 0 11px transparent;
8445
+ }
8446
+ }
8447
+ @media (prefers-reduced-motion: no-preference) {
8448
+ .md3 .campaign-switch .mswitch-thumb {
8449
+ transition: transform 0.28s cubic-bezier(0.3, 1.5, 0.5, 1), background 0.15s;
8450
+ }
8451
+ .md3 .campaign-switch .mswitch input:not(:checked) + .mswitch-track {
8452
+ animation: campaign-switch-glow 4s ease-in-out 1s infinite;
8453
+ }
8454
+ .md3 .campaign-switch .mswitch input:not(:checked) + .mswitch-track .mswitch-thumb {
8455
+ animation: campaign-switch-peek 4s ease-in-out 1s infinite;
8456
+ }
8457
+ .md3 .campaign-switch .mswitch input:checked + .mswitch-track {
8458
+ animation: campaign-switch-on 0.6s ease-out;
8459
+ }
8460
+ .md3 .campaign-switch .mswitch input:not(:checked):focus-visible + .mswitch-track,
8461
+ .md3 .campaign-switch .mswitch input:not(:checked):focus-visible + .mswitch-track .mswitch-thumb {
8462
+ animation: none;
8463
+ }
8464
+ }
8465
+ @media (hover: hover) {
8466
+ .md3 .campaign-switch:hover .mswitch input:not(:checked) + .mswitch-track {
8467
+ background: color-mix(in srgb, var(--campaign-fg) 60%, transparent);
8468
+ animation: none;
8469
+ }
8470
+ .md3 .campaign-switch:hover .mswitch input:not(:checked) + .mswitch-track .mswitch-thumb {
8471
+ transform: translateX(5px);
8472
+ animation: none;
8473
+ }
8474
+ }
8475
+ @media (max-width: 980px) {
8476
+ .md3 .campaign-switch .mswitch {
8477
+ padding: 12px 16px;
8478
+ }
8479
+ .md3 .campaign-switch .mswitch-label {
8480
+ font-size: 15px;
8481
+ line-height: 20px;
8482
+ }
8483
+ .md3 .campaign-switch-count {
8484
+ font-size: 13px;
8485
+ }
8486
+ }
8487
+ /* gallery of the vehicle page: the band lies above the photo, which keeps its size at every breakpoint (the
8488
+ height / aspect-ratio of .vdp-gallerybox are the photo's here). Everything that lies on the photo is inside
8489
+ .vdp-gallery-photo, so it moves down with it. */
8490
+ .md3 .vdp-gallery-photo {
8491
+ position: relative;
8492
+ height: 100%;
8493
+ }
8494
+ .md3 .vdp-gallerybox.mcard--campaign {
8495
+ box-sizing: content-box;
8496
+ padding-top: var(--campaign-h);
8497
+ }
8498
+ .md3 .vdp-gallerybox > .campaign-band {
8499
+ position: absolute;
8500
+ top: 0;
8501
+ right: 0;
8502
+ left: 0;
8503
+ }
8504
+ /* phone: the gallery reaches up to the campaign's bar under the header, so the band changes its colours, else both
8505
+ run together into one block */
8506
+ @media (max-width: 600px) {
8507
+ .md3 .vdp-gallerybox > .campaign-band {
8508
+ background: var(--campaign-fg);
8509
+ color: #111317;
8510
+ }
8511
+ }
8512
+ /* campaign hero above the results of /search (campaign/CampaignHero.tsx): period, headline and the countdown.
8513
+ Design "auto.de SRL Black Friday", A · Dark Edition. The tiles and the rule are a light veil over the
8514
+ campaign's background, so they suit any dark one (on Black Friday's #111317 they are the design's #22252c
8515
+ and #2c3038). */
8516
+ .md3 .campaign-hero {
8517
+ display: grid;
8518
+ grid-template-columns: minmax(0, 1fr) auto;
8519
+ align-items: center;
8520
+ gap: 24px;
8521
+ margin: 20px 0 10px;
8522
+ padding: 28px 32px;
8523
+ border-radius: 20px;
8524
+ background: var(--campaign-bg);
8525
+ color: #fff;
8526
+ overflow: hidden;
8527
+ }
8528
+ .md3 .campaign-hero-period {
8529
+ color: var(--campaign-fg);
8530
+ font-weight: 700;
8531
+ font-size: 12px;
8532
+ line-height: 12px;
8533
+ letter-spacing: 1.4px;
8534
+ text-transform: uppercase;
8535
+ }
8536
+ .md3 .campaign-hero-title {
8537
+ margin: 8px 0 6px;
8538
+ color: inherit;
8539
+ font-family: var(--md-font-display);
8540
+ font-weight: 700;
8541
+ font-size: 40px;
8542
+ line-height: 1.05;
8543
+ letter-spacing: -0.8px;
8544
+ }
8545
+ .md3 .campaign-hero-text {
8546
+ max-width: 520px;
8547
+ margin: 0;
8548
+ color: #c4c8d0;
8549
+ font-size: 15px;
8550
+ line-height: 20px;
8551
+ text-wrap: balance;
8552
+ }
8553
+ .md3 .campaign-hero-timer {
8554
+ display: flex;
8555
+ gap: 8px;
8556
+ }
8557
+ .md3 .campaign-hero-unit {
8558
+ width: 68px;
8559
+ padding: 10px 0 12px;
8560
+ border-radius: 12px;
8561
+ background: rgba(214, 226, 255, 0.087);
8562
+ text-align: center;
8563
+ }
8564
+ .md3 .campaign-hero-unit b {
8565
+ display: block;
8566
+ font-family: var(--md-font-display);
8567
+ font-weight: 700;
8568
+ font-size: 28px;
8569
+ line-height: 28px;
8570
+ font-variant-numeric: tabular-nums;
8571
+ }
8572
+ .md3 .campaign-hero-unit small {
8573
+ display: block;
8574
+ margin-top: 5px;
8575
+ color: #9aa0ac;
8576
+ font-size: 11px;
8577
+ line-height: 14px;
8578
+ letter-spacing: 0.6px;
8579
+ text-transform: uppercase;
8580
+ }
8581
+ .md3 .campaign-hero-legal {
8582
+ grid-column: 1 / -1;
8583
+ padding-top: 12px;
8584
+ border-top: 1px solid rgba(214, 226, 255, 0.14);
8585
+ color: #9aa0ac;
8586
+ font-size: 11px;
8587
+ line-height: 14px;
8588
+ }
8589
+ @media (max-width: 900px) {
8590
+ .md3 .campaign-hero {
8591
+ grid-template-columns: minmax(0, 1fr);
8592
+ }
8593
+ .md3 .campaign-hero-title {
8594
+ font-size: 32px;
8595
+ }
8596
+ }
8597
+ @media (max-width: 600px) {
8598
+ .md3 .campaign-hero {
8599
+ margin: 14px 0 8px;
8600
+ padding: 22px 20px;
8601
+ }
8602
+ .md3 .campaign-hero-unit {
8603
+ width: 58px;
8604
+ }
8605
+ }
8606
+
7961
8607
  /* horizontal listing card (SRP): image | info | price */
7962
8608
  .md3 .listcard {
7963
8609
  display: grid;
@@ -15018,6 +15664,10 @@ color: #005CFF;
15018
15664
  border-color: #d4dde7;
15019
15665
  box-shadow: 0px 3px 14px 0px rgba(14, 34, 56, 0.09);
15020
15666
  }
15667
+ .md3 .cc-card.mcard--campaign {
15668
+ --card-line: #d4dde7;
15669
+ border-color: transparent;
15670
+ }
15021
15671
 
15022
15672
  /* favorite heart + top-left badge stack position (Figma: heart top15/right11 of a 362-wide
15023
15673
  card; badge stack starts top15, row gap 8 between the chip row and the Angebot badge). */