@codesinger0/shared-components 1.1.17 → 1.1.18
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/dist/components/Hero.jsx +12 -5
- package/package.json +1 -1
package/dist/components/Hero.jsx
CHANGED
|
@@ -40,6 +40,13 @@ const Hero = ({
|
|
|
40
40
|
introContent: introContentClass = 'subtitle'
|
|
41
41
|
} = classNames;
|
|
42
42
|
|
|
43
|
+
const hexToRgba = (hex, alpha) => {
|
|
44
|
+
const r = parseInt(hex.slice(1, 3), 16);
|
|
45
|
+
const g = parseInt(hex.slice(3, 5), 16);
|
|
46
|
+
const b = parseInt(hex.slice(5, 7), 16);
|
|
47
|
+
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
48
|
+
};
|
|
49
|
+
|
|
43
50
|
return (
|
|
44
51
|
<>
|
|
45
52
|
<section className="hero-section relative w-full overflow-hidden" style={{ height: mediaHeight }}>
|
|
@@ -62,12 +69,12 @@ const Hero = ({
|
|
|
62
69
|
<div
|
|
63
70
|
className="relative z-10 flex items-center justify-center h-full"
|
|
64
71
|
style={{
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
72
|
+
background: overlayColor === 'white' ? `rgba(255, 255, 255, ${opacity / 100})` :
|
|
73
|
+
overlayColor === 'black' ? `rgba(0, 0, 0, ${opacity / 100})` :
|
|
74
|
+
overlayColor.startsWith('#') ? hexToRgba(overlayColor, opacity / 100) :
|
|
75
|
+
overlayColor.startsWith('rgb') ? overlayColor :
|
|
76
|
+
`rgba(255, 255, 255, ${opacity / 100})` // fallback to white
|
|
69
77
|
}}
|
|
70
|
-
|
|
71
78
|
>
|
|
72
79
|
<div className="text-center px-0">
|
|
73
80
|
<motion.div
|