@thecb/components 11.2.3-beta.4 → 11.2.3
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/index.cjs.js +2 -37
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +2 -37
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/molecules/registration-banner/RegistrationBanner.js +0 -2
- package/src/components/molecules/registration-banner/RegistrationBanner.styled.js +3 -2
- package/src/components/molecules/registration-banner/index.d.ts +1 -1
- package/src/util/general.js +0 -36
package/package.json
CHANGED
|
@@ -29,12 +29,10 @@ const RegistrationBanner = ({
|
|
|
29
29
|
extraStyles={extraStyles}
|
|
30
30
|
themeValues={themeValues}
|
|
31
31
|
isMobile={isMobile}
|
|
32
|
-
role="banner"
|
|
33
32
|
aria-label="Registration Banner"
|
|
34
33
|
justify="center"
|
|
35
34
|
>
|
|
36
35
|
<Styled.ContentContainer
|
|
37
|
-
role="main"
|
|
38
36
|
align="center"
|
|
39
37
|
justify="space-between"
|
|
40
38
|
overflow="visible"
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import styled from "styled-components";
|
|
2
2
|
import { Box, Cluster, Stack } from "../../atoms/layouts";
|
|
3
3
|
import ButtonWithLink from "../../atoms/button-with-link/ButtonWithLink";
|
|
4
|
-
import {
|
|
4
|
+
import { adjustHexColor } from "../../../util/general";
|
|
5
5
|
|
|
6
6
|
export const BannerContainer = styled(Cluster)`
|
|
7
|
-
background: ${({ themeValues }) =>
|
|
7
|
+
background: ${({ themeValues }) =>
|
|
8
|
+
adjustHexColor(themeValues.background, 10, "lighten")};
|
|
8
9
|
padding: ${({ isMobile }) => (isMobile ? "1rem 2rem" : " 2rem 8.25rem")};
|
|
9
10
|
`;
|
|
10
11
|
|
package/src/util/general.js
CHANGED
|
@@ -213,39 +213,3 @@ export const adjustHexColor = (hex, percent, action) => {
|
|
|
213
213
|
.slice(1)
|
|
214
214
|
.padStart(6, "0")}`;
|
|
215
215
|
};
|
|
216
|
-
|
|
217
|
-
/**
|
|
218
|
-
* Converts a hex color code to an RGBA color string with the specified alpha value.
|
|
219
|
-
*
|
|
220
|
-
* @param {string} hex - The hex color code (e.g., "#3498db" or "3498db").
|
|
221
|
-
* @param {number} alpha - The alpha value (opacity) between 0 and 1.
|
|
222
|
-
* @returns {string} - The RGBA color string (e.g., "rgba(52, 152, 219, 0.5)").
|
|
223
|
-
* @throws {Error} - Throws an error if the hex code is not a valid 3 or 6-digit hex color.
|
|
224
|
-
*/
|
|
225
|
-
export const hexToRGBA = (hex, alpha) => {
|
|
226
|
-
// Remove hash at the start if present
|
|
227
|
-
hex = hex.replace(/^\s*#/, "");
|
|
228
|
-
|
|
229
|
-
// If hex is 3 characters, convert it to 6 characters.
|
|
230
|
-
if (hex.length === 3) {
|
|
231
|
-
hex = hex
|
|
232
|
-
.split("")
|
|
233
|
-
.map(char => char + char)
|
|
234
|
-
.join("");
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
// Validate hex length
|
|
238
|
-
if (hex.length !== 6) {
|
|
239
|
-
throw new Error(
|
|
240
|
-
"Invalid hex color provided. Expected a 3 or 6-digit hex color."
|
|
241
|
-
);
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// Parse the hex color components
|
|
245
|
-
const bigint = parseInt(hex, 16);
|
|
246
|
-
const r = (bigint >> 16) & 255;
|
|
247
|
-
const g = (bigint >> 8) & 255;
|
|
248
|
-
const b = bigint & 255;
|
|
249
|
-
|
|
250
|
-
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
|
|
251
|
-
};
|