@luscii-healthtech/web-ui 2.6.0 → 2.7.0

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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.6.0",
2
+ "version": "2.7.0",
3
3
  "license": "MIT",
4
4
  "main": "dist/index.js",
5
5
  "typings": "dist/index.d.ts",
@@ -0,0 +1,63 @@
1
+ import React from "react";
2
+ import classNames from "classnames";
3
+
4
+ import Button from "../Button/Button";
5
+ import { ButtonProps } from "../Button/Button.types";
6
+ import Text from "../Text/Text";
7
+ import { Title } from "../Title/Title";
8
+
9
+ export type BackgroundColor = "white" | "slate-50";
10
+
11
+ export interface CenteredHeroProps {
12
+ title: string;
13
+ text: string;
14
+ image: string;
15
+ buttons: ButtonProps[];
16
+ background?: BackgroundColor;
17
+ }
18
+
19
+ const CenteredHero = ({
20
+ title,
21
+ text,
22
+ image,
23
+ buttons,
24
+ background = "slate-50",
25
+ }: CenteredHeroProps): JSX.Element => {
26
+ return (
27
+ <div
28
+ className={classNames(
29
+ "p-6 flex flex-col items-center align-center w-full",
30
+ {
31
+ "bg-white": background === "white",
32
+ "bg-slate-50": background === "slate-50",
33
+ }
34
+ )}
35
+ >
36
+ {image && <img src={image} className="h-36 w-36 mb-4" />}
37
+ {title && <Title text={title} type={"base"} />}
38
+ {text && <Text text={text} />}
39
+
40
+ {buttons?.length > 0 && (
41
+ <div className="flex flex-row mt-4">
42
+ {buttons
43
+ .filter(
44
+ (button) => button.title && button.handleOnClick && button.type
45
+ )
46
+ .map((button) => (
47
+ <Button
48
+ className="mr-4 last:mr-0"
49
+ key={button.title}
50
+ role={button.role}
51
+ type={button.type}
52
+ title={button.title}
53
+ text={button.text}
54
+ onClick={button.handleOnClick}
55
+ />
56
+ ))}
57
+ </div>
58
+ )}
59
+ </div>
60
+ );
61
+ };
62
+
63
+ export default CenteredHero;
@@ -1,50 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
- import classNames from "classnames";
4
-
5
- import Button, { BUTTON_ROLES } from "../Button/Button";
6
- import Text from "../Text/Text";
7
- import { Title } from "../Title/Title";
8
-
9
- CenteredHero.propTypes = {
10
- title: PropTypes.string,
11
- text: PropTypes.string,
12
- image: PropTypes.string,
13
- buttons: PropTypes.arrayOf(
14
- PropTypes.shape({
15
- title: PropTypes.string.isRequired,
16
- handleOnClick: PropTypes.func.isRequired,
17
- type: PropTypes.oneOf([BUTTON_ROLES.PRIMARY, BUTTON_ROLES.SECONDARY]).isRequired,
18
- })
19
- ),
20
- className: PropTypes.string,
21
- };
22
-
23
- function CenteredHero({ title, text, image, buttons, className }) {
24
- return (
25
- <div className={classNames(className, "p-6 my-6 flex flex-col items-center w-200 ml-auto mr-auto")}>
26
- {image && <img src={image} />}
27
- {title && <Title className="mt-8 mb-2" text={title} type={"base"} />}
28
- {text && <Text text={text} />}
29
-
30
- {buttons?.length > 0 && (
31
- <div className="flex flex-row mt-8">
32
- {buttons
33
- .filter((button) => button.title && button.handleOnClick && button.type)
34
- .map((button) => (
35
- <Button
36
- className="mr-4 last:mr-0"
37
- key={button.title}
38
- role={button.type}
39
- title={button.title}
40
- text={button.title}
41
- onClick={button.handleOnClick}
42
- />
43
- ))}
44
- </div>
45
- )}
46
- </div>
47
- );
48
- }
49
-
50
- export default CenteredHero;