@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.
@@ -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
- backgroundColor: `rgba(${overlayColor === 'white' ? '255, 255, 255' :
66
- overlayColor === 'black' ? '0, 0, 0' :
67
- overlayColor // allow custom rgb values like "128, 128, 128"
68
- }, ${opacity / 100})`
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
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codesinger0/shared-components",
3
- "version": "1.1.17",
3
+ "version": "1.1.18",
4
4
  "description": "Shared React components for customer projects",
5
5
  "main": "dist/index.js",
6
6
  "files": [