"TypeError: Cannot read properties of undefined (reading 'spaceXLarge')" when setting "content" on ItinerarySegmentDetail
Opened this issue · 0 comments
Expected Behavior
On setting "content" attribute on "ItinerarySegmentDetail", component should become expandable and show details like as illustrated in the demo here:
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
- 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.
- Comment out references to BadgeGroup, which is not documented well...
- 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)
react-poc@0.1.0 /Users/statsgod/react-poc
├── @babel/core@7.21.3
├── @babel/preset-env@7.20.2
├── @kiwicom/orbit-components@6.1.0
├── @types/react@18.0.28
├── aphrodite@2.4.0
├── csstype@3.1.1
├── gh-pages@1.2.0
├── moment@2.29.4
├── react-dom@18.2.0
├── react-dragula@1.1.17
├── react-scripts@4.0.0
├── react@18.2.0
├── styled-components@5.3.9
└── web-vitals@2.1.4