Skip to content

"TypeError: Cannot read properties of undefined (reading 'spaceXLarge')" when setting "content" on ItinerarySegmentDetail #3775

@Why-Not-Us

Description

@Why-Not-Us

Expected Behavior

On setting "content" attribute on "ItinerarySegmentDetail", component should become expandable and show details like as illustrated in the demo here:

https://kiwicom.github.io/orbit/?path=/story/itinerary--detail&globals=backgrounds.grid:false&knob-Description=This%20is%20description%20of%20the%20card&knob-SectionDescription=Section%20Description&knob-SectionTitle=Section%20Title&knob-Title=Card%20with%20title&knob-dataTest=test&knob-description=Select%20your%20hotel,%20hostel,%20apartment,%20or%20B&knob-expanded=true&knob-illustration=BoardingPass&knob-initialExpended=true&knob-title=Rooms%20in%20Warsaw&knob-titleAs=h1

Current Behavior

Rest of demo runs fine until you pass "content attribute", which results in:
"TypeError: Cannot read properties of undefined (reading 'spaceXLarge')"

Possible Solution

Seems to be a problem with defaultTheme getting set here: https://github.com/kiwicom/orbit/blob/ff36265399a9f5207143a18f0d53ee7d34e3010a/packages/orbit-components/src/Itinerary/ItinerarySegment/ItinerarySegmentDetail/index.tsx

or maybe an out of syncness with legacy code? not seeing a reference to "content" attribute here:
https://github.com/kiwicom/orbit/blob/ff36265399a9f5207143a18f0d53ee7d34e3010a/packages/orbit-components/src/Itinerary/README.md

Steps to Reproduce

  1. copy the exact component code from here: https://kiwicom.github.io/orbit/?path=/story/itinerary--detail&globals=backgrounds.grid:false&knob-Description=This%20is%20description%20of%20the%20card&knob-SectionDescription=Section%20Description&knob-SectionTitle=Section%20Title&knob-Title=Card%20with%20title&knob-dataTest=test&knob-description=Select%20your%20hotel,%20hostel,%20apartment,%20or%20B&knob-expanded=true&knob-illustration=BoardingPass&knob-initialExpended=true&knob-title=Rooms%20in%20Warsaw&knob-titleAs=h12.
  2. Comment out references to BadgeGroup, which is not documented well...
  3. Add the following imports:
    import Itinerary, {
    ItinerarySegment,
    ItineraryStatus,
    ItineraryBadgeList,
    ItinerarySegmentStop,
    ItinerarySegmentDetail,
    } from "@kiwicom/orbit-components/lib/Itinerary";

Context (Environment)

Blocking full implementation of Itinerary components

Environment:
macOS 12.6.1
Latest chrome (111.0.5563.64)

packages (via npm list --depth=0)
[email protected] /Users/statsgod/react-poc
├── @babel/[email protected]
├── @babel/[email protected]
├── @kiwicom/[email protected]
├── @types/[email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
└── [email protected]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions