UNPKG

@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.

93 lines (91 loc) 4.51 kB
"use client"; import * as React from "react"; import { useRandomIdSeed } from "../hooks/useRandomId"; import STOPS from "./consts"; const Stops = ({ stops }) => { if (stops === STOPS.ONE) { return /*#__PURE__*/React.createElement("path", { d: "M13 6c-.8057 0-1.5-.4763-1.8169-1.1627L.8334 4.838c-.5 0-.8334-.3334-.8334-.8334s.3333-.8333.8334-.8333l10.3457.0003C11.4941 2.4804 12.1909 2 13 2c.8087 0 1.5057.4804 1.8208 1.1715l8.763-.0003c.0834 0 .1667-.0834.1667-.1667V1.421c0-.75.9167-1.0834 1.4159-.5833l2.5842 2.5834c.3325.3333.3325.8333 0 1.1667l-2.5842 2.5834c-.4992.5008-1.416.1667-1.416-.5834V5.0046c0-.0834-.0832-.1667-.1666-.1667l-8.767-.0006C14.4997 5.5237 13.8051 6 13 6z" }); } if (stops === STOPS.TWO) { return /*#__PURE__*/React.createElement("path", { d: "M17 6c-.8057 0-1.5-.4763-1.8169-1.1627H10.317C10 5.5237 9.3057 6 8.5 6 7.6943 6 7 5.5237 6.6831 4.8373L.8334 4.838c-.5 0-.8334-.3334-.8334-.8334s.3333-.8333.8334-.8333l5.8457.0003C6.9941 2.4804 7.6909 2 8.5 2c.8091 0 1.506.4804 1.8209 1.1715h4.8582C15.4941 2.4804 16.1909 2 17 2c.8087 0 1.5057.4804 1.8208 1.1715l4.763-.0003c.0834 0 .1667-.0834.1667-.1667V1.421c0-.75.9167-1.0834 1.4159-.5833l2.5842 2.5834c.3325.3333.3325.8333 0 1.1667l-2.5842 2.5834c-.4992.5008-1.416.1667-1.416-.5834V5.0046c0-.0834-.0832-.1667-.1666-.1667l-4.767-.0006C18.4997 5.5237 17.8051 6 17 6z" }); } if (stops === STOPS.THREE) { return /*#__PURE__*/React.createElement("path", { d: "M18 6c-.8057 0-1.5-.4763-1.8169-1.1627h-1.3664C14.4997 5.5237 13.8052 6 13 6c-.8057 0-1.5-.4763-1.8169-1.1627H9.317C9 5.5237 8.3057 6 7.5 6 6.6943 6 6 5.5237 5.6831 4.8373L.8334 4.838c-.5 0-.8334-.3334-.8334-.8334s.3333-.8333.8334-.8333l4.8457.0003C5.9941 2.4804 6.6909 2 7.5 2c.8091 0 1.506.4804 1.8209 1.1715h1.8582C11.4941 2.4804 12.1909 2 13 2c.8087 0 1.5057.4804 1.8208 1.1715h1.3583C16.4941 2.4804 17.1909 2 18 2c.8087 0 1.5057.4804 1.8208 1.1715l3.763-.0003c.0834 0 .1667-.0834.1667-.1667V1.421c0-.75.9167-1.0834 1.4159-.5833l2.5842 2.5834c.3325.3333.3325.8333 0 1.1667l-2.5842 2.5834c-.4992.5008-1.416.1667-1.416-.5834V5.0046c0-.0834-.0832-.1667-.1666-.1667l-3.767-.0006C19.4997 5.5237 18.8051 6 18 6z" }); } return /*#__PURE__*/React.createElement("path", { d: "M25.1664.8378c-.4992-.5-1.416-.1667-1.416.5833v1.5834c0 .0833-.0832.1667-.1666.1667H.8334c-.5 0-.8334.3333-.8334.8333s.3333.8334.8334.8334h22.7504c.0834 0 .1667.0833.1667.1667v1.5833c0 .75.9167 1.0842 1.4159.5834l2.5842-2.5834c.3325-.3334.3325-.8334 0-1.1667L25.1664.8378z" }); }; /** * @orbit-doc-start * README * ---------- * # StopoverArrow * * To implement StopoverArrow component into your project you'll need to add the import: * * ```jsx * import StopoverArrow from "@kiwicom/orbit-components/lib/StopoverArrow"; * ``` * * After adding import into your project you can use it simply like: * * ```jsx * <StopoverArrow stops="2" dataTest="test" /> * ``` * * ## Props * * Table below contains all types of the props available in StopoverArrow component. * * | Name | Type | Default | Description | * | :------- | :-------------- | :------ | :-------------------------------------------------- | * | dataTest | `string` | | Optional prop for testing purposes. | * | id | `string` | | Set `id` for `StopoverArrow` | * | stops | [`enum`](#enum) | `"0"` | Specify how many stops should the component render. | * * ### enum * * | stops | * | :---- | * | `"0"` | * | `"1"` | * | `"2"` | * | `"3"` | * * * @orbit-doc-end */ const StopoverArrow = ({ stops = STOPS.ZERO, dataTest, id }) => { const randomId = useRandomIdSeed(); const titleId = randomId("title"); const descrId = randomId("descr"); return /*#__PURE__*/React.createElement("svg", { className: "orbit-stopover-arrow text-ink-light h-[7px] w-[36px] fill-current align-middle rtl:-scale-x-100", preserveAspectRatio: "xMidYMid meet", viewBox: "0 0 28 8", "aria-labelledby": `${titleId} ${descrId}`, "data-test": dataTest, id: id, role: "img" }, /*#__PURE__*/React.createElement("title", { id: titleId }, "Stopover arrow, ", stops, " stops"), /*#__PURE__*/React.createElement("desc", { id: descrId }, "Shows how many stopovers there are between two locations"), /*#__PURE__*/React.createElement(Stops, { stops: stops })); }; export default StopoverArrow;