@kiwicom/orbit-components
Version:
Orbit-components is a React component library which provides developers with the easiest possible way of building Kiwi.com’s products.
43 lines • 960 B
JavaScript
import * as React from "react";
export const ItinerarySegmentContext = /*#__PURE__*/React.createContext({
isNextHidden: false,
isPrevHidden: false,
isBanner: false,
isHidden: false,
noElevation: false,
opened: false,
toggleOpened: () => {},
index: 0,
count: 0,
last: false
});
export const usePart = () => React.useContext(ItinerarySegmentContext);
export const ItinerarySegmentProvider = ({
isNextHidden,
isPrevHidden,
noElevation,
isHidden,
isBanner,
children,
index,
opened,
toggleOpened,
last,
count
}) => {
const value = React.useMemo(() => ({
isNextHidden,
isPrevHidden,
noElevation,
isHidden,
isBanner,
index,
opened,
toggleOpened,
last,
count
}), [isNextHidden, isPrevHidden, noElevation, isHidden, isBanner, index, opened, toggleOpened, last, count]);
return /*#__PURE__*/React.createElement(ItinerarySegmentContext.Provider, {
value: value
}, children);
};