@sikka/hawa 0.0.2 → 0.0.5

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.
Files changed (192) hide show
  1. package/.github/workflows/hawa-publish-push.yml +45 -0
  2. package/.github/workflows/hawa-publish.yml +45 -0
  3. package/.prettierrc +28 -28
  4. package/README.md +149 -148
  5. package/es/index.es.js +1 -0
  6. package/lib/index.js +1 -0
  7. package/package.json +62 -47
  8. package/rollup.config.js +30 -30
  9. package/src/Assets/images/card-background/1.jpeg +0 -0
  10. package/src/Assets/images/card-background/10.jpeg +0 -0
  11. package/src/Assets/images/card-background/11.jpeg +0 -0
  12. package/src/Assets/images/card-background/12.jpeg +0 -0
  13. package/src/Assets/images/card-background/13.jpeg +0 -0
  14. package/src/Assets/images/card-background/14.jpeg +0 -0
  15. package/src/Assets/images/card-background/15.jpeg +0 -0
  16. package/src/Assets/images/card-background/16.jpeg +0 -0
  17. package/src/Assets/images/card-background/17.jpeg +0 -0
  18. package/src/Assets/images/card-background/18.jpeg +0 -0
  19. package/src/Assets/images/card-background/19.jpeg +0 -0
  20. package/src/Assets/images/card-background/2.jpeg +0 -0
  21. package/src/Assets/images/card-background/20.jpeg +0 -0
  22. package/src/Assets/images/card-background/21.jpeg +0 -0
  23. package/src/Assets/images/card-background/22.jpeg +0 -0
  24. package/src/Assets/images/card-background/23.jpeg +0 -0
  25. package/src/Assets/images/card-background/24.jpeg +0 -0
  26. package/src/Assets/images/card-background/25.jpeg +0 -0
  27. package/src/Assets/images/card-background/3.jpeg +0 -0
  28. package/src/Assets/images/card-background/4.jpeg +0 -0
  29. package/src/Assets/images/card-background/5.jpeg +0 -0
  30. package/src/Assets/images/card-background/6.jpeg +0 -0
  31. package/src/Assets/images/card-background/7.jpeg +0 -0
  32. package/src/Assets/images/card-background/8.jpeg +0 -0
  33. package/src/Assets/images/card-background/9.jpeg +0 -0
  34. package/src/Assets/images/card-type/amex.png +0 -0
  35. package/src/Assets/images/card-type/diners.png +0 -0
  36. package/src/Assets/images/card-type/discover.png +0 -0
  37. package/src/Assets/images/card-type/mastercard.png +0 -0
  38. package/src/Assets/images/card-type/troy.png +0 -0
  39. package/src/Assets/images/card-type/unionpay.png +0 -0
  40. package/src/Assets/images/card-type/visa.png +0 -0
  41. package/src/blocks/Account/UserProfile.js +15 -0
  42. package/src/blocks/Account/UserSettings.js +15 -0
  43. package/src/blocks/Account/index.js +2 -0
  44. package/src/blocks/AuthForms/NewPasswordForm.js +24 -0
  45. package/src/blocks/AuthForms/ResetPasswordForm.js +13 -0
  46. package/src/blocks/AuthForms/SignInForm.js +55 -0
  47. package/src/blocks/AuthForms/SignUpForm.js +68 -0
  48. package/src/{components/Hawa → blocks}/AuthForms/index.js +4 -4
  49. package/src/blocks/Payment/CreditCardForm.js +31 -0
  50. package/src/blocks/Payment/Form/CForm.js +328 -0
  51. package/src/blocks/Payment/Form/Card.js +242 -0
  52. package/src/blocks/Payment/Gateway/GooglePay.js +251 -0
  53. package/src/blocks/Payment/Gateway/Payfort.js +90 -0
  54. package/src/blocks/Payment/Gateway/Paypal.js +138 -0
  55. package/src/blocks/Payment/Gateway/Wallet.js +149 -0
  56. package/src/blocks/Payment/PaymentMethod.js +132 -0
  57. package/src/blocks/Payment/SelectPayment.js +95 -0
  58. package/src/blocks/Payment/index.js +16 -0
  59. package/src/index.js +4 -1
  60. package/src/layout/Box.js +39 -0
  61. package/src/layout/index.js +1 -0
  62. package/src/stories/ActionButton.stories.js +53 -0
  63. package/src/stories/AdaptiveButton.stories.js +80 -80
  64. package/src/stories/Alert.stories.js +41 -48
  65. package/src/stories/BlocksStories/AuthForm.stories.js +99 -0
  66. package/src/stories/BlocksStories/PaymentForm.stories.js +111 -0
  67. package/src/stories/BlocksStories/UserAccount.stories.js +46 -0
  68. package/src/stories/CheckBox.stories.js +35 -34
  69. package/src/stories/GlobalVariables.stories.js +44 -108
  70. package/src/stories/HawaProvider.stories.js +22 -23
  71. package/src/stories/InputLabel.stories.js +92 -100
  72. package/src/stories/Introduction.stories.js +211 -0
  73. package/src/stories/LayoutStories/Box.stories.js +56 -0
  74. package/src/stories/RadioSelector.stories.js +69 -69
  75. package/src/stories/TextField.stories.js +50 -50
  76. package/src/styles.css +400 -400
  77. package/src/styles.scss +679 -0
  78. package/src/themes/HawaProvider.js +87 -0
  79. package/src/ui/ActionButton.js +40 -0
  80. package/src/{components/Hawa/AdaptiveButton → ui}/AdaptiveButton.js +252 -254
  81. package/src/ui/ApplePayButton.js +94 -0
  82. package/src/{components/Hawa/AutoCompleteField/AutoCompleteField.jsx → ui/AutoCompleteField.js} +32 -33
  83. package/src/{components/Hawa/Checkbox/Checkbox.jsx → ui/Checkbox.js} +21 -20
  84. package/src/{components/Hawa/DragDropImages/DragDropImages.jsx → ui/DragDropImages.js} +180 -180
  85. package/src/ui/GithubButton.js +91 -0
  86. package/src/ui/GoogleButton.js +83 -0
  87. package/src/ui/GooglePayButton.js +94 -0
  88. package/src/{components/Hawa/Hawa.jsx → ui/Hawa.js} +3 -3
  89. package/src/ui/HawaInputLabel.js +33 -0
  90. package/src/{components/Hawa/TextArea/TextArea.jsx → ui/HawaTextArea.js} +38 -38
  91. package/src/ui/HawaTextField.js +118 -0
  92. package/src/ui/MadaButton.js +94 -0
  93. package/src/ui/PayPalButton.js +94 -0
  94. package/src/{components/Hawa/RadioBox/RadioBox.jsx → ui/RadioBox.js} +29 -29
  95. package/src/{components/Hawa/RadioSelector/RadioSelector.jsx → ui/RadioSelector.js} +51 -51
  96. package/src/{components/Hawa/Row/Row.jsx → ui/Row.js} +21 -21
  97. package/src/ui/STCPayButton.js +94 -0
  98. package/src/{components/Hawa/SelectedField/SelectedField.jsx → ui/SelectedField.js} +46 -46
  99. package/src/ui/StyledAlert.js +30 -0
  100. package/src/{components/Hawa/StyledTooltip → ui}/StyledTooltip.js +46 -46
  101. package/src/{components/Hawa/TabPanel/TabPanel.jsx → ui/TabPanel.js} +37 -37
  102. package/src/ui/TwitterButton.js +84 -0
  103. package/src/ui/VisaMasterButton.js +94 -0
  104. package/src/ui/WalletButton.js +91 -0
  105. package/src/ui/index.js +22 -0
  106. package/src/util.js +20 -20
  107. package/storybook-static/0.54f7e52e.iframe.bundle.js +1 -0
  108. package/storybook-static/0.f47eb24a4893a96ec307.manager.bundle.js +1 -0
  109. package/storybook-static/1.95be85dd.iframe.bundle.js +3 -0
  110. package/storybook-static/{1.7c0dc86d.iframe.bundle.js.LICENSE.txt → 1.95be85dd.iframe.bundle.js.LICENSE.txt} +0 -0
  111. package/storybook-static/1.95be85dd.iframe.bundle.js.map +1 -0
  112. package/storybook-static/2.eb601582.iframe.bundle.js +1 -0
  113. package/storybook-static/{3.592ce28f.iframe.bundle.js → 3.d72f7fac.iframe.bundle.js} +0 -0
  114. package/storybook-static/4.0fcda1281dc1961dbe94.manager.bundle.js +2 -0
  115. package/storybook-static/{5.f459d151315e6780c20f.manager.bundle.js.LICENSE.txt → 4.0fcda1281dc1961dbe94.manager.bundle.js.LICENSE.txt} +0 -0
  116. package/storybook-static/5.63ab4f94d50a3acf080d.manager.bundle.js +1 -0
  117. package/storybook-static/6.a6d45262f7e98f3f18d3.manager.bundle.js +2 -0
  118. package/storybook-static/{11.f4e922583ae35da460f3.manager.bundle.js.LICENSE.txt → 6.a6d45262f7e98f3f18d3.manager.bundle.js.LICENSE.txt} +0 -0
  119. package/storybook-static/{7.3d04765dbf3f1dcd706c.manager.bundle.js → 7.097710753af9a1c41b80.manager.bundle.js} +1 -1
  120. package/storybook-static/7.ffb0d84b.iframe.bundle.js +1 -0
  121. package/storybook-static/{8.8e2132ec.iframe.bundle.js → 8.68cd1217.iframe.bundle.js} +2 -2
  122. package/storybook-static/{8.8e2132ec.iframe.bundle.js.LICENSE.txt → 8.68cd1217.iframe.bundle.js.LICENSE.txt} +0 -0
  123. package/storybook-static/8.68cd1217.iframe.bundle.js.map +1 -0
  124. package/storybook-static/8.76c3cbf398692028e834.manager.bundle.js +1 -0
  125. package/storybook-static/{9.109ea555.iframe.bundle.js → 9.488e3969.iframe.bundle.js} +0 -0
  126. package/storybook-static/iframe.html +2 -2
  127. package/storybook-static/index.html +9 -1
  128. package/storybook-static/main.044648aa.iframe.bundle.js +1 -0
  129. package/storybook-static/main.ac6e4b72b033097dad76.manager.bundle.js +1 -0
  130. package/storybook-static/{runtime~main.ffc8677e.iframe.bundle.js → runtime~main.3e280e98.iframe.bundle.js} +1 -1
  131. package/storybook-static/runtime~main.c8dac23bc753439736f0.manager.bundle.js +1 -0
  132. package/storybook-static/vendors~main.a697e07137d366f95f76.manager.bundle.js +2 -0
  133. package/storybook-static/{vendors~main.a935f15a2179a6eff5fd.manager.bundle.js.LICENSE.txt → vendors~main.a697e07137d366f95f76.manager.bundle.js.LICENSE.txt} +6 -12
  134. package/storybook-static/vendors~main.d75dc38b.iframe.bundle.js +76 -0
  135. package/storybook-static/{vendors~main.4aa936b1.iframe.bundle.js.LICENSE.txt → vendors~main.d75dc38b.iframe.bundle.js.LICENSE.txt} +3 -45
  136. package/storybook-static/vendors~main.d75dc38b.iframe.bundle.js.map +1 -0
  137. package/tools/build-styles.js +17 -0
  138. package/dist/index.es.js +0 -37
  139. package/dist/index.js +0 -37
  140. package/src/components/Hawa/AdaptiveButton/index.js +0 -1
  141. package/src/components/Hawa/AuthForms/NewPasswordForm.js +0 -23
  142. package/src/components/Hawa/AuthForms/ResetPasswordForm.js +0 -21
  143. package/src/components/Hawa/AuthForms/SignInForm.js +0 -25
  144. package/src/components/Hawa/AuthForms/SignUpForm.js +0 -26
  145. package/src/components/Hawa/AuthForms/viaFacebook.js +0 -0
  146. package/src/components/Hawa/AuthForms/viaGithub.js +0 -0
  147. package/src/components/Hawa/AuthForms/viaGoogle.js +0 -0
  148. package/src/components/Hawa/AuthForms/viaTwitter.js +0 -0
  149. package/src/components/Hawa/AutoCompleteField/index.js +0 -1
  150. package/src/components/Hawa/Box/Box.js +0 -18
  151. package/src/components/Hawa/Box/index.js +0 -1
  152. package/src/components/Hawa/Checkbox/index.js +0 -1
  153. package/src/components/Hawa/DragDropImages/index.js +0 -1
  154. package/src/components/Hawa/HawaProvider/HawaProvider.js +0 -19
  155. package/src/components/Hawa/HawaProvider/index.js +0 -1
  156. package/src/components/Hawa/InputLabel/StyledInputLabel.js +0 -15
  157. package/src/components/Hawa/InputLabel/index.js +0 -1
  158. package/src/components/Hawa/RadioBox/index.js +0 -1
  159. package/src/components/Hawa/RadioSelector/index.js +0 -1
  160. package/src/components/Hawa/Row/index.js +0 -1
  161. package/src/components/Hawa/SelectedField/index.js +0 -1
  162. package/src/components/Hawa/StyledAlert/StyledAlert.js +0 -15
  163. package/src/components/Hawa/StyledAlert/index.js +0 -1
  164. package/src/components/Hawa/StyledTooltip/index.js +0 -1
  165. package/src/components/Hawa/TabPanel/index.js +0 -1
  166. package/src/components/Hawa/TextArea/index.js +0 -1
  167. package/src/components/Hawa/TextField/TextField.js +0 -54
  168. package/src/components/Hawa/TextField/index.js +0 -1
  169. package/src/components/Hawa/index.js +0 -10
  170. package/src/stories/AuthForm.stories.js +0 -76
  171. package/src/stories/Box.stories.js +0 -45
  172. package/storybook-static/0.12392f0b.iframe.bundle.js +0 -1
  173. package/storybook-static/0.55b012452099ace2dca6.manager.bundle.js +0 -1
  174. package/storybook-static/1.0f38715c61c7c3cd11db.manager.bundle.js +0 -1
  175. package/storybook-static/1.7c0dc86d.iframe.bundle.js +0 -3
  176. package/storybook-static/1.7c0dc86d.iframe.bundle.js.map +0 -1
  177. package/storybook-static/10.9f2923a7561bc20fffdb.manager.bundle.js +0 -1
  178. package/storybook-static/11.f4e922583ae35da460f3.manager.bundle.js +0 -2
  179. package/storybook-static/12.1415460941f0bdcb8fa8.manager.bundle.js +0 -1
  180. package/storybook-static/2.ee357266.iframe.bundle.js +0 -1
  181. package/storybook-static/5.f459d151315e6780c20f.manager.bundle.js +0 -2
  182. package/storybook-static/6.3bd64d820f3745f262ff.manager.bundle.js +0 -1
  183. package/storybook-static/7.af56919f.iframe.bundle.js +0 -1
  184. package/storybook-static/8.8e2132ec.iframe.bundle.js.map +0 -1
  185. package/storybook-static/8.b541eadfcb9164835dfc.manager.bundle.js +0 -1
  186. package/storybook-static/9.411ac8e451bbb10926c7.manager.bundle.js +0 -1
  187. package/storybook-static/main.78b7d418.iframe.bundle.js +0 -1
  188. package/storybook-static/main.9bb085ebb152f5b19a2a.manager.bundle.js +0 -1
  189. package/storybook-static/runtime~main.9468098d21070636985f.manager.bundle.js +0 -1
  190. package/storybook-static/vendors~main.4aa936b1.iframe.bundle.js +0 -3
  191. package/storybook-static/vendors~main.4aa936b1.iframe.bundle.js.map +0 -1
  192. package/storybook-static/vendors~main.a935f15a2179a6eff5fd.manager.bundle.js +0 -2
@@ -0,0 +1,132 @@
1
+ import useTranslation from "next-translate/useTranslation";
2
+ import Button from "@mui/material/Button";
3
+ import Chip from "@mui/material/Chip";
4
+
5
+ const PaymentMethod = (props) => {
6
+ const { t } = useTranslation("common");
7
+ const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
8
+ return (
9
+ <>
10
+ {props.wallet ? (
11
+ <PaymentMethodButton
12
+ imageURL={`/wallet.png`}
13
+ methodCode="wallet"
14
+ methodLabel={t("current-wallet")}
15
+ handlePaymentMethod={props.handlePaymentMethod}
16
+ />
17
+ ) : null}
18
+ {props.creditcard ? (
19
+ <PaymentMethodButton
20
+ imageURL={`/visa-master.png`}
21
+ methodCode="creditcard"
22
+ methodLabel={t("credit-card")}
23
+ handlePaymentMethod={props.handlePaymentMethod}
24
+ />
25
+ ) : null}
26
+ {props.mada ? (
27
+ <PaymentMethodButton
28
+ imageURL={`/mada.png`}
29
+ methodCode="mada"
30
+ methodLabel={t("mada")}
31
+ handlePaymentMethod={props.handlePaymentMethod}
32
+ />
33
+ ) : null}
34
+ {props.stcpay ? (
35
+ <PaymentMethodButton
36
+ methodCode="stcpay"
37
+ methodLabel={"STC Pay"}
38
+ chip={t("soon")}
39
+ handlePaymentMethod={props.handlePaymentMethod}
40
+ />
41
+ ) : null}
42
+ {props.paypal ? (
43
+ <PaymentMethodButton
44
+ methodCode="paypal"
45
+ methodLabel={t("paypal")}
46
+ handlePaymentMethod={props.handlePaymentMethod}
47
+ />
48
+ ) : null}
49
+ {isSafari && applepay && (
50
+ <PaymentMethodButton
51
+ methodCode="applepay"
52
+ methodLabel={t("applepay")}
53
+ handlePaymentMethod={props.handlePaymentMethod}
54
+ />
55
+ )}
56
+ {props.googlepay ? (
57
+ <PaymentMethodButton
58
+ methodCode="googlepay"
59
+ chip={t("soon")}
60
+ methodLabel={t("googlepay")}
61
+ handlePaymentMethod={props.handlePaymentMethod}
62
+ />
63
+ ) : null}
64
+ </>
65
+ );
66
+ };
67
+
68
+ const PaymentMethodButton = (props) => {
69
+ return (
70
+ <Button
71
+ disabled={props?.chip ? true : false}
72
+ fullWidth
73
+ variant="contained"
74
+ color="secondary"
75
+ style={{
76
+ backgroundColor: "white",
77
+ opacity: props.chip ? 0.7 : 1,
78
+ padding: 20,
79
+ width: "90%",
80
+ margin: 10,
81
+ borderRadius: "var(--borderR)"
82
+ }}
83
+ onClick={(e) => props.handlePaymentMethod(e, props.methodCode)}
84
+ >
85
+ {props.imageURL ? (
86
+ <div
87
+ style={{
88
+ // backgroundColor: "red",
89
+ width: "50%",
90
+ textAlign: "right",
91
+ paddingRight: 20
92
+ }}
93
+ >
94
+ <img
95
+ src={props.imageURL}
96
+ // src={`https://qawaim-images.s3-ap-southeast-1.amazonaws.com/payments/visa.png`}
97
+ // alt=""
98
+ // srcset=""
99
+ // height={"100%"}
100
+ // width={"30%"}
101
+ style={{
102
+ // height: "100%",
103
+ // aspectRatio: "6/4",
104
+ maxWidth: 70,
105
+ maxHeight: 70,
106
+ height: "auto"
107
+ }}
108
+ />
109
+ </div>
110
+ ) : null}
111
+ <div
112
+ style={{
113
+ // backgroundColor: "blue",
114
+ width: "50%",
115
+ textAlign: props.imageURL ? "left" : "center"
116
+ }}
117
+ >
118
+ {props.methodLabel}
119
+ {props.chip ? (
120
+ <Chip
121
+ size="small"
122
+ color="primary"
123
+ label={props.chip}
124
+ style={{ marginRight: 10, marginLeft: 10 }}
125
+ />
126
+ ) : null}
127
+ </div>
128
+ </Button>
129
+ );
130
+ };
131
+
132
+ export default PaymentMethod;
@@ -0,0 +1,95 @@
1
+ import React from "react";
2
+ import {
3
+ HawaTextField,
4
+ ActionButton,
5
+ GoogleButton,
6
+ TwitterButton,
7
+ GithubButton,
8
+ VisaMasterButton,
9
+ MadaButton,
10
+ STCPayButton,
11
+ PayPalButton,
12
+ GooglePayButton,
13
+ ApplePayButton,
14
+ WalletButton
15
+ } from "../../ui";
16
+ import { Box } from "../../layout";
17
+ import PropTypes from "prop-types";
18
+
19
+ export const SelectPayment = (props) => {
20
+ return (
21
+ <Box themeType={props.theme} maxWidth={400} noColor noMargin noPadding>
22
+ <Box themeType={props.theme} noMargin>
23
+ <div>Choose Payment</div>
24
+ {props.viaWallet && (
25
+ <WalletButton
26
+ themeType={props.theme}
27
+ outlined
28
+ buttonText={props.walletLabel}
29
+ handleClick={props.handleWallet}
30
+ />
31
+ )}
32
+ {props.viaCreditCard && (
33
+ <VisaMasterButton
34
+ themeType={props.theme}
35
+ outlined
36
+ buttonText={props.visaMasterLabel}
37
+ handleClick={props.handleCreditCard}
38
+ />
39
+ )}
40
+ {props.viaMada && (
41
+ <MadaButton
42
+ themeType={props.theme}
43
+ outlined
44
+ buttonText={props.madaLabel}
45
+ handleClick={props.handleMada}
46
+ />
47
+ )}
48
+
49
+ {props.viaSTCPay && (
50
+ <STCPayButton
51
+ themeType={props.theme}
52
+ outlined
53
+ buttonText={props.stcPayLabel}
54
+ handleClick={props.handleSTCPay}
55
+ />
56
+ )}
57
+ {props.viaPayPal && (
58
+ <PayPalButton
59
+ themeType={props.theme}
60
+ outlined
61
+ buttonText={props.paypalLabel}
62
+ handleClick={props.handlePayPal}
63
+ />
64
+ )}
65
+ {props.viaGooglePay && (
66
+ <GooglePayButton
67
+ themeType={props.theme}
68
+ outlined
69
+ buttonText={props.googlePayLabel}
70
+ handleClick={props.handleGooglePay}
71
+ />
72
+ )}
73
+
74
+ {props.viaApplePay && (
75
+ <ApplePayButton
76
+ themeType={props.theme}
77
+ outlined
78
+ buttonText={props.applePayLabel}
79
+ handleClick={props.handleApplePay}
80
+ />
81
+ )}
82
+ </Box>
83
+ </Box>
84
+ );
85
+ };
86
+
87
+ HawaTextField.propTypes = {
88
+ theme: PropTypes.oneOf(["secondary", "primary"]),
89
+ viaApplePay: PropTypes.bool,
90
+ viaGooglePay: PropTypes.bool,
91
+ viaSTCPay: PropTypes.bool,
92
+ viaCreditCard: PropTypes.bool,
93
+ viaPayPal: PropTypes.bool,
94
+ handleApplePay: PropTypes.func
95
+ };
@@ -0,0 +1,16 @@
1
+ // "use strict";
2
+
3
+ // var _GooglePay = require("./Gateway/GooglePay");
4
+ // var _Payfort = require("./Gateway/Payfort");
5
+ // var _Paypal = require("./Gateway/Paypal");
6
+ // var _Wallet = require("./Gateway/Wallet");
7
+ // var _PaymentMethod = require("./PaymentMethod");
8
+
9
+ // exports.GooglePay = _GooglePay.default;
10
+ // exports.Payfort = _Payfort.default;
11
+ // exports.Paypal = _Paypal.default;
12
+ // exports.Wallet = _Wallet.default;
13
+ // exports.PaymentMethod = _PaymentMethod.default;
14
+
15
+ export * from "./SelectPayment";
16
+ export * from "./CreditCardForm";
package/src/index.js CHANGED
@@ -1 +1,4 @@
1
- export * from "./components/Hawa";
1
+ export * from "./blocks/Account";
2
+ export * from "./blocks/AuthForms";
3
+ export * from "./blocks/Payment";
4
+ //export * from "./components/Hawa";
@@ -0,0 +1,39 @@
1
+ import React, { useContext } from "react";
2
+ import { ThemeProvider } from "../themes/HawaProvider";
3
+
4
+ export const Box = (props) => {
5
+ const theme = useContext(ThemeProvider);
6
+ let boxStyle = {};
7
+
8
+ console.log(Object.keys(theme.actionButton));
9
+ let currentTheme = Object.keys(theme.actionButton).find(
10
+ (themeName) => themeName.toLowerCase() === props.themeType?.toLowerCase()
11
+ );
12
+ if (currentTheme) {
13
+ boxStyle = {
14
+ display: "flex",
15
+ flexDirection: "column",
16
+ ...theme.layout[currentTheme],
17
+ backgroundColor: props.noColor
18
+ ? "none"
19
+ : theme.layout[currentTheme].backgroundColor,
20
+ padding: props.noPadding ? 0 : theme.layout[currentTheme].padding,
21
+ margin: props.noMargin ? 0 : theme.layout[currentTheme].margin,
22
+ maxWidth: props.maxWidth
23
+ };
24
+ } else {
25
+ boxStyle = {
26
+ display: "flex",
27
+ flexDirection: "column",
28
+ color: "white",
29
+ marginTop: props.last ? 10 * 2 : 0,
30
+ backgroundColor: props.noColor ? "none" : "lightGrey",
31
+ padding: props.noPadding ? 0 : 10,
32
+ margin: props.noMargin ? 0 : 10,
33
+ maxWidth: props.maxWidth,
34
+ borderRadius: 0
35
+ };
36
+ }
37
+
38
+ return <div style={boxStyle}>{props.children}</div>;
39
+ };
@@ -0,0 +1 @@
1
+ export * from "./Box";
@@ -0,0 +1,53 @@
1
+ import React from "react";
2
+
3
+ import { defaultTheme, HawaProvider } from "../themes/HawaProvider";
4
+ import { ActionButton } from "../ui";
5
+
6
+ const Template = (args) => {
7
+ return (
8
+ <HawaProvider theme={{ ...defaultTheme }}>
9
+ <ActionButton themeType={args.theme} text={args.buttonLabel} />
10
+ </HawaProvider>
11
+ );
12
+ };
13
+ //types:
14
+ //error (red)
15
+ //warning (red)
16
+ //notice (blue)
17
+
18
+ export default {
19
+ title: "UI/ActionButton",
20
+ component: ActionButton,
21
+ argTypes: {
22
+ theme: {
23
+ description: "overwritten description",
24
+ table: {
25
+ type: {
26
+ summary: "something short"
27
+ },
28
+ defaultValue: { summary: "Hello" }
29
+ },
30
+ options: ["primary", "secondary", "default"],
31
+ control: { type: "select" }
32
+ }
33
+ }
34
+ };
35
+
36
+ Template.args = {
37
+ showText: true,
38
+ buttonLabel: "test",
39
+ theme: "primary"
40
+ };
41
+ export const Primary = Template.bind({});
42
+ Primary.args = {
43
+ showText: true,
44
+ buttonLabel: "test",
45
+ theme: "primary"
46
+ };
47
+
48
+ export const Secondary = Template.bind({});
49
+ Secondary.args = {
50
+ showText: true,
51
+ buttonLabel: "test",
52
+ theme: "secondary"
53
+ };
@@ -1,80 +1,80 @@
1
- import React from "react";
2
- import AdaptiveButton from "../components/Hawa/AdaptiveButton/AdaptiveButton";
3
- import CastIcon from "@material-ui/icons/Cast";
4
- import { HawaProvider } from "../components/Hawa/HawaProvider";
5
-
6
- const Template = (args) => {
7
- const theme = {
8
- borderRadius: 10,
9
- primaryColor: "#004fff",
10
- secondaryColor: "red",
11
- // margins: "10px",
12
- paddings: 10
13
- };
14
- return (
15
- <HawaProvider theme={theme}>
16
- <AdaptiveButton {...args} />
17
- </HawaProvider>
18
- );
19
- };
20
- export default {
21
- title: "Components/AdaptiveButton",
22
- component: AdaptiveButton,
23
- argsTypes: {
24
- buttonLabel: { control: "text" },
25
- borderRadius: { control: "number" },
26
- buttonColor: { control: "color" },
27
- padding: { control: "number" },
28
- hintTitle: { control: "text" },
29
- hintContent: { control: "text" }
30
- },
31
- args: {
32
- // type: "text",
33
- // buttonLabel: "Test"
34
- // borderRadius: 15,
35
- hintTitle: "test",
36
- hintContent: "more test",
37
- buttonColor: "#f9f9f9"
38
- }
39
- };
40
-
41
- export const Light = Template.bind({});
42
- Light.args = {
43
- showText: true,
44
- buttonLabel: "test",
45
- borderRadius: 5,
46
- icon: <CastIcon />,
47
- textColor: "#000000",
48
- buttonColor: "#f9f9f9"
49
- // placeholder: "Example ...",
50
- // defaultValue: "This is default value",
51
- // inputLabel: "Text Field",
52
- // padding: 10
53
- };
54
-
55
- export const Dark = Template.bind({});
56
- Dark.args = {
57
- showText: true,
58
- buttonLabel: "test",
59
- borderRadius: 5,
60
- buttonColor: "#878787",
61
- textColor: "#ffffff",
62
- icon: <CastIcon />
63
- // placeholder: "Exemple ...",
64
- // defaultValue: "This is default value",
65
- // inputLabel: "Text Field",
66
- // padding: 10
67
- };
68
- export const Danger = Template.bind({});
69
- Danger.args = {
70
- showText: true,
71
- buttonLabel: "test",
72
- borderRadius: 5,
73
- buttonColor: "#c0c0c0",
74
- danger: true,
75
- icon: <CastIcon />
76
- // placeholder: "Exemple ...",
77
- // defaultValue: "This is default value",
78
- // inputLabel: "Text Field",
79
- // padding: 10
80
- };
1
+ import React from "react";
2
+ import CastIcon from "@mui/icons-material/Cast";
3
+ import { HawaProvider } from "../themes/HawaProvider";
4
+ import { AdaptiveButton } from "../ui";
5
+
6
+ const Template = (args) => {
7
+ const theme = {
8
+ borderRadius: 10,
9
+ primaryColor: "#004fff",
10
+ secondaryColor: "red",
11
+ // margins: "10px",
12
+ paddings: 10
13
+ };
14
+ return (
15
+ <HawaProvider theme={theme}>
16
+ <AdaptiveButton {...args} />
17
+ </HawaProvider>
18
+ );
19
+ };
20
+ export default {
21
+ title: "UI/AdaptiveButton",
22
+ component: AdaptiveButton,
23
+ argsTypes: {
24
+ buttonLabel: { control: "text" },
25
+ borderRadius: { control: "number" },
26
+ buttonColor: { control: "color" },
27
+ padding: { control: "number" },
28
+ hintTitle: { control: "text" },
29
+ hintContent: { control: "text" }
30
+ },
31
+ args: {
32
+ // type: "text",
33
+ // buttonLabel: "Test"
34
+ // borderRadius: 15,
35
+ hintTitle: "test",
36
+ hintContent: "more test",
37
+ buttonColor: "#f9f9f9"
38
+ }
39
+ };
40
+
41
+ export const Light = Template.bind({});
42
+ Light.args = {
43
+ showText: true,
44
+ buttonLabel: "test",
45
+ borderRadius: 5,
46
+ icon: <CastIcon />,
47
+ textColor: "#000000",
48
+ buttonColor: "#f9f9f9"
49
+ // placeholder: "Example ...",
50
+ // defaultValue: "This is default value",
51
+ // inputLabel: "Text Field",
52
+ // padding: 10
53
+ };
54
+
55
+ export const Dark = Template.bind({});
56
+ Dark.args = {
57
+ showText: true,
58
+ buttonLabel: "test",
59
+ borderRadius: 5,
60
+ buttonColor: "#878787",
61
+ textColor: "#ffffff",
62
+ icon: <CastIcon />
63
+ // placeholder: "Exemple ...",
64
+ // defaultValue: "This is default value",
65
+ // inputLabel: "Text Field",
66
+ // padding: 10
67
+ };
68
+ export const Danger = Template.bind({});
69
+ Danger.args = {
70
+ showText: true,
71
+ buttonLabel: "test",
72
+ borderRadius: 5,
73
+ buttonColor: "#c0c0c0",
74
+ danger: true,
75
+ icon: <CastIcon />
76
+ // placeholder: "Exemple ...",
77
+ // defaultValue: "This is default value",
78
+ // inputLabel: "Text Field",
79
+ // padding: 10
80
+ };
@@ -1,48 +1,41 @@
1
- import React from "react";
2
-
3
- import { HawaProvider } from "../components/Hawa/HawaProvider";
4
- import { StyledAlert } from "../components/Hawa/StyledAlert/StyledAlert";
5
-
6
- const Template = (args) => {
7
- const theme = {
8
- borderRadius: 10,
9
- primaryColor: "green",
10
- secondaryColor: "red",
11
- // margins: "10px",
12
- paperColors: "#c6c6c6",
13
- paddings: 10,
14
- margins: 10
15
- };
16
- return (
17
- <HawaProvider theme={theme}>
18
- <StyledAlert text="teshht" />
19
- </HawaProvider>
20
- );
21
- };
22
- //types:
23
- //error (red)
24
- //warning (red)
25
- //notice (blue)
26
-
27
- export default {
28
- title: "Components/Alert",
29
- component: StyledAlert
30
- };
31
-
32
- export const Light = Template.bind({});
33
- Light.args = {
34
- showText: true,
35
- buttonLabel: "test",
36
- borderRadius: 5,
37
- textColor: "#000000",
38
- buttonColor: "#f9f9f9"
39
- };
40
-
41
- export const Dark = Template.bind({});
42
- Dark.args = {
43
- showText: true,
44
- buttonLabel: "test",
45
- borderRadius: 5,
46
- buttonColor: "#878787",
47
- textColor: "#ffffff"
48
- };
1
+ import React from "react";
2
+
3
+ import { HawaProvider } from "../themes/HawaProvider";
4
+ import { StyledAlert } from "../ui";
5
+
6
+ const Template = (args) => {
7
+ const theme = {
8
+ borderRadius: 10,
9
+ primaryColor: "green",
10
+ secondaryColor: "red",
11
+ // margins: "10px",
12
+ paperColors: "#c6c6c6",
13
+ paddings: 10,
14
+ margins: 10
15
+ };
16
+ return (
17
+ <HawaProvider theme={theme}>
18
+ <StyledAlert text="This is a warning" type="warning" />
19
+ <StyledAlert text="This is a regular notification" type="notification" />
20
+ <StyledAlert text="This is a danger alert" type="danger" />
21
+ </HawaProvider>
22
+ );
23
+ };
24
+ //types:
25
+ //error (red)
26
+ //warning (red)
27
+ //notice (blue)
28
+
29
+ export default {
30
+ title: "UI/Alert",
31
+ component: StyledAlert
32
+ };
33
+
34
+ export const Default = Template.bind({});
35
+ Default.args = {
36
+ showText: true,
37
+ buttonLabel: "test",
38
+ borderRadius: 5,
39
+ textColor: "#000000",
40
+ buttonColor: "#f9f9f9"
41
+ };