@snapdragonsnursery/react-components 1.0.9 → 1.0.11
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/README.md +51 -0
- package/package.json +1 -1
- package/src/LandingPage.jsx +106 -16
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@ Reusable React components for Snapdragons projects.
|
|
|
6
6
|
|
|
7
7
|
- **AuthButtons**: Profile button with authentication, user image, dropdown menu (sign out, dark mode), and login/logout handling for MSAL (Azure AD).
|
|
8
8
|
- **ThemeToggle**: Simple theme (light/dark/system) toggle button.
|
|
9
|
+
- **LandingPage**: Professional landing page component for Microsoft authentication flows with customizable branding.
|
|
10
|
+
- **ChildSearchModal**: Modal component for searching and selecting children with advanced filtering and selection capabilities.
|
|
9
11
|
|
|
10
12
|
## Installation
|
|
11
13
|
|
|
@@ -451,6 +453,55 @@ Once setup is complete, the AuthButtons component will:
|
|
|
451
453
|
- Provide a dropdown menu with theme toggle and logout option
|
|
452
454
|
- Handle all authentication flows automatically
|
|
453
455
|
|
|
456
|
+
## LandingPage Component
|
|
457
|
+
|
|
458
|
+
The LandingPage component provides a professional landing page for Microsoft authentication flows.
|
|
459
|
+
|
|
460
|
+
### Quick Start
|
|
461
|
+
|
|
462
|
+
```jsx
|
|
463
|
+
import { LandingPage } from '@snapdragonsnursery/react-components';
|
|
464
|
+
|
|
465
|
+
function App() {
|
|
466
|
+
const handleSignIn = () => {
|
|
467
|
+
// Implement your Microsoft authentication logic
|
|
468
|
+
console.log('Sign in clicked');
|
|
469
|
+
};
|
|
470
|
+
|
|
471
|
+
return (
|
|
472
|
+
<LandingPage
|
|
473
|
+
logoUrl="https://your-logo-url.png"
|
|
474
|
+
appName="Your Application"
|
|
475
|
+
appDescription="Manage your application efficiently"
|
|
476
|
+
onSignIn={handleSignIn}
|
|
477
|
+
companyName="Your Company"
|
|
478
|
+
/>
|
|
479
|
+
);
|
|
480
|
+
}
|
|
481
|
+
```
|
|
482
|
+
|
|
483
|
+
### Props
|
|
484
|
+
|
|
485
|
+
| Prop | Type | Required | Default | Description |
|
|
486
|
+
|------|------|----------|---------|-------------|
|
|
487
|
+
| `logoUrl` | `string` | ✅ | - | URL to your company logo |
|
|
488
|
+
| `appName` | `string` | ✅ | - | Name of your application |
|
|
489
|
+
| `appDescription` | `string` | ❌ | "Manage your application efficiently" | App description |
|
|
490
|
+
| `onSignIn` | `function` | ❌ | `() => console.log('Sign in clicked')` | Sign-in callback |
|
|
491
|
+
| `companyName` | `string` | ❌ | "Your Company" | Company name for footer |
|
|
492
|
+
| `backgroundColor` | `string` | ❌ | Blue gradient | CSS background value |
|
|
493
|
+
| `cardClassName` | `string` | ❌ | `""` | Additional CSS classes |
|
|
494
|
+
|
|
495
|
+
### Features
|
|
496
|
+
|
|
497
|
+
- **Framework Agnostic**: Uses inline styles for maximum compatibility
|
|
498
|
+
- **Responsive Design**: Works on all device sizes
|
|
499
|
+
- **Microsoft Integration**: Official Microsoft logo and branding
|
|
500
|
+
- **Customizable**: Configurable logo, colors, and branding
|
|
501
|
+
- **Accessible**: Proper semantic HTML and keyboard navigation
|
|
502
|
+
|
|
503
|
+
For detailed documentation, see [LANDING_PAGE_DOCUMENTATION.md](./LANDING_PAGE_DOCUMENTATION.md).
|
|
504
|
+
|
|
454
505
|
## Troubleshooting
|
|
455
506
|
|
|
456
507
|
### Common Issues
|
package/package.json
CHANGED
package/src/LandingPage.jsx
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
//
|
|
3
3
|
// A reusable landing page component for Microsoft authentication
|
|
4
4
|
// Designed to work across different applications with customizable branding
|
|
5
|
-
//
|
|
5
|
+
// Uses inline styles and basic CSS for maximum compatibility
|
|
6
6
|
//
|
|
7
7
|
// Example usage:
|
|
8
8
|
// import LandingPage from './LandingPage';
|
|
@@ -31,7 +31,7 @@ const LandingPage = ({
|
|
|
31
31
|
appDescription = "Manage your application efficiently",
|
|
32
32
|
onSignIn,
|
|
33
33
|
companyName = "Your Company",
|
|
34
|
-
backgroundColor = "
|
|
34
|
+
backgroundColor = "linear-gradient(135deg, #EBF4FF 0%, #E6E6FA 100%)",
|
|
35
35
|
cardClassName = ""
|
|
36
36
|
}) => {
|
|
37
37
|
const handleSignInClick = () => {
|
|
@@ -42,34 +42,118 @@ const LandingPage = ({
|
|
|
42
42
|
}
|
|
43
43
|
};
|
|
44
44
|
|
|
45
|
+
const styles = {
|
|
46
|
+
container: {
|
|
47
|
+
minHeight: '100vh',
|
|
48
|
+
background: backgroundColor,
|
|
49
|
+
display: 'flex',
|
|
50
|
+
alignItems: 'center',
|
|
51
|
+
justifyContent: 'center',
|
|
52
|
+
padding: '1rem'
|
|
53
|
+
},
|
|
54
|
+
card: {
|
|
55
|
+
maxWidth: '28rem',
|
|
56
|
+
width: '100%',
|
|
57
|
+
backgroundColor: 'white',
|
|
58
|
+
borderRadius: '1rem',
|
|
59
|
+
boxShadow: '0 25px 50px -12px rgba(0, 0, 0, 0.25)',
|
|
60
|
+
padding: '2rem',
|
|
61
|
+
border: '1px solid #e5e7eb'
|
|
62
|
+
},
|
|
63
|
+
logoSection: {
|
|
64
|
+
textAlign: 'center',
|
|
65
|
+
marginBottom: '2rem'
|
|
66
|
+
},
|
|
67
|
+
logo: {
|
|
68
|
+
height: '4rem',
|
|
69
|
+
margin: '0 auto 1rem auto'
|
|
70
|
+
},
|
|
71
|
+
title: {
|
|
72
|
+
fontSize: '1.5rem',
|
|
73
|
+
fontWeight: 'bold',
|
|
74
|
+
color: '#111827',
|
|
75
|
+
marginBottom: '0.5rem'
|
|
76
|
+
},
|
|
77
|
+
description: {
|
|
78
|
+
color: '#6b7280'
|
|
79
|
+
},
|
|
80
|
+
content: {
|
|
81
|
+
display: 'flex',
|
|
82
|
+
flexDirection: 'column',
|
|
83
|
+
gap: '1.5rem'
|
|
84
|
+
},
|
|
85
|
+
welcomeSection: {
|
|
86
|
+
textAlign: 'center'
|
|
87
|
+
},
|
|
88
|
+
icon: {
|
|
89
|
+
height: '3rem',
|
|
90
|
+
width: '3rem',
|
|
91
|
+
color: '#2563eb',
|
|
92
|
+
margin: '0 auto 1rem auto'
|
|
93
|
+
},
|
|
94
|
+
welcomeTitle: {
|
|
95
|
+
fontSize: '1.25rem',
|
|
96
|
+
fontWeight: '600',
|
|
97
|
+
color: '#111827',
|
|
98
|
+
marginBottom: '0.5rem'
|
|
99
|
+
},
|
|
100
|
+
welcomeText: {
|
|
101
|
+
fontSize: '0.875rem',
|
|
102
|
+
color: '#6b7280'
|
|
103
|
+
},
|
|
104
|
+
button: {
|
|
105
|
+
width: '100%',
|
|
106
|
+
backgroundColor: '#2563eb',
|
|
107
|
+
color: 'white',
|
|
108
|
+
fontWeight: '500',
|
|
109
|
+
padding: '0.75rem 1rem',
|
|
110
|
+
borderRadius: '0.5rem',
|
|
111
|
+
border: 'none',
|
|
112
|
+
cursor: 'pointer',
|
|
113
|
+
display: 'flex',
|
|
114
|
+
alignItems: 'center',
|
|
115
|
+
justifyContent: 'center',
|
|
116
|
+
gap: '0.5rem',
|
|
117
|
+
transition: 'background-color 0.2s'
|
|
118
|
+
},
|
|
119
|
+
buttonHover: {
|
|
120
|
+
backgroundColor: '#1d4ed8'
|
|
121
|
+
},
|
|
122
|
+
footer: {
|
|
123
|
+
textAlign: 'center',
|
|
124
|
+
fontSize: '0.75rem',
|
|
125
|
+
color: '#6b7280'
|
|
126
|
+
}
|
|
127
|
+
};
|
|
128
|
+
|
|
45
129
|
return (
|
|
46
|
-
<div
|
|
47
|
-
<div
|
|
130
|
+
<div style={styles.container}>
|
|
131
|
+
<div style={styles.card} className={cardClassName}>
|
|
48
132
|
{/* Logo Section */}
|
|
49
|
-
<div
|
|
133
|
+
<div style={styles.logoSection}>
|
|
50
134
|
<img
|
|
51
135
|
src={logoUrl}
|
|
52
136
|
alt={`${companyName} Logo`}
|
|
53
|
-
|
|
137
|
+
style={styles.logo}
|
|
54
138
|
/>
|
|
55
|
-
<h1
|
|
139
|
+
<h1 style={styles.title}>
|
|
56
140
|
{appName}
|
|
57
141
|
</h1>
|
|
58
|
-
<p
|
|
142
|
+
<p style={styles.description}>
|
|
59
143
|
{appDescription}
|
|
60
144
|
</p>
|
|
61
145
|
</div>
|
|
62
146
|
|
|
63
147
|
{/* Sign In Section */}
|
|
64
|
-
<div
|
|
65
|
-
<div
|
|
66
|
-
<svg
|
|
148
|
+
<div style={styles.content}>
|
|
149
|
+
<div style={styles.welcomeSection}>
|
|
150
|
+
<svg style={styles.icon} fill="none" stroke="currentColor" viewBox="0 0 24 24">
|
|
67
151
|
<path strokeLinecap="round" strokeLinejoin="round" strokeWidth={2} d="M19 21V5a2 2 0 00-2-2H7a2 2 0 00-2 2v16m14 0h2m-2 0h-5m-9 0H3m2 0h5M9 7h1m-1 4h1m4-4h1m-1 4h1m-5 10v-5a1 1 0 011-1h2a1 1 0 011 1v5m-4 0h4" />
|
|
68
152
|
</svg>
|
|
69
|
-
<h2
|
|
153
|
+
<h2 style={styles.welcomeTitle}>
|
|
70
154
|
Welcome Back
|
|
71
155
|
</h2>
|
|
72
|
-
<p
|
|
156
|
+
<p style={styles.welcomeText}>
|
|
73
157
|
Sign in with your Microsoft account to access the system
|
|
74
158
|
</p>
|
|
75
159
|
</div>
|
|
@@ -77,10 +161,16 @@ const LandingPage = ({
|
|
|
77
161
|
{/* Microsoft Sign In Button */}
|
|
78
162
|
<button
|
|
79
163
|
onClick={handleSignInClick}
|
|
80
|
-
|
|
164
|
+
style={styles.button}
|
|
165
|
+
onMouseEnter={(e) => {
|
|
166
|
+
e.target.style.backgroundColor = styles.buttonHover.backgroundColor;
|
|
167
|
+
}}
|
|
168
|
+
onMouseLeave={(e) => {
|
|
169
|
+
e.target.style.backgroundColor = styles.button.backgroundColor;
|
|
170
|
+
}}
|
|
81
171
|
>
|
|
82
172
|
{/* Official Microsoft logo SVG */}
|
|
83
|
-
<svg
|
|
173
|
+
<svg style={{width: '1.25rem', height: '1.25rem'}} viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
84
174
|
<rect x="2" y="2" width="9" height="9" fill="#F35325"/>
|
|
85
175
|
<rect x="13" y="2" width="9" height="9" fill="#81BC06"/>
|
|
86
176
|
<rect x="2" y="13" width="9" height="9" fill="#05A6F0"/>
|
|
@@ -90,7 +180,7 @@ const LandingPage = ({
|
|
|
90
180
|
</button>
|
|
91
181
|
|
|
92
182
|
{/* Additional Info */}
|
|
93
|
-
<div
|
|
183
|
+
<div style={styles.footer}>
|
|
94
184
|
<p>This application is for {companyName} employees only</p>
|
|
95
185
|
</div>
|
|
96
186
|
</div>
|