@bytebrand/fe-ui-core-autobahn 1.0.189 → 1.0.190

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.
Files changed (42) hide show
  1. package/cards/CarCard.tsx +388 -391
  2. package/cards/CarRow.tsx +1 -5
  3. package/cards/cardParts.tsx +4 -6
  4. package/cards/index.ts +0 -6
  5. package/chrome/Footer.tsx +3 -16
  6. package/chrome/TopBar.tsx +266 -139
  7. package/compat/CookieModal/CookieModal.tsx +6 -20
  8. package/compat/CookieModal/Modal.tsx +3 -6
  9. package/compat/CookieModal/modals/ManageCookieModal/ManageCookieModal.tsx +15 -43
  10. package/compat/CookieModal/modals/PreviewCookieModal/PreviewCookieModal.tsx +3 -4
  11. package/compat/CookieModal/useModal.ts +1 -5
  12. package/compat/Loader/Loader.tsx +7 -1
  13. package/compat/MdField/MdField.tsx +4 -28
  14. package/compat/TimePicker/TimePicker.tsx +2 -12
  15. package/data/toAutobahnCar.ts +2 -16
  16. package/iconsvg/IconSVG.tsx +5 -1
  17. package/locales/de/autobahn.json +12 -43
  18. package/locales/en/autobahn.json +10 -41
  19. package/package.json +30 -30
  20. package/theme/md3.css +11573 -15526
  21. package/ui/CreditCostNotice.tsx +43 -0
  22. package/ui/Dropdown.tsx +10 -29
  23. package/ui/FormCheckbox.tsx +2 -22
  24. package/ui/FormField.tsx +1 -2
  25. package/ui/Icon.tsx +0 -6
  26. package/ui/Modal.tsx +6 -84
  27. package/ui/Skeleton.tsx +20 -79
  28. package/ui/index.ts +3 -2
  29. package/ui/usePortalMenuPosition.ts +15 -27
  30. package/utils/index.ts +0 -10
  31. package/vdp/FinanceCalculator.tsx +11 -20
  32. package/vdp/VdpModules.tsx +15 -37
  33. package/vdp/types.ts +5 -5
  34. package/vehiclesProps/decoratedLightProps.tsx +0 -4
  35. package/vehiclesProps/decoratedProps.tsx +0 -4
  36. package/cards/CarCardSkeleton.tsx +0 -103
  37. package/cards/CarRowSkeleton.tsx +0 -152
  38. package/chrome/AccountMenuIcon.tsx +0 -109
  39. package/ui/MfieldCheckIcon.tsx +0 -13
  40. package/ui/scrollFieldIntoView.ts +0 -41
  41. package/utils/cookieConsent.ts +0 -84
  42. package/vehiclesProps/accidentDisclosure.ts +0 -25
@@ -13,10 +13,10 @@
13
13
  //
14
14
  // Renders correctly only inside a `<div className="md3">` subtree.
15
15
 
16
- import React, { useState, useEffect } from 'react';
16
+ import React, { useState } from 'react';
17
17
  import { TranslationFunction } from '../types';
18
18
 
19
- import { Button, Icon, Switch } from '../ui';
19
+ import { Button, Icon, Switch, CreditCostNotice } from '../ui';
20
20
  import { TIER_LABELS, TIER_KEYS, TIER_COLORS } from '../constants';
21
21
 
22
22
  /** Payment mode segment keys. Mirrors the design's ['fin','leasing','cash']. */
@@ -52,18 +52,8 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
52
52
  bubble,
53
53
  bubblePaddingBottom = 34,
54
54
  }) => {
55
- // Local mirror of `value`, updated INSTANTLY on every native input event. Callers commonly
56
- // debounce their own onChange (e.g. CheckoutFinancePanelNext's 50ms setCommonUserConfig,
57
- // which also triggers a MobX-driven re-render of a much bigger subtree) — without this, the
58
- // thumb still drags natively/smoothly (the browser owns that), but the gradient fill and any
59
- // bubble label are driven by the `value` PROP, which only catches up once the debounced commit
60
- // finally lands, so the fill visibly lags/stutters behind the thumb during a fast drag. Synced
61
- // back to the prop via useEffect for externally-driven changes (e.g. a reset button).
62
- const [localValue, setLocalValue] = useState(value);
63
- useEffect(() => { setLocalValue(value); }, [value]);
64
-
65
55
  const span = max - min;
66
- const pct = span > 0 ? ((localValue - min) / span) * 100 : 0;
56
+ const pct = span > 0 ? ((value - min) / span) * 100 : 0;
67
57
  return (
68
58
  <div>
69
59
  <div style={{ position: 'relative', paddingTop: bubble ? 44 : 0, paddingBottom: bubble ? bubblePaddingBottom : 0 }}>
@@ -71,7 +61,7 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
71
61
  // thumb is 22px wide: interpolate the bubble anchor between half-thumb insets so it
72
62
  // tracks the thumb center (a plain pct% drifts at the rail ends)
73
63
  <span className="slider-bubble num" style={{ left: `calc(11px + (100% - 22px) * ${pct / 100})` }}>
74
- {fmt(localValue)}
64
+ {fmt(value)}
75
65
  </span>
76
66
  )}
77
67
  <input
@@ -80,12 +70,8 @@ export const Slider: React.FunctionComponent<SliderProps> = ({
80
70
  min={min}
81
71
  max={max}
82
72
  step={step}
83
- value={localValue}
84
- onChange={(e) => {
85
- const v = Number(e.target.value);
86
- setLocalValue(v);
87
- onChange(v);
88
- }}
73
+ value={value}
74
+ onChange={(e) => onChange(Number(e.target.value))}
89
75
  style={{ background: `linear-gradient(90deg, var(--md-primary) ${pct}%, var(--md-sc-highest) ${pct}%)` }}
90
76
  />
91
77
  </div>
@@ -885,6 +871,11 @@ const FinanceCalculator: React.FunctionComponent<FinanceCalculatorProps> = ({
885
871
  )}
886
872
  </div>
887
873
 
874
+ {/* ADV-405/406 Kreditkosten-Hinweis — Preis-Card (mobile) + „Dein Angebot“ (desktop): below the
875
+ conditions line, above „Angebot anfragen“/„Anrufen“ (mobile) or „Rate anpassen“ (desktop).
876
+ Not on Kaufen (no reserved space — the Kaufen view stays exactly as before). */}
877
+ {!isCash && <CreditCostNotice t={t} cls="fin-ccn" />}
878
+
888
879
  {/* ============================== DESKTOP (≥601px) — unchanged ============================== */}
889
880
  <div className="hide-mobile">
890
881
  {/* RATE EDIT (Rate anpassen) — between the rate and the request CTA. fin-adjust--cash:
@@ -24,7 +24,7 @@
24
24
  import React, { useState } from 'react';
25
25
  import { TranslationFunction } from '../types';
26
26
 
27
- import { Button, Dropdown, DropdownOption, Icon, Spec, StatChip, Stars } from '../ui';
27
+ import { Button, CreditCostNotice, Dropdown, DropdownOption, Icon, Spec, StatChip, Stars } from '../ui';
28
28
  import { CO2_CLASSES, CO2_COLORS, TIER_LABELS, TIER_KEYS, TIER_COLORS, TIER_BACKGROUNDS } from '../constants';
29
29
  import { defaultVdpSpecs, EquipmentGroups, PriceRatingBands, VehicleDetail, VdpSpec, VdpReview, RunningCostRow, EnergyTaxSummary } from './types';
30
30
  import { AddServicesTooltipBody, CalcRow, DocCheckIcon, EvalBar, expanderBtnStyle, FinanceMode, Slider, TermChips, ToggleRow } from './FinanceCalculator';
@@ -92,7 +92,7 @@ export const VdpHeaderSummary: React.FunctionComponent<VdpHeaderCardProps> = ({
92
92
  ['zap', extractPS(vehicle.power)],
93
93
  ['fuel', stripParen(vehicle.fuel)],
94
94
  ['cog', vehicle.gear],
95
- ...(vehicle.owners == null ? [] : ([['user', t('autobahn:header.owners', { owners: vehicle.owners, count: vehicle.owners })]] as const)),
95
+ ['user', t('autobahn:header.owners', { owners: vehicle.owners, count: vehicle.owners })],
96
96
  ];
97
97
  return (
98
98
  <>
@@ -142,7 +142,7 @@ export const VdpFactsGrid: React.FunctionComponent<VdpHeaderCardProps> = ({ vehi
142
142
  ['calendar', vehicle.reg],
143
143
  ['cog', vehicle.gear],
144
144
  ['fuel', stripParen(vehicle.fuel)],
145
- ...(vehicle.owners == null ? [] : ([['user', t('autobahn:header.owners', { owners: vehicle.owners, count: vehicle.owners })]] as const)),
145
+ ['user', t('autobahn:header.owners', { owners: vehicle.owners, count: vehicle.owners })],
146
146
  ...(vehicle.body ? ([['car-front', vehicle.body]] as const) : []),
147
147
  ];
148
148
  return (
@@ -216,7 +216,7 @@ export const VdpHeaderCondition: React.FunctionComponent<VdpHeaderCardProps> = (
216
216
  // only the Garantie tile has one, linking out to auto.de's warranty policy page.
217
217
  const tiles: ReadonlyArray<readonly [string, string, string, string?]> = [
218
218
  ['wrench', t('autobahn:header.huLabel'), condition.hu === 'Neu' ? t('autobahn:header.huNew') : t('autobahn:header.huUntil', { date: condition.hu })],
219
- ['shield-check', t('autobahn:header.accidentFree'), condition.unfallfrei == null ? t('autobahn:header.notSpecified', { defaultValue: 'keine Angabe' }) : condition.unfallfrei ? t('autobahn:header.yes') : t('autobahn:header.no')],
219
+ ['shield-check', t('autobahn:header.accidentFree'), condition.unfallfrei ? t('autobahn:header.yes') : t('autobahn:header.no')],
220
220
  ['clipboard-check', t('autobahn:header.serviceHistory'), condition.scheckheft ? t('autobahn:header.yes') : t('autobahn:header.no')],
221
221
  ['award', t('autobahn:header.warranty'), condition.garantie, 'https://www.auto.de/garantie/'],
222
222
  ];
@@ -1943,6 +1943,8 @@ export const VdpBottomBar: React.FunctionComponent<VdpBottomBarProps> = ({
1943
1943
  )}
1944
1944
  </div>
1945
1945
  )}
1946
+ {/* ADV-405/406 Kreditkosten-Hinweis (Sticky Footer): below the conditions line, above the CTAs. */}
1947
+ {!isCash && <CreditCostNotice t={t} cls="bb-ccn" />}
1946
1948
  <div className="bb-cta-row">
1947
1949
  <Button
1948
1950
  variant="filled"
@@ -2126,12 +2128,6 @@ export interface FinanceDetailsModalProps {
2126
2128
  /** opened directly via the page's Finanzierungs-/Leasingdetails link — the sheet opens
2127
2129
  * scrolled to the breakdown instead of the "Rate anpassen" controls at its top. */
2128
2130
  initialShowBreakdown?: boolean;
2129
- /** skips the smooth scrollIntoView/scrollSheetToBreakdown animation initialShowBreakdown
2130
- * otherwise triggers on open (still sets showBreakdown itself) — for a consumer whose sheet
2131
- * has nothing ABOVE the breakdown to scroll past (e.g. checkout's stripped-down instance,
2132
- * with the rate hero/sliders/toggles above it hidden), that animation has nowhere real to go
2133
- * and only reads as a stray jump. */
2134
- skipInitialScroll?: boolean;
2135
2131
  /** mobile only — price-rating label, drives the eval pill/bar (same as the collapsed card). */
2136
2132
  ratingLabel?: string;
2137
2133
  /** Kaufen tab only — real carStore.isAvailable (same source as VdpTrustRow's "Sofort
@@ -2160,10 +2156,6 @@ export interface FinanceDetailsModalProps {
2160
2156
  leasingAvailable?: boolean;
2161
2157
  /** i18n function (drilled from the page). */
2162
2158
  t: TranslationFunction;
2163
- /** overrides the desktop dialog heading (default: the mode's own, shorter "Details" text) —
2164
- * a consumer whose own trigger already carries a specific label (e.g. checkout's cf-details
2165
- * button, "Finanzierungsdetails"/"Leasingdetails") can pass that same text through here. */
2166
- titleOverride?: string;
2167
2159
  }
2168
2160
 
2169
2161
  /**
@@ -2207,7 +2199,6 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2207
2199
  onAnnualMileageChange,
2208
2200
  onClose,
2209
2201
  initialShowBreakdown,
2210
- skipInitialScroll,
2211
2202
  ratingLabel,
2212
2203
  available,
2213
2204
  onModeChange,
@@ -2222,7 +2213,6 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2222
2213
  onToggleAddServices,
2223
2214
  leasingAvailable = true,
2224
2215
  t,
2225
- titleOverride,
2226
2216
  }) => {
2227
2217
  // same "UVP-Rate"/list-price footnote badge + popover as FinanceCalculator's own hero — this
2228
2218
  // modal's mobile "Rate anpassen" sheet renders its own separate copy of that hero row, so it
@@ -2326,14 +2316,14 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2326
2316
  React.useEffect(() => {
2327
2317
  if (!open) return;
2328
2318
  setShowBreakdown(!!initialShowBreakdown);
2329
- if (!initialShowBreakdown || skipInitialScroll) return;
2319
+ if (!initialShowBreakdown) return;
2330
2320
  const timer = window.setTimeout(() => {
2331
2321
  if (mobileBreakdownRef.current?.offsetParent) scrollSheetToBreakdown();
2332
2322
  else desktopBreakdownRef.current?.scrollIntoView({ behavior: 'smooth', block: 'start' });
2333
2323
  }, 50);
2334
2324
  return () => window.clearTimeout(timer);
2335
2325
  // eslint-disable-next-line react-hooks/exhaustive-deps
2336
- }, [open, initialShowBreakdown, skipInitialScroll]);
2326
+ }, [open, initialShowBreakdown]);
2337
2327
  // in-sheet details link: expanding scrolls down to the breakdown, collapsing back to the top.
2338
2328
  const revealBreakdownRef = React.useRef(false);
2339
2329
  React.useEffect(() => {
@@ -2343,24 +2333,6 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2343
2333
  else animateSheetScroll(() => 0);
2344
2334
  }, [showBreakdown, scrollSheetToBreakdown, animateSheetScroll]);
2345
2335
 
2346
- // iOS Safari (26+, "Allow Website Tinting") paints its bottom toolbar area with the page's
2347
- // <meta name="theme-color"> (site-wide blue #005CCB) — under the open white sheet that showed
2348
- // as a solid blue band right below the CTA. While the sheet is open, theme-color is white;
2349
- // on close the previous value(s) are restored. Other pages/states are untouched.
2350
- React.useEffect(() => {
2351
- if (!open || typeof document === 'undefined') return;
2352
- const metas = Array.from(document.querySelectorAll<HTMLMetaElement>('meta[name="theme-color"]'));
2353
- const prev = metas.map((m) => m.getAttribute('content'));
2354
- metas.forEach((m) => m.setAttribute('content', '#FFFFFF'));
2355
- return () => {
2356
- metas.forEach((m, i) => {
2357
- const v = prev[i];
2358
- if (v == null) m.removeAttribute('content');
2359
- else m.setAttribute('content', v);
2360
- });
2361
- };
2362
- }, [open]);
2363
-
2364
2336
  // mobile-only: swipe-down-to-dismiss on the grabber/header (the mockup's drag handle).
2365
2337
  // The sheet follows the finger (imperative transform — no re-renders while dragging);
2366
2338
  // released past 90px it slides out and closes, otherwise it springs back. The element
@@ -2401,7 +2373,7 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2401
2373
  if (!open) return null;
2402
2374
  const isLease = mode === 'leasing';
2403
2375
  const isCash = mode === 'cash';
2404
- const title = titleOverride || (isLease ? t('autobahn:modal.leasingDetails') : t('autobahn:modal.financingDetails'));
2376
+ const title = isLease ? t('autobahn:modal.leasingDetails') : t('autobahn:modal.financingDetails');
2405
2377
  const mobileTitle = isCash
2406
2378
  ? t('autobahn:modal.sheetTitleCash')
2407
2379
  : isLease
@@ -2791,6 +2763,10 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
2791
2763
  <div className="fin-eval-bar-cell">{ratingLabel && <EvalBar tier={evalTier} />}</div>
2792
2764
  </div>
2793
2765
  </div>
2766
+ {/* ADV-405/406/410 Kreditkosten-Hinweis — directly below the price block at the top of the
2767
+ layer. Checkout hides .fin-price-grid (md3.css .cf-fin-details-modal), so there this same
2768
+ element is the first body element, right above „Repräsentatives Beispiel“. */}
2769
+ {!isCash && <CreditCostNotice t={t} cls="fin-modal-ccn" />}
2794
2770
  {/* adjustment sliders — change a value and every figure below recomputes live (via the page) */}
2795
2771
  {adjustable && (
2796
2772
  <div style={{ display: 'flex', flexDirection: 'column', gap: 16, marginBottom: 18 }}>
@@ -3322,6 +3298,8 @@ export const FinanceDetailsModal: React.FunctionComponent<FinanceDetailsModalPro
3322
3298
  <div className="fin-eval-bar-cell">{ratingLabel && <EvalBar tier={evalTier} />}</div>
3323
3299
  </div>
3324
3300
  </div>
3301
+ {/* ADV-405/406/410 Kreditkosten-Hinweis (mobile sheet) — same placement as the desktop dialog above. */}
3302
+ {!isCash && <CreditCostNotice t={t} cls="fin-modal-ccn" />}
3325
3303
 
3326
3304
  {isCash ? (
3327
3305
  <>
package/vdp/types.ts CHANGED
@@ -111,8 +111,8 @@ export interface Co2CostsSummary {
111
111
  export interface VehicleCondition {
112
112
  /** TÜV/HU validity, e.g. '03/2027' — or 'Neu' for a new HU. */
113
113
  hu: string;
114
- /** accident-free flag (Unfallfrei); null = not specified by the source ("keine Angabe"). */
115
- unfallfrei: boolean | null;
114
+ /** accident-free flag (Unfallfrei). */
115
+ unfallfrei: boolean;
116
116
  /** full service history (Scheckheftgepflegt). */
117
117
  scheckheft: boolean;
118
118
  /** warranty label, e.g. '12 Monate inkl.'. */
@@ -191,8 +191,8 @@ export interface VehicleDetail {
191
191
  fuel: string;
192
192
  /** gearbox label, e.g. 'Automatik' / 'Schaltgetriebe'. */
193
193
  gear: string;
194
- /** number of previous owners (rendered as 'N. Hand'); null = not known, the fact is not shown. */
195
- owners: number | null;
194
+ /** number of previous owners (rendered as 'N. Hand'). */
195
+ owners: number;
196
196
  /** number of seats. */
197
197
  seats: number;
198
198
  /** number of doors. */
@@ -302,7 +302,7 @@ export function defaultVdpSpecs(v: VehicleDetail): VdpSpec[] {
302
302
  [['cog', 'Getriebe', v.gear], true],
303
303
  [['users', 'Sitze', `${v.seats} Sitze`], false],
304
304
  [['door-open', 'Türen', `${v.doors} Türen`], false],
305
- ...(v.owners == null ? [] : [[['user', 'Halter', `${v.owners}. Hand`], true] as const]), // 0 Vorbesitzer is valid
305
+ [['user', 'Halter', `${v.owners}. Hand`], true], // 0 Vorbesitzer is valid
306
306
  [['palette', 'Außenfarbe', v.color], true],
307
307
  [['car-front', 'Karosserie', v.body], true],
308
308
  [['droplet', 'Verbrauch komb.', v.cons], true], // Pkw-EnVKV — exempt from this rule
@@ -6,7 +6,6 @@ import { formatTimestamp } from '../utils/DateUtils';
6
6
  import { DELIVERY_PERIODS_EXTRA } from '../constants/core';
7
7
  import moment from 'moment';
8
8
  import { IDecoratedProp } from '../types/types';
9
- import { strictAccidentStatus } from './accidentDisclosure';
10
9
  import { gasConsumptionTemplate } from './cbdSelectors';
11
10
 
12
11
  interface IDecoratedProps {
@@ -521,9 +520,6 @@ const getDecoratedLightProps = (
521
520
  title: t('cbd:mainData_accidentDamaged'),
522
521
  icon: 'wrench',
523
522
  get value() {
524
- const strict = strictAccidentStatus(car);
525
- if (strict === 'notSpecified') return t('vehicleProps:value.na');
526
- if (strict) return strict === 'accident' ? t('vehicleProps:value.damaged') : t('vehicleProps:value.accidentFree');
527
523
  return damaged ? t('vehicleProps:value.damaged') : t('vehicleProps:value.accidentFree');
528
524
  }
529
525
  },
@@ -9,7 +9,6 @@ import { EMISSION_STICKERS_ICONS, WP_EMISSION_STICKERS_ICONS } from '../constant
9
9
  import { DELIVERY_PERIODS_EXTRA } from '../constants';
10
10
  import { IDecoratedProp, ICar, IFinancingUtils } from '../types/types';
11
11
  import { getFormattedPrice } from '../utils/CommonUtils';
12
- import { strictAccidentStatus } from './accidentDisclosure';
13
12
  import { gasConsumptionTemplate } from './cbdSelectors';
14
13
 
15
14
  const formatDeliveryPeriod = (t: (key: string, options?: object) => string, deliveryPeriod: string) => {
@@ -197,9 +196,6 @@ const getDecoratedProps = (
197
196
  title: t('cbd:mainData_accidentDamaged'),
198
197
  icon: 'wrench',
199
198
  get value() {
200
- const strict = strictAccidentStatus(car);
201
- if (strict === 'notSpecified') return t('vehicleProps:value.na');
202
- if (strict) return strict === 'accident' ? t('vehicleProps:value.damaged') : t('vehicleProps:value.accidentFree');
203
199
  return damaged ? t('vehicleProps:value.damaged') : t('vehicleProps:value.accidentFree');
204
200
  }
205
201
  },
@@ -1,103 +0,0 @@
1
- // Autobahn (auto.de redesign) — CarCard loading placeholder.
2
- //
3
- // The shape of a CarCard while its data is on the way: the same card chrome (.mcard
4
- // .cc-card — border, 18px radius, shadow) and, inside it, the card's own parts as
5
- // skeleton bars on the line boxes CarCard's CSS gives them, so a grid of these is as
6
- // tall as the grid of cards that replaces it and nothing below jumps:
7
- // - photo: 4:3 plus the carousel's 14px (that's how tall .cc-media really renders), on
8
- // the lighter --md-sc-low so the big area stays calm and the text bars read as content
9
- // - title 24/27 (+6), trim 13/17 (+6), spec line 11/15 (+10)
10
- // - price block on its hairline: tabs (39, +12), rate + price rating (58), terms (2 × 17)
11
- // - phones (≤600, .show-mobile): the CTA row (9 + 40)
12
- // - eco line (8 + 3 × 11) pinned to the bottom, like the card's
13
- // Measured against real cards at 1467 / 768 / 390 px (571 / 541 / 593 tall).
14
- //
15
- // Decorative only (aria-hidden): the grid that shows these says what is loading.
16
- // Renders correctly only inside a `<div className="md3">` subtree.
17
-
18
- import React from 'react';
19
-
20
- import Skeleton, { injectStyles } from '../ui/Skeleton';
21
-
22
- export interface CarCardSkeletonProps {
23
- className?: string;
24
- style?: React.CSSProperties;
25
- }
26
-
27
- const CARD_SKELETON_CSS = `
28
- .md3 .cc-skel { display: flex; flex-direction: column; pointer-events: none; }
29
- .md3 .cc-skel .cc-skel-photo { height: 0; padding-bottom: calc(75% + 14px); border-radius: 0; --mskeleton-base: var(--md-sc-low); }
30
- .md3 .cc-skel .cc-skel-body { flex: 1; display: flex; flex-direction: column; align-items: flex-start; padding: 0 18px 8px; margin-top: -3px; }
31
- .md3 .cc-skel .cc-skel-title { width: 62%; height: 20px; margin: 4px 0 9px; border-radius: var(--md-r-xs); }
32
- .md3 .cc-skel .cc-skel-trim { width: 82%; height: 11px; margin: 3px 0 9px; border-radius: var(--md-r-full); }
33
- .md3 .cc-skel .cc-skel-spec { width: 92%; height: 9px; margin: 3px 0 13px; border-radius: var(--md-r-full); }
34
- .md3 .cc-skel .cc-skel-price { align-self: stretch; border-top: 1px solid var(--md-outline-variant); }
35
- .md3 .cc-skel .cc-skel-tabs { display: grid; grid-template-columns: repeat(3, 1fr); align-items: center; justify-items: center; height: 39px; margin-bottom: 12px; }
36
- .md3 .cc-skel .cc-skel-tabs .mskeleton { width: 56%; height: 12px; border-radius: var(--md-r-full); }
37
- .md3 .cc-skel .cc-skel-hero { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 58px; }
38
- .md3 .cc-skel .cc-skel-rate { width: 46%; height: 42px; border-radius: var(--md-r-xs); }
39
- .md3 .cc-skel .cc-skel-eval { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; width: 112px; flex: none; }
40
- .md3 .cc-skel .cc-skel-eval .mskeleton:first-child { width: 72px; height: 12px; border-radius: var(--md-r-full); }
41
- .md3 .cc-skel .cc-skel-eval .mskeleton:last-child { width: 100%; height: 7px; border-radius: var(--md-r-full); }
42
- .md3 .cc-skel .cc-skel-terms,
43
- .md3 .cc-skel .cc-skel-eco { display: flex; flex-direction: column; }
44
- .md3 .cc-skel .cc-skel-terms .mskeleton { width: 94%; height: 9px; margin: 4px 0; border-radius: var(--md-r-full); }
45
- .md3 .cc-skel .cc-skel-terms .mskeleton:last-child { width: 60%; }
46
- .md3 .cc-skel .cc-skel-cta { align-self: stretch; gap: 6px; margin-top: 9px; }
47
- .md3 .cc-skel .cc-skel-cta .mskeleton { flex: 1.3 1 0; height: 40px; border-radius: var(--md-r-full); }
48
- .md3 .cc-skel .cc-skel-cta .mskeleton:nth-child(2) { flex: none; width: 40px; }
49
- .md3 .cc-skel .cc-skel-cta .mskeleton:last-child { flex: 1 1 0; }
50
- .md3 .cc-skel .cc-skel-eco { align-self: stretch; margin-top: auto; padding-top: 8px; }
51
- .md3 .cc-skel .cc-skel-eco .mskeleton { height: 7px; margin: 2px 0; border-radius: var(--md-r-full); }
52
- .md3 .cc-skel .cc-skel-eco .mskeleton:last-child { width: 66%; }
53
- @media (max-width: 1024px) {
54
- .md3 .cc-skel .cc-skel-tabs { height: 38px; }
55
- }`;
56
-
57
- const CARD_SKELETON_STYLE_ID = 'md3-card-skeleton-styles';
58
-
59
- injectStyles(CARD_SKELETON_STYLE_ID, CARD_SKELETON_CSS);
60
-
61
- const CarCardSkeleton: React.FunctionComponent<CarCardSkeletonProps> = ({ className, style }) => {
62
- React.useEffect(() => { injectStyles(CARD_SKELETON_STYLE_ID, CARD_SKELETON_CSS); }, []);
63
- return (
64
- <div className={'mcard cc-card cc-skel' + (className ? ` ${className}` : '')} style={style} aria-hidden="true">
65
- <Skeleton className="cc-skel-photo" />
66
- <div className="cc-skel-body">
67
- <Skeleton className="cc-skel-title" />
68
- <Skeleton className="cc-skel-trim" />
69
- <Skeleton className="cc-skel-spec" />
70
- <div className="cc-skel-price">
71
- <div className="cc-skel-tabs">
72
- <Skeleton />
73
- <Skeleton />
74
- <Skeleton />
75
- </div>
76
- <div className="cc-skel-hero">
77
- <Skeleton className="cc-skel-rate" />
78
- <div className="cc-skel-eval">
79
- <Skeleton />
80
- <Skeleton />
81
- </div>
82
- </div>
83
- <div className="cc-skel-terms">
84
- <Skeleton />
85
- <Skeleton />
86
- </div>
87
- </div>
88
- <div className="cc-skel-cta show-mobile">
89
- <Skeleton />
90
- <Skeleton />
91
- <Skeleton />
92
- </div>
93
- <div className="cc-skel-eco">
94
- <Skeleton />
95
- <Skeleton />
96
- <Skeleton />
97
- </div>
98
- </div>
99
- </div>
100
- );
101
- };
102
-
103
- export default CarCardSkeleton;
@@ -1,152 +0,0 @@
1
- // Autobahn (auto.de redesign) — CarRow (SRP list row) loading placeholder.
2
- //
3
- // Built on CarRow's own classes (.mcard .listcard / .listcard-info / .specstrip /
4
- // .listcard-price), so the 320 | 1fr | 240 grid, the column paddings and gaps, the grey
5
- // price column and the tablet re-flow (≤980: photo + info, price full width below) all
6
- // come from the same CSS as the real row. Inside, the row's parts as skeleton bars on their
7
- // line boxes (measured against real rows at 1467 px, 299 / 348 tall):
8
- // - info: title 22 + trim 18 · spec panel (2 × 3 facts, 85) · feature chips (2 rows, 54)
9
- // · eco line (3 × 14) at the bottom
10
- // - price: "Finanzierung ab" + rate + terms (87) · Leasing (66, optional) · Kaufen,
11
- // rating + meter, CTA (129) at the bottom
12
- // `withLeasing` toggles the Leasing block, the one thing that changes a real row's height
13
- // (348 with it, 299 without), so a list can mix both like real results do.
14
- //
15
- // Bars on the grey panels (spec strip, price column) use a darker base so they read on
16
- // --md-sc-low. Decorative only (aria-hidden): the list showing these says what is loading.
17
- // Renders correctly only inside a `<div className="md3">` subtree.
18
-
19
- import React from 'react';
20
-
21
- import Skeleton, { injectStyles } from '../ui/Skeleton';
22
-
23
- export interface CarRowSkeletonProps {
24
- /** show the Leasing block in the price column (a real row has it when the car can be leased). */
25
- withLeasing?: boolean;
26
- className?: string;
27
- style?: React.CSSProperties;
28
- }
29
-
30
- const ROW_SKELETON_CSS = `
31
- .md3 .lc-skel { pointer-events: none; background: var(--md-sc-lowest); }
32
- .md3 .lc-skel .lc-skel-photo { position: absolute; inset: 0; border-radius: 0; --mskeleton-base: var(--md-sc-low); }
33
- .md3 .lc-skel .specstrip .mskeleton,
34
- .md3 .lc-skel .listcard-price .mskeleton { --mskeleton-base: var(--md-sc-highest); }
35
- .md3 .lc-skel .lc-skel-head { display: flex; flex-direction: column; }
36
- .md3 .lc-skel .lc-skel-title { width: 44%; height: 16px; margin: 3px 0; border-radius: var(--md-r-xs); }
37
- .md3 .lc-skel .lc-skel-trim { width: 68%; height: 10px; margin: 4px 0; border-radius: var(--md-r-full); }
38
- .md3 .lc-skel .lc-skel-fact { display: flex; align-items: center; gap: 7px; height: 15px; }
39
- .md3 .lc-skel .lc-skel-fact .mskeleton:first-child { flex: none; width: 15px; height: 15px; border-radius: 50%; }
40
- .md3 .lc-skel .lc-skel-fact .mskeleton:last-child { width: 62%; height: 8px; border-radius: var(--md-r-full); }
41
- .md3 .lc-skel .lc-skel-fact:nth-child(3n + 2) .mskeleton:last-child { width: 48%; }
42
- .md3 .lc-skel .lc-skel-chips { display: flex; flex-wrap: wrap; gap: 6px; }
43
- .md3 .lc-skel .lc-skel-chips .mskeleton { height: 24px; border-radius: 8px; }
44
- .md3 .lc-skel .lc-skel-chips .mskeleton:nth-child(1) { width: 118px; }
45
- .md3 .lc-skel .lc-skel-chips .mskeleton:nth-child(2) { width: 112px; }
46
- .md3 .lc-skel .lc-skel-chips .mskeleton:nth-child(3) { width: 80px; }
47
- .md3 .lc-skel .lc-skel-chips .mskeleton:nth-child(4) { width: 86px; }
48
- .md3 .lc-skel .lc-skel-spacer { flex: 1; }
49
- .md3 .lc-skel .lc-skel-eco { display: flex; flex-direction: column; }
50
- .md3 .lc-skel .lc-skel-eco .mskeleton { height: 7px; margin: 4px 0 3px; border-radius: var(--md-r-full); }
51
- .md3 .lc-skel .lc-skel-eco .mskeleton:last-child { width: 55%; }
52
- .md3 .lc-skel .lc-skel-paths { display: flex; flex-direction: column; align-items: flex-start; }
53
- .md3 .lc-skel .lc-skel-eyebrow { width: 96px; height: 9px; margin: 2px 0; border-radius: var(--md-r-full); }
54
- .md3 .lc-skel .lc-skel-rate { display: flex; align-items: center; gap: 8px; height: 49px; margin-top: 4px; }
55
- .md3 .lc-skel .lc-skel-rate .mskeleton:first-child { width: 120px; height: 38px; border-radius: var(--md-r-xs); }
56
- .md3 .lc-skel .lc-skel-rate .mskeleton:last-child { width: 28px; height: 9px; border-radius: var(--md-r-full); }
57
- .md3 .lc-skel .lc-skel-terms { width: 170px; max-width: 100%; height: 8px; margin: 11px 0 2px; border-radius: var(--md-r-full); }
58
- .md3 .lc-skel .lc-skel-lease,
59
- .md3 .lc-skel .lc-skel-buy { display: flex; flex-direction: column; border-top: 1px solid var(--md-outline-variant); }
60
- .md3 .lc-skel .lc-skel-lease { padding-top: 14px; }
61
- .md3 .lc-skel .lc-skel-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 21px; }
62
- .md3 .lc-skel .lc-skel-line .mskeleton:first-child { width: 56px; height: 9px; border-radius: var(--md-r-full); }
63
- .md3 .lc-skel .lc-skel-line .mskeleton:last-child { width: 72px; height: 15px; border-radius: var(--md-r-xs); }
64
- .md3 .lc-skel .lc-skel-lease-terms { display: flex; flex-direction: column; margin-top: 6px; }
65
- .md3 .lc-skel .lc-skel-lease-terms .mskeleton { height: 7px; margin: 2px 0 3px; border-radius: var(--md-r-full); }
66
- .md3 .lc-skel .lc-skel-lease-terms .mskeleton:last-child { width: 62%; }
67
- .md3 .lc-skel .lc-skel-buy { margin-top: auto; padding-top: 9px; }
68
- .md3 .lc-skel .lc-skel-buy .lc-skel-line { height: 22px; }
69
- .md3 .lc-skel .lc-skel-eval { display: flex; align-items: center; gap: 10px; height: 24px; margin-top: 15px; }
70
- .md3 .lc-skel .lc-skel-eval .mskeleton:first-child { flex: none; width: 84px; height: 24px; border-radius: 12px; }
71
- .md3 .lc-skel .lc-skel-eval .mskeleton:last-child { flex: 1; height: 8px; border-radius: var(--md-r-full); }
72
- .md3 .lc-skel .lc-skel-cta { height: 40px; margin-top: 18px; border-radius: var(--md-r-full); }`;
73
-
74
- const ROW_SKELETON_STYLE_ID = 'md3-row-skeleton-styles';
75
-
76
- injectStyles(ROW_SKELETON_STYLE_ID, ROW_SKELETON_CSS);
77
-
78
- const FACTS = [0, 1, 2, 3, 4, 5];
79
-
80
- const CarRowSkeleton: React.FunctionComponent<CarRowSkeletonProps> = ({ withLeasing = true, className, style }) => {
81
- React.useEffect(() => { injectStyles(ROW_SKELETON_STYLE_ID, ROW_SKELETON_CSS); }, []);
82
- return (
83
- <div className={'mcard listcard lc-skel' + (className ? ` ${className}` : '')} style={style} aria-hidden="true">
84
- <div className="listcard-media">
85
- <Skeleton className="lc-skel-photo" />
86
- </div>
87
-
88
- <div className="listcard-info">
89
- <div className="lc-skel-head">
90
- <Skeleton className="lc-skel-title" />
91
- <Skeleton className="lc-skel-trim" />
92
- </div>
93
- <div className="specstrip">
94
- {FACTS.map((fact) => (
95
- <div key={fact} className="lc-skel-fact">
96
- <Skeleton />
97
- <Skeleton />
98
- </div>
99
- ))}
100
- </div>
101
- <div className="lc-skel-chips">
102
- <Skeleton />
103
- <Skeleton />
104
- <Skeleton />
105
- <Skeleton />
106
- </div>
107
- <div className="lc-skel-spacer" />
108
- <div className="lc-skel-eco">
109
- <Skeleton />
110
- <Skeleton />
111
- <Skeleton />
112
- </div>
113
- </div>
114
-
115
- <div className="listcard-price">
116
- <div className="lc-skel-paths">
117
- <Skeleton className="lc-skel-eyebrow" />
118
- <div className="lc-skel-rate">
119
- <Skeleton />
120
- <Skeleton />
121
- </div>
122
- <Skeleton className="lc-skel-terms" />
123
- </div>
124
- {withLeasing && (
125
- <div className="lc-skel-lease">
126
- <div className="lc-skel-line">
127
- <Skeleton />
128
- <Skeleton />
129
- </div>
130
- <div className="lc-skel-lease-terms">
131
- <Skeleton />
132
- <Skeleton />
133
- </div>
134
- </div>
135
- )}
136
- <div className="lc-skel-buy">
137
- <div className="lc-skel-line">
138
- <Skeleton />
139
- <Skeleton />
140
- </div>
141
- <div className="lc-skel-eval">
142
- <Skeleton />
143
- <Skeleton />
144
- </div>
145
- <Skeleton className="lc-skel-cta" />
146
- </div>
147
- </div>
148
- </div>
149
- );
150
- };
151
-
152
- export default CarRowSkeleton;