@sikka/hawa 0.0.5 → 0.0.8
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/es/index.es.js +1 -1
- package/lib/index.js +1 -1
- package/package.json +4 -5
- package/src/blocks/Account/UserProfile.js +57 -7
- package/src/blocks/AuthForms/NewPasswordForm.js +100 -17
- package/src/blocks/AuthForms/ResetPasswordForm.js +61 -5
- package/src/blocks/AuthForms/SignInForm.js +101 -26
- package/src/blocks/AuthForms/SignUpForm.js +113 -32
- package/src/blocks/Payment/ChargeWalletForm.js +53 -0
- package/src/blocks/Payment/CreditCardForm.js +50 -21
- package/src/blocks/Payment/PayWithWallet.js +14 -0
- package/src/blocks/Payment/SelectPayment.js +20 -42
- package/src/blocks/Payment/index.js +2 -0
- package/src/layout/Box.js +9 -10
- package/src/stories/BlocksStories/AuthForm.stories.js +18 -12
- package/src/stories/BlocksStories/PaymentForm.stories.js +15 -40
- package/src/stories/BlocksStories/UserForm.stories.js +41 -0
- package/src/stories/{Introduction.stories.js → Introduction.stories.mdx} +45 -27
- package/src/stories/LayoutStories/Box.stories.js +4 -4
- package/src/stories/{ActionButton.stories.js → UIStories/ActionButton.stories.js} +16 -23
- package/src/stories/UIStories/AdaptiveButton.stories.js +81 -0
- package/src/stories/UIStories/Alert.stories.js +42 -0
- package/src/stories/{CheckBox.stories.js → UIStories/CheckBox.stories.js} +3 -4
- package/src/stories/UIStories/InputLabel.stories.js +13 -0
- package/src/stories/UIStories/LogoButtons.stories.js +90 -0
- package/src/stories/UIStories/RadioSelector.stories.js +53 -0
- package/src/stories/UIStories/SettingsRow.stories.js +64 -0
- package/src/stories/{TextField.stories.js → UIStories/TextField.stories.js} +4 -5
- package/src/themes/HawaProvider.js +107 -11
- package/src/ui/ActionButton.js +12 -11
- package/src/ui/AdaptiveButton.js +43 -159
- package/src/ui/HawaAlert.js +37 -0
- package/src/ui/HawaButton.js +48 -0
- package/src/ui/{Checkbox.js → HawaCheckbox.js} +1 -1
- package/src/ui/HawaInputLabel.js +4 -5
- package/src/ui/HawaLogoButton.js +138 -0
- package/src/ui/HawaRadio.js +73 -0
- package/src/ui/HawaSettingsRow.js +71 -0
- package/src/ui/HawaTextField.js +69 -80
- package/src/ui/HawaTypography.js +28 -0
- package/src/ui/index.js +9 -19
- package/storybook-static/{1.95be85dd.iframe.bundle.js → 0.0d994c92.iframe.bundle.js} +3 -3
- package/storybook-static/{1.95be85dd.iframe.bundle.js.LICENSE.txt → 0.0d994c92.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/0.0d994c92.iframe.bundle.js.map +1 -0
- package/storybook-static/1.aabc3f3a.iframe.bundle.js +1 -0
- package/storybook-static/{3.d72f7fac.iframe.bundle.js → 2.430bf1e3.iframe.bundle.js} +1 -1
- package/storybook-static/{7.ffb0d84b.iframe.bundle.js → 6.704d1e8d.iframe.bundle.js} +1 -1
- package/storybook-static/{8.68cd1217.iframe.bundle.js → 7.9ce807e3.iframe.bundle.js} +3 -3
- package/storybook-static/{8.68cd1217.iframe.bundle.js.LICENSE.txt → 7.9ce807e3.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/7.9ce807e3.iframe.bundle.js.map +1 -0
- package/storybook-static/{9.488e3969.iframe.bundle.js → 8.c4cb6081.iframe.bundle.js} +1 -1
- package/storybook-static/iframe.html +1 -1
- package/storybook-static/main.5731dbe3.iframe.bundle.js +1 -0
- package/storybook-static/runtime~main.cfefe972.iframe.bundle.js +1 -0
- package/storybook-static/vendors~main.aa1d952a.iframe.bundle.js +76 -0
- package/storybook-static/{vendors~main.d75dc38b.iframe.bundle.js.LICENSE.txt → vendors~main.aa1d952a.iframe.bundle.js.LICENSE.txt} +0 -0
- package/storybook-static/vendors~main.aa1d952a.iframe.bundle.js.map +1 -0
- package/src/stories/AdaptiveButton.stories.js +0 -80
- package/src/stories/Alert.stories.js +0 -41
- package/src/stories/BlocksStories/UserAccount.stories.js +0 -46
- package/src/stories/GlobalVariables.stories.js +0 -44
- package/src/stories/InputLabel.stories.js +0 -92
- package/src/stories/RadioSelector.stories.js +0 -69
- package/src/ui/ApplePayButton.js +0 -94
- package/src/ui/GithubButton.js +0 -91
- package/src/ui/GoogleButton.js +0 -83
- package/src/ui/GooglePayButton.js +0 -94
- package/src/ui/MadaButton.js +0 -94
- package/src/ui/PayPalButton.js +0 -94
- package/src/ui/RadioSelector.js +0 -51
- package/src/ui/STCPayButton.js +0 -94
- package/src/ui/StyledAlert.js +0 -30
- package/src/ui/TwitterButton.js +0 -84
- package/src/ui/VisaMasterButton.js +0 -94
- package/src/ui/WalletButton.js +0 -91
- package/storybook-static/0.54f7e52e.iframe.bundle.js +0 -1
- package/storybook-static/1.95be85dd.iframe.bundle.js.map +0 -1
- package/storybook-static/2.eb601582.iframe.bundle.js +0 -1
- package/storybook-static/8.68cd1217.iframe.bundle.js.map +0 -1
- package/storybook-static/main.044648aa.iframe.bundle.js +0 -1
- package/storybook-static/runtime~main.3e280e98.iframe.bundle.js +0 -1
- package/storybook-static/vendors~main.d75dc38b.iframe.bundle.js +0 -76
- package/storybook-static/vendors~main.d75dc38b.iframe.bundle.js.map +0 -1
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { HawaProvider } from "../../themes/HawaProvider";
|
|
3
|
+
import { ActionButton, HawaLogoButton } from "../../ui";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "Elements/Buttons/LogoButtons",
|
|
7
|
+
component: ActionButton,
|
|
8
|
+
argTypes: {
|
|
9
|
+
theme: {
|
|
10
|
+
options: ["primary", "secondary", "default"],
|
|
11
|
+
control: { type: "select" }
|
|
12
|
+
},
|
|
13
|
+
buttonLabel: { control: "text" },
|
|
14
|
+
logo: { control: "text" }
|
|
15
|
+
},
|
|
16
|
+
args: {
|
|
17
|
+
buttonLabel: "test",
|
|
18
|
+
logo: "google",
|
|
19
|
+
theme: "primary"
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const Template = (args) => {
|
|
23
|
+
return (
|
|
24
|
+
<HawaProvider themeName={args.theme}>
|
|
25
|
+
<HawaLogoButton logo={args.logo} buttonText={args.buttonLabel} />
|
|
26
|
+
</HawaProvider>
|
|
27
|
+
);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Google = Template.bind({});
|
|
31
|
+
Google.args = {
|
|
32
|
+
buttonLabel: "Sign in via Google",
|
|
33
|
+
logo: "google",
|
|
34
|
+
theme: "primary"
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const Twitter = Template.bind({});
|
|
38
|
+
Twitter.args = {
|
|
39
|
+
buttonLabel: "Sign in via Twitter",
|
|
40
|
+
logo: "twitter",
|
|
41
|
+
theme: "primary"
|
|
42
|
+
};
|
|
43
|
+
export const Github = Template.bind({});
|
|
44
|
+
Github.args = {
|
|
45
|
+
buttonLabel: "Sign in via Github",
|
|
46
|
+
logo: "github",
|
|
47
|
+
theme: "primary"
|
|
48
|
+
};
|
|
49
|
+
export const WalletPay = Template.bind({});
|
|
50
|
+
WalletPay.args = {
|
|
51
|
+
buttonLabel: "Pay with Wallet",
|
|
52
|
+
logo: "wallet",
|
|
53
|
+
theme: "primary"
|
|
54
|
+
};
|
|
55
|
+
export const GooglePay = Template.bind({});
|
|
56
|
+
GooglePay.args = {
|
|
57
|
+
buttonLabel: "Google Pay",
|
|
58
|
+
logo: "googlepay",
|
|
59
|
+
theme: "primary"
|
|
60
|
+
};
|
|
61
|
+
export const ApplePay = Template.bind({});
|
|
62
|
+
ApplePay.args = {
|
|
63
|
+
buttonLabel: "Apple Pay",
|
|
64
|
+
logo: "applepay",
|
|
65
|
+
theme: "primary"
|
|
66
|
+
};
|
|
67
|
+
export const STCPay = Template.bind({});
|
|
68
|
+
STCPay.args = {
|
|
69
|
+
buttonLabel: "STC Pay",
|
|
70
|
+
logo: "stcpay",
|
|
71
|
+
theme: "primary"
|
|
72
|
+
};
|
|
73
|
+
export const VisaMasterPay = Template.bind({});
|
|
74
|
+
VisaMasterPay.args = {
|
|
75
|
+
buttonLabel: "Visa / Mastercard",
|
|
76
|
+
logo: "visa/master",
|
|
77
|
+
theme: "primary"
|
|
78
|
+
};
|
|
79
|
+
export const PayPal = Template.bind({});
|
|
80
|
+
PayPal.args = {
|
|
81
|
+
buttonLabel: "PayPal",
|
|
82
|
+
logo: "paypal",
|
|
83
|
+
theme: "primary"
|
|
84
|
+
};
|
|
85
|
+
export const Mada = Template.bind({});
|
|
86
|
+
Mada.args = {
|
|
87
|
+
buttonLabel: "Mada",
|
|
88
|
+
logo: "mada",
|
|
89
|
+
theme: "primary"
|
|
90
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { HawaProvider } from "../../themes/HawaProvider";
|
|
3
|
+
import { HawaRadio } from "../../ui";
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: "UI/RadioSelector",
|
|
7
|
+
component: HawaRadio,
|
|
8
|
+
argTypes: {
|
|
9
|
+
theme: {
|
|
10
|
+
options: ["primary", "secondary", "default"],
|
|
11
|
+
control: { type: "select" }
|
|
12
|
+
}
|
|
13
|
+
},
|
|
14
|
+
args: {
|
|
15
|
+
theme: "primary"
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
const Template = (args) => {
|
|
20
|
+
return (
|
|
21
|
+
<HawaProvider themeName={args.theme}>
|
|
22
|
+
<HawaRadio
|
|
23
|
+
defaultValue="option1"
|
|
24
|
+
options={[
|
|
25
|
+
{ text: "Option 1", label: "option1" },
|
|
26
|
+
{ text: "Option 2", label: "option2" },
|
|
27
|
+
{ text: "Option 3", label: "option3" }
|
|
28
|
+
]}
|
|
29
|
+
/>
|
|
30
|
+
</HawaProvider>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
33
|
+
export const Light = Template.bind({});
|
|
34
|
+
|
|
35
|
+
Light.args = {
|
|
36
|
+
theme: "primary",
|
|
37
|
+
|
|
38
|
+
handleChange: () => {
|
|
39
|
+
console.log("handleChange goes here");
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
export const Dark = Template.bind({});
|
|
43
|
+
Dark.args = {
|
|
44
|
+
options: [
|
|
45
|
+
{ text: "Option 1", label: "option1" },
|
|
46
|
+
{ text: "Option 2", label: "option2" },
|
|
47
|
+
{ text: "Option 3", label: "option3" }
|
|
48
|
+
],
|
|
49
|
+
defaultValue: "option2",
|
|
50
|
+
handleChange: () => {
|
|
51
|
+
console.log("handleChange goes here");
|
|
52
|
+
}
|
|
53
|
+
};
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import {
|
|
3
|
+
SelectPayment,
|
|
4
|
+
CreditCardForm,
|
|
5
|
+
ChargeWalletForm,
|
|
6
|
+
PayWithWallet
|
|
7
|
+
} from "../../blocks/Payment";
|
|
8
|
+
import { defaultTheme, HawaProvider } from "../../themes/HawaProvider";
|
|
9
|
+
import { HawaSettingsRow } from "../../ui";
|
|
10
|
+
|
|
11
|
+
export default {
|
|
12
|
+
title: "UI/SettingsRow",
|
|
13
|
+
component: [SelectPayment, CreditCardForm],
|
|
14
|
+
argTypes: {
|
|
15
|
+
theme: {
|
|
16
|
+
options: ["primary", "secondary", "default"],
|
|
17
|
+
control: { type: "select" }
|
|
18
|
+
},
|
|
19
|
+
type: {
|
|
20
|
+
options: ["checkbox", "text", "default"],
|
|
21
|
+
control: { type: "select" }
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
args: {
|
|
25
|
+
theme: "primary",
|
|
26
|
+
type: "checkbox"
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const HawaSettingsRowTemplate = (args) => {
|
|
31
|
+
return (
|
|
32
|
+
<HawaProvider themeName={args.theme}>
|
|
33
|
+
<HawaSettingsRow settingsType={args.type} />
|
|
34
|
+
</HawaProvider>
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const Checkbox = HawaSettingsRowTemplate.bind({});
|
|
39
|
+
Checkbox.args = {
|
|
40
|
+
theme: "primary",
|
|
41
|
+
type: "checkbox"
|
|
42
|
+
};
|
|
43
|
+
export const Text = (args) => {
|
|
44
|
+
return (
|
|
45
|
+
<HawaProvider themeName={args.theme}>
|
|
46
|
+
<HawaSettingsRow settingsType={args.type} />
|
|
47
|
+
</HawaProvider>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
Text.args = {
|
|
51
|
+
theme: "primary",
|
|
52
|
+
type: "text"
|
|
53
|
+
};
|
|
54
|
+
export const Radio = (args) => {
|
|
55
|
+
return (
|
|
56
|
+
<HawaProvider themeName={args.theme}>
|
|
57
|
+
<HawaSettingsRow settingsType={args.type} />
|
|
58
|
+
</HawaProvider>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
Radio.args = {
|
|
62
|
+
theme: "primary",
|
|
63
|
+
type: "radio"
|
|
64
|
+
};
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
3
|
-
import "../styles.css";
|
|
2
|
+
import { HawaTextField } from "../../ui";
|
|
4
3
|
|
|
5
4
|
const Template = (args) => {
|
|
6
|
-
return <
|
|
5
|
+
return <HawaTextField {...args} />;
|
|
7
6
|
};
|
|
8
7
|
|
|
9
8
|
export default {
|
|
10
|
-
title: "
|
|
11
|
-
component:
|
|
9
|
+
title: "UI/TextField",
|
|
10
|
+
component: HawaTextField,
|
|
12
11
|
argsTypes: {
|
|
13
12
|
type: {
|
|
14
13
|
name: "type",
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
import { createContext } from "react";
|
|
2
2
|
|
|
3
3
|
//make the text color of the action buttons different from the text color of the layout
|
|
4
|
+
let allPrimaryBG = "#f90900";
|
|
5
|
+
let allPrimaryAction = "#B20D30";
|
|
4
6
|
export const defaultTheme = {
|
|
7
|
+
allPrimaryBG: "#f90900",
|
|
8
|
+
allPrimaryAction: "#138A36",
|
|
9
|
+
allBorderRadius: 10,
|
|
5
10
|
borderRadius: 10,
|
|
6
11
|
primaryColor: "blue",
|
|
7
12
|
secondaryColor: "grey",
|
|
@@ -13,16 +18,57 @@ export const defaultTheme = {
|
|
|
13
18
|
inputColor: "white", //Color of input fields
|
|
14
19
|
lightBackground: "#FBF5F3", //
|
|
15
20
|
darkBackground: "#0F0E0E",
|
|
21
|
+
testcolor: "green",
|
|
16
22
|
margins: 10,
|
|
17
23
|
paddings: 10,
|
|
18
|
-
|
|
19
|
-
|
|
24
|
+
typography: {
|
|
25
|
+
fontFamily: ["IBMPlex"].join(","),
|
|
26
|
+
primary: { color: "black" },
|
|
27
|
+
secondary: { color: "white" }
|
|
28
|
+
},
|
|
29
|
+
logoButton: {
|
|
20
30
|
primary: {
|
|
31
|
+
borderRadius: 10,
|
|
32
|
+
backgroundColor: allPrimaryAction,
|
|
33
|
+
// margin: 10,
|
|
34
|
+
marginTop: 10,
|
|
35
|
+
padding: 30,
|
|
36
|
+
paddingTop: 0,
|
|
37
|
+
paddingBottom: 0,
|
|
38
|
+
border: "1px solid #ced4da",
|
|
39
|
+
height: 50,
|
|
40
|
+
"&:focus": {
|
|
41
|
+
borderColor: allPrimaryAction
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
secondary: {
|
|
21
45
|
borderRadius: 10,
|
|
22
46
|
backgroundColor: "#f90900",
|
|
47
|
+
marginTop: 10,
|
|
48
|
+
padding: 30,
|
|
49
|
+
paddingTop: 0,
|
|
50
|
+
paddingBottom: 0,
|
|
51
|
+
border: "1px solid #ced4da",
|
|
52
|
+
height: 50,
|
|
53
|
+
"&:focus": {
|
|
54
|
+
borderColor: "green"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
actionButton: {
|
|
59
|
+
primary: {
|
|
60
|
+
borderRadius: 10,
|
|
61
|
+
// backgroundColor: "#f90900",
|
|
62
|
+
backgroundColor: allPrimaryAction,
|
|
23
63
|
color: "white",
|
|
24
64
|
margin: 10,
|
|
25
|
-
padding: 10
|
|
65
|
+
padding: 10,
|
|
66
|
+
border: "1px solid #ced4da",
|
|
67
|
+
fontSize: 16,
|
|
68
|
+
height: 50,
|
|
69
|
+
"&:focus": {
|
|
70
|
+
borderColor: "red"
|
|
71
|
+
}
|
|
26
72
|
},
|
|
27
73
|
secondary: {
|
|
28
74
|
borderRadius: 10,
|
|
@@ -52,18 +98,65 @@ export const defaultTheme = {
|
|
|
52
98
|
inputFields: {
|
|
53
99
|
primary: {
|
|
54
100
|
backgroundColor: "white",
|
|
101
|
+
borderRadius: 10,
|
|
102
|
+
"&:focus": {
|
|
103
|
+
borderColor: "red",
|
|
104
|
+
borderWidth: 1,
|
|
105
|
+
border: "1px solid black"
|
|
106
|
+
},
|
|
107
|
+
"&:hover": {
|
|
108
|
+
borderColor: "red",
|
|
109
|
+
borderWidth: 1,
|
|
110
|
+
border: "1px solid black"
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
secondary: {
|
|
114
|
+
backgroundColor: "white",
|
|
115
|
+
|
|
116
|
+
borderRadius: 10
|
|
117
|
+
}
|
|
118
|
+
},
|
|
119
|
+
alerts: {
|
|
120
|
+
primary: {
|
|
121
|
+
marginBottom: 10,
|
|
122
|
+
padding: 10,
|
|
123
|
+
borderRadius: 10
|
|
124
|
+
},
|
|
125
|
+
secondary: {
|
|
126
|
+
marginBottom: 10,
|
|
127
|
+
padding: 10,
|
|
128
|
+
borderRadius: 10
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
settingsRow: {
|
|
132
|
+
primary: {
|
|
55
133
|
display: "flex",
|
|
56
|
-
flexDirection: "
|
|
57
|
-
|
|
58
|
-
|
|
134
|
+
flexDirection: "row",
|
|
135
|
+
justifyContent: "space-between",
|
|
136
|
+
alignItems: "center",
|
|
137
|
+
backgroundColor: "#F5F5F5",
|
|
138
|
+
margin: 0,
|
|
139
|
+
padding: 10,
|
|
59
140
|
borderRadius: 10
|
|
60
141
|
},
|
|
61
142
|
secondary: {
|
|
62
|
-
backgroundColor: "white",
|
|
63
143
|
display: "flex",
|
|
64
|
-
flexDirection: "
|
|
65
|
-
|
|
66
|
-
|
|
144
|
+
flexDirection: "row",
|
|
145
|
+
justifyContent: "space-between",
|
|
146
|
+
alignItems: "center",
|
|
147
|
+
backgroundColor: "blue",
|
|
148
|
+
margin: 0,
|
|
149
|
+
padding: 5,
|
|
150
|
+
borderRadius: 10
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
radioSelector: {
|
|
154
|
+
primary: {
|
|
155
|
+
padding: 10,
|
|
156
|
+
borderRadius: 10
|
|
157
|
+
},
|
|
158
|
+
secondary: {
|
|
159
|
+
padding: 10,
|
|
67
160
|
borderRadius: 10
|
|
68
161
|
}
|
|
69
162
|
}
|
|
@@ -72,6 +165,7 @@ export const defaultTheme = {
|
|
|
72
165
|
export const ThemeProvider = createContext(defaultTheme);
|
|
73
166
|
|
|
74
167
|
export const HawaProvider = ({ theme, ...props }) => {
|
|
168
|
+
console.log("theme is ", theme);
|
|
75
169
|
if (props.size === "large") {
|
|
76
170
|
theme = {
|
|
77
171
|
...theme,
|
|
@@ -80,7 +174,9 @@ export const HawaProvider = ({ theme, ...props }) => {
|
|
|
80
174
|
};
|
|
81
175
|
}
|
|
82
176
|
return (
|
|
83
|
-
<ThemeProvider.Provider
|
|
177
|
+
<ThemeProvider.Provider
|
|
178
|
+
value={{ hawaTheme: defaultTheme, themeName: props.themeName }}
|
|
179
|
+
>
|
|
84
180
|
{props.children}
|
|
85
181
|
</ThemeProvider.Provider>
|
|
86
182
|
);
|
package/src/ui/ActionButton.js
CHANGED
|
@@ -4,20 +4,22 @@ import { ThemeProvider } from "../themes/HawaProvider";
|
|
|
4
4
|
import { styled, darken } from "@mui/material/styles";
|
|
5
5
|
|
|
6
6
|
export const ActionButton = (props) => {
|
|
7
|
-
const
|
|
8
|
-
const currentTheme = Object.keys(
|
|
9
|
-
(
|
|
7
|
+
const { hawaTheme, themeName } = useContext(ThemeProvider);
|
|
8
|
+
const currentTheme = Object.keys(hawaTheme.actionButton).find(
|
|
9
|
+
(tName) => tName.toLowerCase() === themeName?.toLowerCase()
|
|
10
10
|
);
|
|
11
11
|
let actionButtonStyle = {};
|
|
12
12
|
|
|
13
13
|
if (currentTheme) {
|
|
14
14
|
actionButtonStyle = {
|
|
15
|
-
...
|
|
16
|
-
margin: props.last ? 0 :
|
|
17
|
-
marginTop: props.last
|
|
15
|
+
...hawaTheme.actionButton[currentTheme],
|
|
16
|
+
margin: props.last ? 0 : hawaTheme.actionButton[currentTheme].margin,
|
|
17
|
+
marginTop: props.last
|
|
18
|
+
? hawaTheme.actionButton[currentTheme].margin * 2
|
|
19
|
+
: 0,
|
|
18
20
|
"&:hover": {
|
|
19
21
|
backgroundColor: darken(
|
|
20
|
-
|
|
22
|
+
hawaTheme.actionButton[currentTheme]?.backgroundColor,
|
|
21
23
|
0.1
|
|
22
24
|
)
|
|
23
25
|
}
|
|
@@ -27,14 +29,13 @@ export const ActionButton = (props) => {
|
|
|
27
29
|
backgroundColor: "black",
|
|
28
30
|
color: "white",
|
|
29
31
|
padding: 10,
|
|
30
|
-
marginTop: props.last ? 10 * 2 : 0
|
|
32
|
+
marginTop: props.last ? 10 * 2 : 0,
|
|
33
|
+
borderRadius: 0
|
|
31
34
|
};
|
|
32
35
|
}
|
|
33
36
|
|
|
34
37
|
const StyledButton = styled(Button)(({ theme }) => {
|
|
35
|
-
return {
|
|
36
|
-
...actionButtonStyle
|
|
37
|
-
};
|
|
38
|
+
return { ...actionButtonStyle };
|
|
38
39
|
});
|
|
39
40
|
return <StyledButton {...props}>{props.text}</StyledButton>;
|
|
40
41
|
};
|
package/src/ui/AdaptiveButton.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import React, { useState, useContext } from "react";
|
|
2
2
|
import Button from "@mui/material/Button";
|
|
3
3
|
import Tooltip from "@mui/material/Tooltip";
|
|
4
|
-
import { motion } from "framer-motion";
|
|
5
4
|
import PropTypes from "prop-types";
|
|
6
5
|
import { ThemeProvider } from "../themes/HawaProvider";
|
|
7
6
|
import { StyledTooltip } from "./StyledTooltip";
|
|
@@ -19,81 +18,35 @@ export const AdaptiveButton = (props) => {
|
|
|
19
18
|
//full button
|
|
20
19
|
if (showText) {
|
|
21
20
|
return (
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
<Button
|
|
22
|
+
disableRipple
|
|
23
|
+
disabled={props.disabled}
|
|
24
|
+
aria-label={props.buttonLabel}
|
|
25
|
+
color={props.danger ? "secondary" : "primary"}
|
|
26
|
+
onClick={props.handleClick}
|
|
27
|
+
style={{
|
|
28
|
+
backgroundColor: theme.primaryColor,
|
|
27
29
|
borderRadius: theme.borderRadius,
|
|
28
|
-
|
|
30
|
+
padding: theme.paddings,
|
|
31
|
+
color: getTextColor(theme.primaryColor)
|
|
32
|
+
// color: hovered
|
|
33
|
+
// ? "#ffffff"
|
|
34
|
+
// : props.danger
|
|
35
|
+
// ? "#f50057"
|
|
36
|
+
// : "var(--blue)"
|
|
29
37
|
}}
|
|
30
|
-
onMouseEnter={() => setHovered(true)}
|
|
31
|
-
onMouseLeave={() => setHovered(false)}
|
|
32
|
-
onMouseDown={() => setHovered(true)}
|
|
33
|
-
onMouseUp={() => setHovered(false)}
|
|
34
|
-
onMouseOver={() => setHovered(true)}
|
|
35
|
-
onMouseOut={() => setHovered(false)}
|
|
36
38
|
>
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
backgroundColor: theme.primaryColor,
|
|
45
|
-
borderRadius: theme.borderRadius,
|
|
46
|
-
padding: theme.paddings,
|
|
47
|
-
color: getTextColor(theme.primaryColor)
|
|
48
|
-
// color: hovered
|
|
49
|
-
// ? "#ffffff"
|
|
50
|
-
// : props.danger
|
|
51
|
-
// ? "#f50057"
|
|
52
|
-
// : "var(--blue)"
|
|
53
|
-
}}
|
|
54
|
-
>
|
|
55
|
-
{props.icon}
|
|
56
|
-
{props.showText ? (
|
|
57
|
-
<span style={{ marginLeft: props.icon ? 5 : 0 }}>
|
|
58
|
-
{props.buttonLabel}
|
|
59
|
-
</span>
|
|
60
|
-
) : null}
|
|
61
|
-
</Button>
|
|
62
|
-
</motion.div>
|
|
39
|
+
{props.icon}
|
|
40
|
+
{props.showText ? (
|
|
41
|
+
<span style={{ marginLeft: props.icon ? 5 : 0 }}>
|
|
42
|
+
{props.buttonLabel}
|
|
43
|
+
</span>
|
|
44
|
+
) : null}
|
|
45
|
+
</Button>
|
|
63
46
|
);
|
|
64
47
|
} else if (props.buttonLabelOnly) {
|
|
65
48
|
return (
|
|
66
|
-
|
|
67
|
-
transition={{ duration: 0.2 }}
|
|
68
|
-
initial={{
|
|
69
|
-
width: "fit-content",
|
|
70
|
-
backgroundColor: props.buttonColor,
|
|
71
|
-
borderRadius: theme.borderRadius
|
|
72
|
-
}}
|
|
73
|
-
whileTap={{ scale: 1.2 }}
|
|
74
|
-
whileHover={{
|
|
75
|
-
backgroundColor: props.hoverColor,
|
|
76
|
-
borderRadius: theme.borderRadius
|
|
77
|
-
}}
|
|
78
|
-
onMouseEnter={() => setHovered(true)}
|
|
79
|
-
onMouseLeave={() => setHovered(false)}
|
|
80
|
-
onMouseDown={() => {
|
|
81
|
-
setHovered(true);
|
|
82
|
-
setTooltip(true);
|
|
83
|
-
}}
|
|
84
|
-
onMouseUp={() => {
|
|
85
|
-
setHovered(false);
|
|
86
|
-
setTooltip(true);
|
|
87
|
-
}}
|
|
88
|
-
onMouseOver={() => {
|
|
89
|
-
setHovered(true);
|
|
90
|
-
setTooltip(true);
|
|
91
|
-
}}
|
|
92
|
-
onMouseOut={() => {
|
|
93
|
-
setHovered(false);
|
|
94
|
-
// setTooltip(true);
|
|
95
|
-
}}
|
|
96
|
-
>
|
|
49
|
+
<>
|
|
97
50
|
<Tooltip
|
|
98
51
|
placement={screenSize.width > 400 ? "bottom-center" : "top-center"}
|
|
99
52
|
enterTouchDelay={100}
|
|
@@ -146,100 +99,31 @@ export const AdaptiveButton = (props) => {
|
|
|
146
99
|
{props.buttonLabel}
|
|
147
100
|
</Button>
|
|
148
101
|
</Tooltip>
|
|
149
|
-
|
|
102
|
+
</>
|
|
150
103
|
);
|
|
151
104
|
} else {
|
|
152
105
|
//icon only
|
|
153
106
|
return (
|
|
154
|
-
<
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
onMouseDown={() => {
|
|
171
|
-
setHovered(true);
|
|
172
|
-
setTooltip(true);
|
|
173
|
-
}}
|
|
174
|
-
onMouseUp={() => {
|
|
175
|
-
setHovered(false);
|
|
176
|
-
setTooltip(true);
|
|
177
|
-
}}
|
|
178
|
-
onMouseOver={() => {
|
|
179
|
-
setHovered(true);
|
|
180
|
-
setTooltip(true);
|
|
181
|
-
}}
|
|
182
|
-
onMouseOut={() => {
|
|
183
|
-
setHovered(false);
|
|
184
|
-
// setTooltip(true);
|
|
185
|
-
}}
|
|
186
|
-
>
|
|
187
|
-
<StyledTooltip hintTitle="Example" hintContent="More explaination here">
|
|
188
|
-
<Button
|
|
189
|
-
disabled={props.disabled}
|
|
190
|
-
size="small"
|
|
191
|
-
disableRipple
|
|
192
|
-
aria-label={props.buttonLabel}
|
|
193
|
-
onClick={props.handleClick}
|
|
194
|
-
color={props.danger ? "secondary" : "primary"}
|
|
195
|
-
style={{
|
|
196
|
-
padding: 10,
|
|
197
|
-
color: hovered
|
|
198
|
-
? "#ffffff"
|
|
199
|
-
: props.danger
|
|
200
|
-
? "#f50057"
|
|
201
|
-
: "var(--blue)"
|
|
202
|
-
}}
|
|
203
|
-
>
|
|
204
|
-
{props.icon}
|
|
205
|
-
</Button>
|
|
206
|
-
</StyledTooltip>
|
|
207
|
-
{/* <Tooltip
|
|
208
|
-
placement={screenSize.width > 400 ? "bottom-center" : "top-center"}
|
|
209
|
-
enterTouchDelay={100}
|
|
210
|
-
title={
|
|
211
|
-
props.hint ? (
|
|
212
|
-
props.hint
|
|
213
|
-
) : (
|
|
214
|
-
<div>
|
|
215
|
-
<div
|
|
216
|
-
style={{
|
|
217
|
-
fontSize: 20,
|
|
218
|
-
fontWeight: 800,
|
|
219
|
-
padding: 10,
|
|
220
|
-
paddingBottom: 5,
|
|
221
|
-
textAlign: "center"
|
|
222
|
-
}}
|
|
223
|
-
>
|
|
224
|
-
{props.hintTitle}
|
|
225
|
-
</div>
|
|
226
|
-
<div
|
|
227
|
-
style={{
|
|
228
|
-
fontSize: 13,
|
|
229
|
-
fontWeight: 100,
|
|
230
|
-
padding: 10,
|
|
231
|
-
textAlign: "center"
|
|
232
|
-
}}
|
|
233
|
-
>
|
|
234
|
-
{props.hintContent}
|
|
235
|
-
</div>
|
|
236
|
-
</div>
|
|
237
|
-
)
|
|
238
|
-
}
|
|
107
|
+
<StyledTooltip hintTitle="Example" hintContent="More explaination here">
|
|
108
|
+
<Button
|
|
109
|
+
disabled={props.disabled}
|
|
110
|
+
size="small"
|
|
111
|
+
disableRipple
|
|
112
|
+
aria-label={props.buttonLabel}
|
|
113
|
+
onClick={props.handleClick}
|
|
114
|
+
color={props.danger ? "secondary" : "primary"}
|
|
115
|
+
style={{
|
|
116
|
+
padding: 10,
|
|
117
|
+
color: hovered
|
|
118
|
+
? "#ffffff"
|
|
119
|
+
: props.danger
|
|
120
|
+
? "#f50057"
|
|
121
|
+
: "var(--blue)"
|
|
122
|
+
}}
|
|
239
123
|
>
|
|
240
|
-
|
|
241
|
-
</
|
|
242
|
-
</
|
|
124
|
+
{props.icon}
|
|
125
|
+
</Button>
|
|
126
|
+
</StyledTooltip>
|
|
243
127
|
);
|
|
244
128
|
}
|
|
245
129
|
};
|