ntuthuko-launchpad 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. package/LaunchPad.tsx +148 -0
  2. package/package.json +25 -0
package/LaunchPad.tsx ADDED
@@ -0,0 +1,148 @@
1
+ "use client"; // Mark this as a Client Component
2
+
3
+ import React, { ReactNode } from "react";
4
+ import Image from "next/image";
5
+ import dynamic from "next/dynamic";
6
+ import { FaLinkedin, FaEnvelope, FaPhone, FaSun, FaMoon } from "react-icons/fa";
7
+
8
+ // Dynamically import NextUI components with no SSR
9
+ const Card = dynamic(() => import("@nextui-org/react").then((mod) => mod.Card), { ssr: false });
10
+ const Button = dynamic(() => import("@nextui-org/react").then((mod) => mod.Button), { ssr: false });
11
+
12
+ // Define the props interface for the component
13
+ export interface LaunchPadProps {
14
+ profileImageSrc: string;
15
+ name: string;
16
+ title: string;
17
+ location: string;
18
+ introTitle: string;
19
+ introDescription: string | string[];
20
+ email: string;
21
+ linkedinUrl: string;
22
+ emailIcon?: ReactNode;
23
+ linkedinIcon?: ReactNode;
24
+ contactNumber?: string;
25
+ phoneIcon?: ReactNode;
26
+ splitIntro?: boolean;
27
+ maxIntroWords?: number;
28
+ introTextColor?: string;
29
+ containerTextColor?: string;
30
+ defaultTheme?: "light" | "dark";
31
+ allowThemeToggle?: boolean;
32
+ backgroundLight?: string;
33
+ textColorLight?: string;
34
+ introBgColorLight?: string;
35
+ buttonHoverBgColorLight?: string;
36
+ backgroundDark?: string;
37
+ textColorDark?: string;
38
+ introBgColorDark?: string;
39
+ buttonHoverBgColorDark?: string;
40
+ background?: string | { light: string; dark: string };
41
+ textColor?: string | { light: string; dark: string };
42
+ introBgColor?: string | { light: string; dark: string };
43
+ mainBgColor?: string | { light: string; dark: string };
44
+ }
45
+
46
+ const LaunchPad: React.FC<LaunchPadProps> = ({
47
+ profileImageSrc,
48
+ name,
49
+ title,
50
+ location,
51
+ introTitle,
52
+ introDescription,
53
+ email,
54
+ linkedinUrl,
55
+ emailIcon = <FaEnvelope />,
56
+ linkedinIcon = <FaLinkedin />,
57
+ contactNumber,
58
+ phoneIcon = <FaPhone />,
59
+ splitIntro = false,
60
+ maxIntroWords = 80,
61
+ introTextColor = "",
62
+ containerTextColor = "",
63
+ defaultTheme = "light",
64
+ allowThemeToggle = true,
65
+ backgroundLight = "bg-white",
66
+ textColorLight = "text-black",
67
+ introBgColorLight = "bg-gray-100",
68
+ buttonHoverBgColorLight = "hover:bg-gray-100",
69
+ backgroundDark = "bg-black",
70
+ textColorDark = "text-white",
71
+ introBgColorDark = "bg-gray-800",
72
+ buttonHoverBgColorDark = "hover:bg-gray-700",
73
+ background,
74
+ textColor,
75
+ introBgColor,
76
+ mainBgColor,
77
+ }) => {
78
+ const [theme, setTheme] = React.useState(defaultTheme);
79
+
80
+ const toggleTheme = () => {
81
+ setTheme((prevTheme) => (prevTheme === "light" ? "dark" : "light"));
82
+ };
83
+
84
+ const backgroundClass = background
85
+ ? typeof background === "string"
86
+ ? background
87
+ : theme === "light"
88
+ ? background.light
89
+ : background.dark
90
+ : theme === "light"
91
+ ? backgroundLight
92
+ : backgroundDark;
93
+
94
+ const textColorClass = textColor
95
+ ? typeof textColor === "string"
96
+ ? textColor
97
+ : theme === "light"
98
+ ? textColor.light
99
+ : textColor.dark
100
+ : theme === "light"
101
+ ? textColorLight
102
+ : textColorDark;
103
+
104
+ const introBgColorClass = introBgColor
105
+ ? typeof introBgColor === "string"
106
+ ? introBgColor
107
+ : theme === "light"
108
+ ? introBgColor.light
109
+ : introBgColor.dark
110
+ : theme === "light"
111
+ ? introBgColorLight
112
+ : introBgColorDark;
113
+
114
+ const buttonHoverBgColor =
115
+ theme === "light" ? buttonHoverBgColorLight : buttonHoverBgColorDark;
116
+
117
+ const mainBgColorClass = mainBgColor
118
+ ? typeof mainBgColor === "string"
119
+ ? mainBgColor
120
+ : theme === "light"
121
+ ? mainBgColor.light
122
+ : mainBgColor.dark
123
+ : "";
124
+
125
+ return (
126
+ <div className={`flex flex-col items-center min-h-screen ${containerTextColor} ${backgroundClass} bg-cover bg-center`}>
127
+ <main className={`flex flex-col gap-8 items-center flex-grow w-full max-w-lg mt-2 px-4 ${mainBgColorClass}`}>
128
+ <Card className="w-full shadow-sm flex flex-col items-center mt-4 p-6">
129
+ {allowThemeToggle && (
130
+ <button onClick={toggleTheme} className="self-end p-2 m-4 rounded-md bg-gray-200">
131
+ {theme === "light" ? <FaMoon /> : <FaSun />}
132
+ </button>
133
+ )}
134
+ <div className="flex-shrink-0">
135
+ <Image src={profileImageSrc} alt={`${name} Profile Image`} width={100} height={100} className="rounded-full" priority />
136
+ </div>
137
+ <div className={`flex flex-col items-center text-center mt-4 ${textColorClass}`}>
138
+ <h3 className="text-xl font-bold">{name}</h3>
139
+ <p className="text-base">{title}</p>
140
+ <p className="text-sm">{location}</p>
141
+ </div>
142
+ </Card>
143
+ </main>
144
+ </div>
145
+ );
146
+ };
147
+
148
+ export default LaunchPad;
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "ntuthuko-launchpad",
3
+ "version": "1.0.0",
4
+ "description": "A versatile page component for professionals, freelancers, or businesses, ideal as a placeholder during development or for announcements, invitations, and business info. Features theme toggling, dynamic content, and customizable styling for a polished look.",
5
+ "main": "page.tsx",
6
+ "scripts": {
7
+ "test": "jest"
8
+ },
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://gitlab.com/ntuthuko-dlamini/ntuthuko-dlamini-portfolio.git"
12
+ },
13
+ "keywords": [
14
+ "launchpad",
15
+ "customizable",
16
+ "coming-soon",
17
+ "page-component"
18
+ ],
19
+ "author": "Ntuthuko Dlamini",
20
+ "license": "ISC",
21
+ "bugs": {
22
+ "url": "https://gitlab.com/ntuthuko-dlamini/ntuthuko-dlamini-portfolio/issues"
23
+ },
24
+ "homepage": "https://gitlab.com/ntuthuko-dlamini/ntuthuko-dlamini-portfolio#readme"
25
+ }