@sikka/hawa 0.0.1

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 (74) hide show
  1. package/.prettierrc +28 -0
  2. package/README.md +119 -0
  3. package/package.json +47 -0
  4. package/rollup.config.js +40 -0
  5. package/src/components/Hawa/AdaptiveButton/AdaptiveButton.jsx +261 -0
  6. package/src/components/Hawa/AdaptiveButton/index.js +1 -0
  7. package/src/components/Hawa/AutoCompleteField/AutoCompleteField.jsx +33 -0
  8. package/src/components/Hawa/AutoCompleteField/index.js +1 -0
  9. package/src/components/Hawa/Checkbox/Checkbox.jsx +20 -0
  10. package/src/components/Hawa/Checkbox/index.js +1 -0
  11. package/src/components/Hawa/DragDropImages/DragDropImages.jsx +180 -0
  12. package/src/components/Hawa/DragDropImages/index.js +1 -0
  13. package/src/components/Hawa/Hawa.jsx +3 -0
  14. package/src/components/Hawa/HawaProvider/HawaProvider.js +19 -0
  15. package/src/components/Hawa/HawaProvider/index.js +1 -0
  16. package/src/components/Hawa/InputLabel/StyledInputLabel.jsx +36 -0
  17. package/src/components/Hawa/InputLabel/index.js +1 -0
  18. package/src/components/Hawa/RadioBox/RadioBox.jsx +29 -0
  19. package/src/components/Hawa/RadioBox/index.js +1 -0
  20. package/src/components/Hawa/RadioSelector/RadioSelector.jsx +51 -0
  21. package/src/components/Hawa/RadioSelector/index.js +1 -0
  22. package/src/components/Hawa/Row/Row.jsx +23 -0
  23. package/src/components/Hawa/Row/index.js +1 -0
  24. package/src/components/Hawa/SelectedField/SelectedField.jsx +46 -0
  25. package/src/components/Hawa/SelectedField/index.js +1 -0
  26. package/src/components/Hawa/TabPanel/TabPanel.jsx +38 -0
  27. package/src/components/Hawa/TabPanel/index.js +1 -0
  28. package/src/components/Hawa/TextArea/TextArea.jsx +39 -0
  29. package/src/components/Hawa/TextArea/index.js +1 -0
  30. package/src/components/Hawa/TextField/TextField.jsx +41 -0
  31. package/src/components/Hawa/TextField/index.js +1 -0
  32. package/src/components/Hawa/index.js +11 -0
  33. package/src/index.js +1 -0
  34. package/src/stories/AdaptiveButton.stories.js +84 -0
  35. package/src/stories/CheckBox.stories.js +33 -0
  36. package/src/stories/GlobalVariables.stories.js +108 -0
  37. package/src/stories/HawaProvider.stories.js +23 -0
  38. package/src/stories/InputLabel.stories.js +100 -0
  39. package/src/stories/RadioSelector.stories.js +69 -0
  40. package/src/stories/TextField.stories.js +59 -0
  41. package/src/styles.css +403 -0
  42. package/storybook-static/0.86a7edfd.iframe.bundle.js +1 -0
  43. package/storybook-static/0.b73eaee9a88f178d62ed.manager.bundle.js +1 -0
  44. package/storybook-static/1.f296d183a17268696d73.manager.bundle.js +1 -0
  45. package/storybook-static/10.9998ba67d65d81d20896.manager.bundle.js +1 -0
  46. package/storybook-static/11.49c687eaa6261f8b7be2.manager.bundle.js +2 -0
  47. package/storybook-static/11.49c687eaa6261f8b7be2.manager.bundle.js.LICENSE.txt +12 -0
  48. package/storybook-static/12.c9538ed3766c96f289e7.manager.bundle.js +1 -0
  49. package/storybook-static/4.f6eb74f4.iframe.bundle.js +3 -0
  50. package/storybook-static/4.f6eb74f4.iframe.bundle.js.LICENSE.txt +8 -0
  51. package/storybook-static/4.f6eb74f4.iframe.bundle.js.map +1 -0
  52. package/storybook-static/5.ec6f37af.iframe.bundle.js +1 -0
  53. package/storybook-static/5.fa71488e730c5c7f885f.manager.bundle.js +2 -0
  54. package/storybook-static/5.fa71488e730c5c7f885f.manager.bundle.js.LICENSE.txt +8 -0
  55. package/storybook-static/6.8096ae4aadde0743697b.manager.bundle.js +1 -0
  56. package/storybook-static/6.fbc7b90b.iframe.bundle.js +3 -0
  57. package/storybook-static/6.fbc7b90b.iframe.bundle.js.LICENSE.txt +12 -0
  58. package/storybook-static/6.fbc7b90b.iframe.bundle.js.map +1 -0
  59. package/storybook-static/7.a806a38f.iframe.bundle.js +1 -0
  60. package/storybook-static/7.b34baecbd082bc7b188d.manager.bundle.js +1 -0
  61. package/storybook-static/8.15577edffecf900a8de2.manager.bundle.js +1 -0
  62. package/storybook-static/9.d7d85aa0a49a98f17218.manager.bundle.js +1 -0
  63. package/storybook-static/favicon.ico +0 -0
  64. package/storybook-static/iframe.html +138 -0
  65. package/storybook-static/index.html +47 -0
  66. package/storybook-static/main.355ffc59.iframe.bundle.js +1 -0
  67. package/storybook-static/main.ce406c7e93b98325390e.manager.bundle.js +1 -0
  68. package/storybook-static/runtime~main.3d81579b.iframe.bundle.js +1 -0
  69. package/storybook-static/runtime~main.909d038f912f063e8837.manager.bundle.js +1 -0
  70. package/storybook-static/vendors~main.73411ca9.iframe.bundle.js +3 -0
  71. package/storybook-static/vendors~main.73411ca9.iframe.bundle.js.LICENSE.txt +148 -0
  72. package/storybook-static/vendors~main.73411ca9.iframe.bundle.js.map +1 -0
  73. package/storybook-static/vendors~main.d3455eed64b243c89325.manager.bundle.js +2 -0
  74. package/storybook-static/vendors~main.d3455eed64b243c89325.manager.bundle.js.LICENSE.txt +88 -0
@@ -0,0 +1,180 @@
1
+ import React, { useEffect, useState } from "react";
2
+ import axios from "axios";
3
+ import { getToken } from "../token";
4
+ import { useDropzone } from "react-dropzone";
5
+ import useTranslation from "next-translate/useTranslation";
6
+ import Badge from "@material-ui/core/Badge";
7
+ import CloseIcon from "@material-ui/icons/Close";
8
+ import styles from "../styles/Theme.module.css";
9
+
10
+ const thumbsContainer = {
11
+ display: "flex",
12
+ flexDirection: "row",
13
+ flexWrap: "wrap",
14
+ marginTop: 10
15
+ };
16
+
17
+ const DragDropItemImage = ({
18
+ files,
19
+ setFiles,
20
+ itemId,
21
+ setDeletedFiles,
22
+ refetchSingleMenu
23
+ }) => {
24
+ const token = getToken();
25
+ const [cmp, setCmp] = useState(0);
26
+ //const [thumbs, setThumbs] = useState("");
27
+ const { t } = useTranslation("common");
28
+ const { getRootProps, getInputProps, fileRejections, acceptedFiles } =
29
+ useDropzone({
30
+ multiple: token.Pack?.image_per_item_limit > 1,
31
+ accept: "image/*",
32
+ maxSize: 5000000,
33
+ maxFiles: token.Pack?.image_per_item_limit,
34
+ onDrop: (acceptedFiles) => {
35
+ setFiles(
36
+ acceptedFiles.map((file, index) =>
37
+ Object.assign(file, {
38
+ preview: URL.createObjectURL(file)
39
+ })
40
+ )
41
+ );
42
+ }
43
+ });
44
+ const handleRemoveFile = async (file) => {
45
+ console.log("fezafezaf", acceptedFiles[file]);
46
+ if (acceptedFiles[file]?.isFromDB) {
47
+ setDeletedFiles((old) => [
48
+ ...old,
49
+ {
50
+ img_url: acceptedFiles[file]?.img_url,
51
+ _id: acceptedFiles[file]?._id
52
+ }
53
+ ]);
54
+ try {
55
+ await axios.post(
56
+ `${process.env.NEXT_PUBLIC_QAWAIM_API_URL}/deleteImages`,
57
+ {
58
+ deletedFiles: [
59
+ {
60
+ img_url: acceptedFiles[file]?.img_url,
61
+ _id: acceptedFiles[file]?._id
62
+ }
63
+ ],
64
+ itemId: itemId
65
+ }
66
+ );
67
+ refetchSingleMenu();
68
+ acceptedFiles.splice(file, 1);
69
+ setFiles(acceptedFiles);
70
+ } catch (err) {
71
+ console.error(err);
72
+ }
73
+ console.log("accepted files after delete : ", acceptedFiles);
74
+ setCmp((old) => old + 1);
75
+ return;
76
+ }
77
+ // if (file.hasOwnProperty("_id")) {
78
+ // console.log("Yes");
79
+ // return;
80
+ // }
81
+ acceptedFiles.splice(file, 1);
82
+
83
+ setFiles(
84
+ acceptedFiles.map((f) =>
85
+ Object.assign(f, { preview: URL.createObjectURL(f) })
86
+ )
87
+ );
88
+ // setFiles(acceptedFiles);
89
+ };
90
+ useEffect(
91
+ () => () => {
92
+ files.forEach((file) => {
93
+ URL.revokeObjectURL(file.preview);
94
+ });
95
+ },
96
+
97
+ [files]
98
+ );
99
+ useEffect(() => {
100
+ if (files[0]?.hasOwnProperty("_id")) {
101
+ files?.map((file, index) => {
102
+ acceptedFiles.push({
103
+ preview: `https://qawaim-images.s3-ap-southeast-1.amazonaws.com/${file.image_url}`,
104
+ isFromDB: true,
105
+ _id: file._id,
106
+ img_url: file.image_url
107
+ });
108
+ });
109
+ console.log("accepted files : ", acceptedFiles);
110
+ setFiles(acceptedFiles);
111
+ }
112
+ return () => {
113
+ acceptedFiles.splice(0, acceptedFiles?.length);
114
+ };
115
+ }, []);
116
+ const errs = fileRejections.map((rej, i) => {
117
+ return (
118
+ <div key={i} className={styles.upload_error_container}>
119
+ <div>{rej.file.name}</div>
120
+ <div>{t(rej.errors[0].code)}</div>
121
+ </div>
122
+ );
123
+ });
124
+
125
+ const thumbs = files.map((file, index) => (
126
+ <Badge
127
+ key={index}
128
+ onClick={(e) => {
129
+ e.preventDefault();
130
+ e.stopPropagation();
131
+ console.log("Clicking", index);
132
+ handleRemoveFile(index);
133
+ }}
134
+ badgeContent={<CloseIcon fontSize="small" />}
135
+ color="primary"
136
+ style={{
137
+ margin: 10,
138
+ width: 100,
139
+ height: 100
140
+ }}
141
+ >
142
+ <div
143
+ style={{
144
+ display: "flex",
145
+ justifyContent: "center",
146
+ alignItems: "center",
147
+ overflow: "hidden",
148
+ height: 100,
149
+ width: 100,
150
+ backgroundImage: `url(${file.preview})`,
151
+ backgroundSize: "cover",
152
+ backgroundPosition: "center"
153
+ }}
154
+ key={file.name}
155
+ />
156
+ </Badge>
157
+ ));
158
+
159
+ return (
160
+ <section className={styles.upload_main_container}>
161
+ <div
162
+ {...getRootProps({
163
+ onClick: (e) => {
164
+ console.log("e : ", e);
165
+ e.preventDefault(), console.log("khobza");
166
+ },
167
+ style: { height: "100%", width: "100%", padding: 10 }
168
+ })}
169
+ >
170
+ <input {...getInputProps()} />
171
+ <div style={{ fontSize: 13 }}>{t("drag-n-drop")}</div>
172
+ <div style={{ fontSize: 13, marginTop: 5 }}>{t("max-file-size")}</div>
173
+ {thumbs ? <aside style={thumbsContainer}>{thumbs}</aside> : null}
174
+ {errs}
175
+ </div>
176
+ </section>
177
+ );
178
+ };
179
+
180
+ export default DragDropItemImage;
@@ -0,0 +1 @@
1
+ export * from "./Checkbox.jsx";
@@ -0,0 +1,3 @@
1
+ export const Hawa = (props) => {
2
+ return <div>test</div>;
3
+ };
@@ -0,0 +1,19 @@
1
+ import { createContext } from "react";
2
+
3
+ const defaultValue = {
4
+ borderRadius: "10px",
5
+ primaryColor: "blue",
6
+ secondaryColor: "grey",
7
+ margins: "10px",
8
+ paddings: "5px"
9
+ };
10
+
11
+ export const ThemeProvider = createContext(defaultValue);
12
+
13
+ export const HawaProvider = ({theme, ...props}) => {
14
+ return (
15
+ <ThemeProvider.Provider value={theme || defaultValue}>
16
+ {props.children}
17
+ </ThemeProvider.Provider>
18
+ );
19
+ };
@@ -0,0 +1 @@
1
+ export * from "./HawaProvider.js";
@@ -0,0 +1,36 @@
1
+ import InputLabel from "@material-ui/core/InputLabel";
2
+
3
+ export const StyledInputLabel = (props) => {
4
+ return (
5
+ <InputLabel
6
+ style={{
7
+ display: "flex",
8
+ flexDirection: "row",
9
+ width: "100%",
10
+ justifyContent: "space-between",
11
+ alignItems: "center",
12
+ margin: 15,
13
+ marginRight: 0,
14
+ marginLeft: 0
15
+ }}
16
+ >
17
+ <div style={{ fontSize: 15, color: "black" }}>{props.label}</div>
18
+
19
+ {props.multiLang ? (
20
+ <div
21
+ style={{
22
+ backgroundColor: "var(--light)",
23
+ fontSize: 10,
24
+ padding: 10,
25
+ borderRadius: "var(--borderR)",
26
+ width: "auto"
27
+ }}
28
+ >
29
+ <span style={{ padding: 5 }}>EN</span>
30
+ <span style={{ padding: 5 }}>AR</span>
31
+ </div>
32
+ ) : null}
33
+ </InputLabel>
34
+ );
35
+ };
36
+
@@ -0,0 +1 @@
1
+ export * from "./StyledInputLabel.jsx"
@@ -0,0 +1,29 @@
1
+ import React from "react";
2
+ import { Controller, useFormContext } from "react-hook-form";
3
+ import FormControlLabel from "@material-ui/core/FormControlLabel";
4
+ import Checkbox from "@material-ui/core/Checkbox";
5
+
6
+ export const StyledRadioBox = (props) => {
7
+ const { control } = useFormContext();
8
+ const { name, defaultValue, rules, shouldUnregister } = props;
9
+
10
+ return (
11
+ <React.Fragment>
12
+ <Controller
13
+ render={({ field }) => (
14
+ <FormControlLabel
15
+ control={<Checkbox />}
16
+ {...props}
17
+ {...field}
18
+ checked={field.value}
19
+ />
20
+ )}
21
+ name={name}
22
+ rules={rules}
23
+ control={control}
24
+ defaultValue={defaultValue}
25
+ shouldUnregister={shouldUnregister}
26
+ />
27
+ </React.Fragment>
28
+ );
29
+ }
@@ -0,0 +1 @@
1
+ export * from "./RadioBox.jsx"
@@ -0,0 +1,51 @@
1
+ import React, { useState, useContext } from "react";
2
+ import { ThemeProvider } from "../HawaProvider";
3
+
4
+ export const StyledRadioSelector = (props) => {
5
+ const [value, setValue] = useState(props.defaultValue);
6
+ const theme = useContext(ThemeProvider);
7
+
8
+ return (
9
+ <div
10
+ style={{
11
+ backgroundColor: "white",
12
+ display: "flex",
13
+ flexDirection: "row",
14
+ margin: theme.margins,
15
+ padding: theme.paddings,
16
+ marginBottom: 10
17
+ }}
18
+ >
19
+ {props.options.map((o) => {
20
+ return (
21
+ <div
22
+ key={o.label}
23
+ className="radio_option"
24
+ onClick={() => {
25
+ setValue(o.label);
26
+ if (props.handleChange) {
27
+ props.handleChange();
28
+ }
29
+ }}
30
+ style={
31
+ value.toLowerCase() === o.label.toLowerCase()
32
+ ? {
33
+ borderRadius: theme.borderRadius,
34
+ padding: theme.paddings,
35
+ backgroundColor:
36
+ theme.primaryColor || props.bgSelectedColor || "blue",
37
+ color: props.textSelectedColor || "lightgray"
38
+ }
39
+ : {
40
+ borderRadius: theme.borderRadius,
41
+ padding: theme.paddings
42
+ }
43
+ }
44
+ >
45
+ {o.text}
46
+ </div>
47
+ );
48
+ })}
49
+ </div>
50
+ );
51
+ };
@@ -0,0 +1 @@
1
+ export * from "./RadioSelector.jsx"
@@ -0,0 +1,23 @@
1
+ export const Row = (props) => {
2
+ return (
3
+ <div
4
+ style={{
5
+ backgroundColor: "var(--light)",
6
+ borderRadius: "var(--borderR)",
7
+ display: "flex",
8
+ flexDirection: "row",
9
+ justifyContent: "space-between",
10
+ alignItems: "center",
11
+ height: 50,
12
+ padding: 10,
13
+ marginBottom: 20,
14
+ width: "100%"
15
+ }}
16
+ >
17
+ <div style={{ fontWeight: 800 }}>{props.title}</div>
18
+ {props.actionComponent}
19
+ </div>
20
+ );
21
+ };
22
+
23
+
@@ -0,0 +1 @@
1
+ export * from "./Row.jsx";
@@ -0,0 +1,46 @@
1
+ import React from "react";
2
+ import { Controller, useFormContext } from "react-hook-form";
3
+ import FormHelperText from "@material-ui/core/FormHelperText";
4
+ import FormControl from "@material-ui/core/FormControl";
5
+ import MenuItem from "@material-ui/core/MenuItem";
6
+ import Select from "@material-ui/core/Select";
7
+
8
+ const MuiSelect = (props) => {
9
+ const { name, options, required, error } = props;
10
+ let isError = false;
11
+ let errorMessage = "";
12
+ if (error && error.hasOwnProperty(name)) {
13
+ isError = true;
14
+ errorMessage = error[name].message;
15
+ }
16
+
17
+ return (
18
+ <FormControl fullWidth={true} error={isError}>
19
+ {label} {required ? <span className="req-label">*</span> : null}
20
+ <Select id={name} {...props}>
21
+ <MenuItem value="">
22
+ <em>None</em>
23
+ </MenuItem>
24
+ {options.map((item) => (
25
+ <MenuItem key={item.id} value={item.id}>
26
+ {item.label}
27
+ </MenuItem>
28
+ ))}
29
+ </Select>
30
+ <FormHelperText>{errorMessage}</FormHelperText>
31
+ </FormControl>
32
+ );
33
+ };
34
+
35
+ export const SelectField = (props) => {
36
+ const { control } = useFormContext();
37
+ return (
38
+ <React.Fragment>
39
+ <Controller
40
+ control={control}
41
+ render={(field) => <MuiSelect {...props} {...field} />}
42
+ {...props}
43
+ />
44
+ </React.Fragment>
45
+ );
46
+ }
@@ -0,0 +1 @@
1
+ export * from "./SelectedField.jsx"
@@ -0,0 +1,38 @@
1
+ import React from "react";
2
+ import { makeStyles } from "@material-ui/core";
3
+
4
+ const useStyles = makeStyles((theme) => ({
5
+ panelsContainer: {
6
+ height: "100%",
7
+ width: "100%"
8
+ },
9
+ panel: {
10
+ backgroundColor: "var(--lightGrey)",
11
+ borderRadius: "var(--borderR)",
12
+ height: "100%",
13
+ width: "100%",
14
+ padding: 10
15
+ }
16
+ }));
17
+
18
+ export const TabPanel = (props) => {
19
+ const classes = useStyles();
20
+ const { children, value, index, ...other } = props;
21
+ return (
22
+ <div
23
+ role="tabpanel"
24
+ className={classes.panelsContainer}
25
+ hidden={value !== index}
26
+ id={`vertical-tabpanel-${index}`}
27
+ aria-labelledby={`vertical-tab-${index}`}
28
+ {...other}
29
+ >
30
+ {value === index && (
31
+ <div className={classes.panel}>
32
+ <span>{children}</span>
33
+ </div>
34
+ )}
35
+ </div>
36
+ );
37
+ }
38
+
@@ -0,0 +1 @@
1
+ export * from "./TabPanel.jsx";
@@ -0,0 +1,39 @@
1
+ import React from "react";
2
+ import { Controller, useFormContext } from "react-hook-form";
3
+ import {StyledInputLabel} from "../InputLabel";
4
+
5
+ export const StyledTextArea = (props) => {
6
+ const { control } = useFormContext();
7
+ const { name, rules, shouldUnregister, inputLabel, helperText } = props;
8
+
9
+ return (
10
+ <Controller
11
+ render={({ field }) => (
12
+ <label>
13
+ {inputLabel ? <StyledInputLabel label={inputLabel} /> : null}
14
+ <textarea
15
+ style={{
16
+ color : "black",
17
+ backgroundColor : props.bgColor || "white",
18
+ borderRadius : props.bdRadius || 10,
19
+ borderBottom : "none",
20
+ border : "none",
21
+ width : "100%",
22
+ padding : 0,
23
+ margin : 0,
24
+ marginBottom : 0,
25
+ resize : props.resize || "vertical"
26
+ }}
27
+ value={field.value ?? ""}
28
+ {...field}
29
+ />
30
+ </label>
31
+ )}
32
+ name={name}
33
+ rules={rules}
34
+ control={control}
35
+ shouldUnregister={shouldUnregister}
36
+ />
37
+ );
38
+ };
39
+
@@ -0,0 +1 @@
1
+ export * from "./TextArea.jsx";
@@ -0,0 +1,41 @@
1
+ import React from "react"
2
+ import TextField from "@material-ui/core/TextField"
3
+ import { StyledInputLabel } from "../InputLabel"
4
+
5
+ export const StyledTextField = (props) => {
6
+ return (
7
+ <div>
8
+ {props.inputLabel ? <StyledInputLabel label={props.inputLabel} /> : null}
9
+ <TextField
10
+ fullWidth={true}
11
+ style={{
12
+ color: "white",
13
+ backgroundColor: props.bgColor || "white",
14
+ borderRadius: props.bdRadius || 10,
15
+ borderBottom: "none",
16
+ padding : props.padding || 5,
17
+ border: "none",
18
+ width: "100%",
19
+ }}
20
+ helperText={props.helperText}
21
+ type={props.type ? props.type : "text"}
22
+ placeholder={props.placeholder}
23
+ inputProps={
24
+ props.type === "number"
25
+ ? {
26
+ inputMode: "numeric",
27
+ min: "0",
28
+ max: "9999999",
29
+ step: "0.01",
30
+ }
31
+ : {}
32
+ }
33
+ InputProps={{
34
+ disableUnderline: true,
35
+ onWheelCapture: (e) => e.target.blur(),
36
+ }}
37
+ value={props.value ? props.value : null}
38
+ />
39
+ </div>
40
+ )
41
+ }
@@ -0,0 +1 @@
1
+ export * from "./TextField.jsx";
@@ -0,0 +1,11 @@
1
+ export * from "./AdaptiveButton";
2
+ export * from "./Checkbox";
3
+ export * from "./InputLabel";
4
+ export * from "./RadioBox";
5
+ export * from "./RadioSelector";
6
+ export * from "./Row";
7
+ export * from "./SelectedField";
8
+ export * from "./TabPanel";
9
+ export * from "./TextArea";
10
+ export * from "./TextField";
11
+
package/src/index.js ADDED
@@ -0,0 +1 @@
1
+ export * from "./components/Hawa";
@@ -0,0 +1,84 @@
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: 20,
9
+ primaryColor: "green",
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
+
49
+ buttonColor: "#f9f9f9"
50
+
51
+ // placeholder: "Example ...",
52
+ // defaultValue: "This is default value",
53
+ // inputLabel: "Text Field",
54
+ // padding: 10
55
+ };
56
+
57
+ export const Dark = Template.bind({});
58
+ Dark.args = {
59
+ showText: true,
60
+ buttonLabel: "test",
61
+ borderRadius: 5,
62
+ buttonColor: "#878787",
63
+ textColor: "#ffffff",
64
+ icon: <CastIcon />
65
+
66
+ // placeholder: "Exemple ...",
67
+ // defaultValue: "This is default value",
68
+ // inputLabel: "Text Field",
69
+ // padding: 10
70
+ };
71
+ export const Danger = Template.bind({});
72
+ Danger.args = {
73
+ showText: true,
74
+ buttonLabel: "test",
75
+ borderRadius: 5,
76
+ buttonColor: "#c0c0c0",
77
+ danger: true,
78
+ icon: <CastIcon />
79
+
80
+ // placeholder: "Exemple ...",
81
+ // defaultValue: "This is default value",
82
+ // inputLabel: "Text Field",
83
+ // padding: 10
84
+ };
@@ -0,0 +1,33 @@
1
+ import React from "react";
2
+ import { StyledCheckbox } from "../components/Hawa/Checkbox/Checkbox";
3
+ import "../styles.css";
4
+
5
+ const Template = (args) => {
6
+ return <StyledCheckbox {...args} />;
7
+ };
8
+
9
+ export default {
10
+ title: "Components/Checkbox",
11
+ component: Light,
12
+ argsTypes: {
13
+ defaultValue: {
14
+ options: [true, false],
15
+ control: { type: "radio" }
16
+ }
17
+ },
18
+ args: {
19
+ defaultValue: true
20
+ }
21
+ };
22
+
23
+ export const Light = Template.bind({});
24
+ export const Dark = Template.bind({});
25
+
26
+ Light.args = {
27
+ color: "gray",
28
+ defaultValue: false
29
+ };
30
+ Dark.args = {
31
+ color: "gray",
32
+ defaultValue: false
33
+ };