@sikka/hawa 0.0.208 → 0.0.209
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.
- package/dist/styles.css +3 -0
- package/es/blocks/Pricing/PricingPlans.d.ts +15 -1
- package/es/elements/HawaPricingCard.d.ts +1 -0
- package/es/index.es.js +1 -1
- package/lib/blocks/Pricing/PricingPlans.d.ts +15 -1
- package/lib/elements/HawaPricingCard.d.ts +1 -0
- package/lib/index.js +1 -1
- package/package.json +1 -1
- package/src/blocks/Pricing/PricingPlans.tsx +32 -28
- package/src/elements/HawaPricingCard.tsx +19 -33
- package/src/elements/HawaTabs.tsx +22 -13
- package/src/styles.css +3 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useState } from "react"
|
|
2
2
|
import { HawaPricingCard, HawaTabs } from "../../elements"
|
|
3
3
|
// TODO: make lang into direction rtl | ltr
|
|
4
|
-
|
|
4
|
+
|
|
5
5
|
type PricingPlansTypes = {
|
|
6
6
|
plans: [
|
|
7
7
|
{
|
|
@@ -18,41 +18,48 @@ type PricingPlansTypes = {
|
|
|
18
18
|
size: "small" | "medium" | "large"
|
|
19
19
|
}
|
|
20
20
|
]
|
|
21
|
-
|
|
21
|
+
currencies: [
|
|
22
|
+
{
|
|
23
|
+
label: string
|
|
24
|
+
value: string
|
|
25
|
+
}
|
|
26
|
+
]
|
|
27
|
+
billingCycles: [
|
|
28
|
+
{
|
|
29
|
+
label: string
|
|
30
|
+
value: string
|
|
31
|
+
}
|
|
32
|
+
]
|
|
33
|
+
onCycleChange?: (e) => void
|
|
34
|
+
onCurrencyChange?: (e) => void
|
|
35
|
+
direction?: "rtl" | "ltr"
|
|
22
36
|
}
|
|
23
37
|
export const PricingPlans: React.FunctionComponent<PricingPlansTypes> = (
|
|
24
38
|
props
|
|
25
39
|
) => {
|
|
26
40
|
const [currentCurrency, setCurrentCurrency] = useState("SAR")
|
|
27
41
|
const [currentCycle, setCurrentCycle] = useState("month")
|
|
28
|
-
|
|
29
|
-
{ label: `Monthly`, value: `month` },
|
|
30
|
-
// { label: `3 Months`, value: `3-months` },
|
|
31
|
-
// { label: `6 Months`, value: `6-months` },
|
|
32
|
-
{ label: `Annually`, value: `annually` },
|
|
33
|
-
]
|
|
34
|
-
let currencyOptions = [
|
|
35
|
-
{ label: `USD`, value: `usd` },
|
|
36
|
-
{ label: `SAR`, value: `sar` },
|
|
37
|
-
]
|
|
38
|
-
let activeTabStyle =
|
|
39
|
-
"inline-block py-3 px-4 text-white bg-blue-600 rounded active"
|
|
40
|
-
let inactiveTabStyle =
|
|
41
|
-
"inline-block py-3 px-4 rounded hover:text-gray-900 hover:bg-gray-100 dark:hover:bg-gray-800 dark:hover:text-white"
|
|
42
|
+
|
|
42
43
|
return (
|
|
43
44
|
<div>
|
|
44
45
|
<div className="mb-2 flex w-full justify-between">
|
|
45
46
|
<HawaTabs
|
|
46
47
|
pill
|
|
47
48
|
defaultValue={currentCycle}
|
|
48
|
-
options={
|
|
49
|
-
onChangeTab={(e: any) =>
|
|
49
|
+
options={props.billingCycles}
|
|
50
|
+
onChangeTab={(e: any) => {
|
|
51
|
+
setCurrentCycle(e.label)
|
|
52
|
+
props.onCycleChange(e)
|
|
53
|
+
}}
|
|
50
54
|
/>
|
|
51
55
|
<HawaTabs
|
|
52
56
|
pill
|
|
53
57
|
defaultValue={currentCurrency}
|
|
54
|
-
options={
|
|
55
|
-
onChangeTab={(e: any) =>
|
|
58
|
+
options={props.currencies}
|
|
59
|
+
onChangeTab={(e: any) => {
|
|
60
|
+
setCurrentCurrency(e.label)
|
|
61
|
+
props.onCurrencyChange(e)
|
|
62
|
+
}}
|
|
56
63
|
/>
|
|
57
64
|
</div>
|
|
58
65
|
|
|
@@ -60,15 +67,12 @@ export const PricingPlans: React.FunctionComponent<PricingPlansTypes> = (
|
|
|
60
67
|
{props.plans.map((plan: any) => {
|
|
61
68
|
return (
|
|
62
69
|
<HawaPricingCard
|
|
63
|
-
// size="large"
|
|
64
|
-
// features={plan.features}
|
|
65
|
-
// lang={props.lang}
|
|
66
70
|
{...plan}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
texts={{
|
|
72
|
+
...plan.texts,
|
|
73
|
+
currencyText: currentCurrency,
|
|
74
|
+
cycleText: currentCycle,
|
|
75
|
+
}}
|
|
72
76
|
/>
|
|
73
77
|
)
|
|
74
78
|
})}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import clsx from "clsx"
|
|
2
2
|
import React from "react"
|
|
3
|
+
import { HawaButton } from "./HawaButton"
|
|
3
4
|
|
|
4
|
-
// TODO: if feature.
|
|
5
|
+
// TODO: if feature.excluded is false, show gray and x
|
|
6
|
+
// TODO: add badge to feature if soon
|
|
5
7
|
|
|
6
8
|
type PricingCardTypes = {
|
|
7
9
|
direction?: "rtl" | "ltr"
|
|
@@ -14,45 +16,22 @@ type PricingCardTypes = {
|
|
|
14
16
|
cycleText: string
|
|
15
17
|
currencyText: string
|
|
16
18
|
}
|
|
19
|
+
currentPlan?: boolean
|
|
17
20
|
size: "small" | "medium" | "large"
|
|
18
21
|
}
|
|
19
|
-
|
|
20
|
-
monthly: string
|
|
21
|
-
"3-months": string
|
|
22
|
-
"6-months": string
|
|
23
|
-
annually: string
|
|
24
|
-
}
|
|
25
|
-
type CurrencyTextTypes = {
|
|
26
|
-
usd: string
|
|
27
|
-
sar: string
|
|
28
|
-
}
|
|
22
|
+
|
|
29
23
|
export const HawaPricingCard: React.FunctionComponent<PricingCardTypes> = ({
|
|
30
24
|
size = "medium",
|
|
31
25
|
direction = "ltr",
|
|
26
|
+
currentPlan = true,
|
|
32
27
|
...props
|
|
33
28
|
}) => {
|
|
34
29
|
let isArabic = direction === "rtl"
|
|
35
|
-
let cycleTextsArabic: CycleTextTypes = {
|
|
36
|
-
monthly: "شهرياً",
|
|
37
|
-
"3-months": "كل 3 أشهر",
|
|
38
|
-
"6-months": "كل 6 أشهر",
|
|
39
|
-
annually: "سنوياً",
|
|
40
|
-
}
|
|
41
|
-
let cycleTextsEnglish: CycleTextTypes = {
|
|
42
|
-
monthly: "Monthly",
|
|
43
|
-
"3-months": "3 Months",
|
|
44
|
-
"6-months": "6 Months",
|
|
45
|
-
annually: "Annually",
|
|
46
|
-
}
|
|
47
|
-
let currencyMapping: CurrencyTextTypes = {
|
|
48
|
-
usd: isArabic ? "دولار" : "$",
|
|
49
|
-
sar: isArabic ? "ريال" : "SAR",
|
|
50
|
-
}
|
|
51
30
|
let cardSizes = {
|
|
52
31
|
small:
|
|
53
32
|
"mx-1 w-full max-w-sm rounded border shadow-md dark:border-gray-700 dark:bg-gray-800 sm:p-8",
|
|
54
33
|
medium:
|
|
55
|
-
"mx-1 w-full rounded min-w-fit border
|
|
34
|
+
"mx-1 w-full rounded min-w-fit border dark:border-gray-700 dark:bg-gray-800 sm:p-8",
|
|
56
35
|
large:
|
|
57
36
|
"mx-1 w-full max-w-lg rounded border p-4 shadow-md dark:border-gray-700 dark:bg-gray-800 sm:p-8",
|
|
58
37
|
}
|
|
@@ -60,8 +39,11 @@ export const HawaPricingCard: React.FunctionComponent<PricingCardTypes> = ({
|
|
|
60
39
|
<div
|
|
61
40
|
dir={isArabic ? "rtl" : "ltr"}
|
|
62
41
|
className={clsx(
|
|
42
|
+
currentPlan
|
|
43
|
+
? "border-buttonPrimary-500 bg-layoutPrimary-500 p-0"
|
|
44
|
+
: "bg-white",
|
|
63
45
|
cardSizes[size],
|
|
64
|
-
"flex flex-col gap-4 border-2
|
|
46
|
+
"flex flex-col gap-4 rounded border-2 p-4"
|
|
65
47
|
)}
|
|
66
48
|
>
|
|
67
49
|
<h5 className="text-md 0 font-bold text-gray-500 dark:text-gray-400">
|
|
@@ -76,9 +58,9 @@ export const HawaPricingCard: React.FunctionComponent<PricingCardTypes> = ({
|
|
|
76
58
|
{props.texts.currencyText}
|
|
77
59
|
</span>
|
|
78
60
|
</>
|
|
79
|
-
|
|
61
|
+
<span className="ml-1 text-xl font-normal text-gray-500 dark:text-gray-400">
|
|
80
62
|
/ {props.texts.cycleText}
|
|
81
|
-
</span>
|
|
63
|
+
</span>
|
|
82
64
|
</div>
|
|
83
65
|
<h5 className="text-md font-normal text-gray-500 dark:text-gray-400">
|
|
84
66
|
{props.texts.subtitle}
|
|
@@ -111,12 +93,16 @@ export const HawaPricingCard: React.FunctionComponent<PricingCardTypes> = ({
|
|
|
111
93
|
})}
|
|
112
94
|
</ul>
|
|
113
95
|
)}
|
|
114
|
-
<button
|
|
96
|
+
{/* <button
|
|
97
|
+
disabled={currentPlan}
|
|
115
98
|
type="button"
|
|
116
99
|
className="inline-flex w-full justify-center rounded bg-blue-600 px-5 py-2.5 text-center text-sm font-medium text-white hover:bg-blue-700 focus:outline-none focus:ring-4 focus:ring-blue-200 dark:focus:ring-blue-900"
|
|
117
100
|
>
|
|
118
101
|
{props.texts.buttonText}
|
|
119
|
-
</button>
|
|
102
|
+
</button> */}
|
|
103
|
+
<HawaButton disabled={currentPlan} width="full">
|
|
104
|
+
{props.texts.buttonText}
|
|
105
|
+
</HawaButton>
|
|
120
106
|
</div>
|
|
121
107
|
)
|
|
122
108
|
}
|
|
@@ -16,22 +16,23 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
|
|
|
16
16
|
direction = "ltr",
|
|
17
17
|
width = "normal",
|
|
18
18
|
marginBetween = 0,
|
|
19
|
-
pill =
|
|
19
|
+
pill = false,
|
|
20
20
|
...props
|
|
21
21
|
}) => {
|
|
22
22
|
const [selectedOption, setSelectedOption] = useState(props.options[0]?.value)
|
|
23
23
|
|
|
24
24
|
let activeTabStyle = {
|
|
25
25
|
vertical: "inline-block py-2 px-4 text-white bg-buttonPrimary-500 active",
|
|
26
|
-
horizontal:
|
|
27
|
-
"inline-block py-2 px-4 text-white bg-buttonPrimary-500 rounded rounded-br-none rounded-bl-none active",
|
|
26
|
+
horizontal: "inline-block py-2 px-4 text-white bg-buttonPrimary-500 active",
|
|
28
27
|
}
|
|
28
|
+
// rounded rounded-br-none rounded-bl-none
|
|
29
29
|
let inactiveTabStyle = {
|
|
30
30
|
vertical:
|
|
31
|
-
"inline-block py-2 px-4
|
|
31
|
+
"inline-block py-2 px-4 hover:text-gray-900 hover:bg-gray-200 dark:hover:bg-gray-800 dark:hover:text-white",
|
|
32
32
|
horizontal:
|
|
33
|
-
"bg-gray-100 inline-block py-2 px-4
|
|
33
|
+
"bg-gray-100 inline-block py-2 px-4 hover:text-gray-900 hover:bg-gray-200 dark:hover:bg-gray-800 dark:hover:text-white",
|
|
34
34
|
}
|
|
35
|
+
// rounded rounded-br-none rounded-bl-none
|
|
35
36
|
let widthStyles = {
|
|
36
37
|
full: "w-full min-w-full",
|
|
37
38
|
normal: "w-fit",
|
|
@@ -54,7 +55,7 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
|
|
|
54
55
|
vertical:
|
|
55
56
|
"sticky top-2 h-fit flex flex-col w-fit flex-wrap rounded border-b-buttonPrimary-500 bg-gray-100 text-center text-sm font-medium text-gray-500 dark:text-gray-400",
|
|
56
57
|
horizontal:
|
|
57
|
-
"flex w-fit
|
|
58
|
+
"flex w-fit flex-wrap border-b-buttonPrimary-500 text-center text-sm font-medium text-gray-500 dark:text-gray-400",
|
|
58
59
|
}
|
|
59
60
|
return (
|
|
60
61
|
<div
|
|
@@ -62,7 +63,6 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
|
|
|
62
63
|
className={clsx(
|
|
63
64
|
containerStyle[orientation],
|
|
64
65
|
props.options[selectedOption] ? "border-b-2" : "border-b-0"
|
|
65
|
-
// "bg-red-400"
|
|
66
66
|
)}
|
|
67
67
|
>
|
|
68
68
|
<ul
|
|
@@ -78,14 +78,19 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
|
|
|
78
78
|
tabsStyle[orientation],
|
|
79
79
|
"border-buttonPrimary-500",
|
|
80
80
|
|
|
81
|
-
orientation === "vertical"
|
|
81
|
+
// orientation === "vertical"
|
|
82
|
+
// ? direction === "rtl"
|
|
83
|
+
// ? "rounded-none rounded-r border-l-2"
|
|
84
|
+
// : "rounded-none rounded-l border-r-2"
|
|
85
|
+
// : "border-b-2",
|
|
86
|
+
widthStyles[width],
|
|
87
|
+
pill
|
|
88
|
+
? "gap-0.5 rounded border-none bg-gray-100 p-0.5"
|
|
89
|
+
: orientation === "vertical"
|
|
82
90
|
? direction === "rtl"
|
|
83
91
|
? "rounded-none rounded-r border-l-2"
|
|
84
92
|
: "rounded-none rounded-l border-r-2"
|
|
85
|
-
: "border-b-2"
|
|
86
|
-
widthStyles[width],
|
|
87
|
-
// "bg-red-400",
|
|
88
|
-
pill ? "overflow-clip rounded border-none" : ""
|
|
93
|
+
: "border-b-2"
|
|
89
94
|
)}
|
|
90
95
|
>
|
|
91
96
|
{props.options?.map((opt: any, o) => (
|
|
@@ -105,7 +110,11 @@ export const HawaTabs: React.FunctionComponent<TabsTypes> = ({
|
|
|
105
110
|
]
|
|
106
111
|
: inactiveTabStyle[orientation],
|
|
107
112
|
"w-full transition-all",
|
|
108
|
-
pill
|
|
113
|
+
pill
|
|
114
|
+
? "rounded"
|
|
115
|
+
: orientation === "vertical"
|
|
116
|
+
? "rounded rounded-tl-none rounded-bl-none"
|
|
117
|
+
: "rounded rounded-br-none rounded-bl-none"
|
|
109
118
|
// direction === "rtl" ? "bg-yellow-400" : "bg-yellow-400"
|
|
110
119
|
)}
|
|
111
120
|
>
|