@windstream/react-shared-components 0.1.92 → 0.1.94
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 +635 -635
- package/dist/contentful/index.d.ts +1 -0
- package/dist/contentful/index.esm.js +2 -2
- package/dist/contentful/index.esm.js.map +1 -1
- package/dist/contentful/index.js +3 -3
- package/dist/contentful/index.js.map +1 -1
- package/dist/core.d.ts +5 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/utils/index.esm.js +1 -1
- package/dist/utils/index.js +1 -1
- package/package.json +191 -185
- package/src/components/accordion/Accordion.stories.tsx +230 -230
- package/src/components/accordion/index.test.tsx +270 -0
- package/src/components/accordion/index.tsx +70 -70
- package/src/components/accordion/types.ts +12 -12
- package/src/components/alert-card/AlertCard.stories.tsx +171 -171
- package/src/components/alert-card/index.test.tsx +152 -0
- package/src/components/alert-card/index.tsx +41 -41
- package/src/components/alert-card/types.ts +13 -13
- package/src/components/animation-wrapper/index.test.tsx +424 -0
- package/src/components/animation-wrapper/index.tsx +129 -129
- package/src/components/animation-wrapper/types.ts +11 -11
- package/src/components/brand-button/BrandButton.stories.tsx +223 -223
- package/src/components/brand-button/helpers.ts +35 -35
- package/src/components/brand-button/index.test.tsx +292 -0
- package/src/components/brand-button/index.tsx +120 -120
- package/src/components/brand-button/types.ts +38 -38
- package/src/components/button/Button.stories.tsx +108 -108
- package/src/components/button/index.test.tsx +91 -0
- package/src/components/button/index.tsx +27 -27
- package/src/components/button/types.ts +14 -14
- package/src/components/call-button/CallButton.stories.tsx +324 -324
- package/src/components/call-button/index.test.tsx +260 -0
- package/src/components/call-button/index.tsx +106 -106
- package/src/components/call-button/types.ts +16 -16
- package/src/components/checkbox/Checkbox.stories.tsx +247 -247
- package/src/components/checkbox/index.test.tsx +252 -0
- package/src/components/checkbox/index.tsx +197 -197
- package/src/components/checkbox/types.ts +27 -27
- package/src/components/checklist/Checklist.stories.tsx +150 -150
- package/src/components/checklist/index.test.tsx +231 -0
- package/src/components/checklist/index.tsx +96 -61
- package/src/components/checklist/types.ts +23 -17
- package/src/components/collapse/Collapse.stories.tsx +255 -255
- package/src/components/collapse/index.test.tsx +277 -0
- package/src/components/collapse/index.tsx +47 -46
- package/src/components/collapse/types.ts +6 -6
- package/src/components/divider/Divider.stories.tsx +205 -205
- package/src/components/divider/index.test.tsx +53 -0
- package/src/components/divider/index.tsx +22 -22
- package/src/components/divider/type.ts +3 -3
- package/src/components/image/Image.stories.tsx +113 -113
- package/src/components/image/index.test.tsx +174 -0
- package/src/components/image/index.tsx +25 -25
- package/src/components/image/types.ts +40 -40
- package/src/components/input/Input.stories.tsx +325 -325
- package/src/components/input/index.test.tsx +348 -0
- package/src/components/input/index.tsx +177 -177
- package/src/components/input/types.ts +37 -37
- package/src/components/link/Link.stories.tsx +163 -163
- package/src/components/link/index.test.tsx +199 -0
- package/src/components/link/index.tsx +116 -116
- package/src/components/link/types.ts +25 -25
- package/src/components/list/List.stories.tsx +272 -272
- package/src/components/list/index.test.tsx +166 -0
- package/src/components/list/index.tsx +88 -88
- package/src/components/list/list-item/index.tsx +38 -38
- package/src/components/list/list-item/types.ts +13 -13
- package/src/components/list/types.ts +29 -29
- package/src/components/material-icon/MaterialIcon.stories.tsx +322 -322
- package/src/components/material-icon/constants.ts +99 -99
- package/src/components/material-icon/index.test.tsx +130 -0
- package/src/components/material-icon/index.tsx +47 -47
- package/src/components/material-icon/types.ts +31 -31
- package/src/components/modal/Modal.stories.tsx +171 -171
- package/src/components/modal/index.test.tsx +310 -0
- package/src/components/modal/index.tsx +164 -164
- package/src/components/modal/types.ts +24 -24
- package/src/components/next-image/index.test.tsx +406 -0
- package/src/components/next-image/index.tsx +74 -74
- package/src/components/next-image/types.ts +1 -1
- package/src/components/pagination/index.test.tsx +521 -0
- package/src/components/pagination/index.tsx +91 -91
- package/src/components/pagination/types.ts +6 -6
- package/src/components/radio-button/RadioButton.stories.tsx +307 -307
- package/src/components/radio-button/index.test.tsx +151 -0
- package/src/components/radio-button/index.tsx +75 -75
- package/src/components/radio-button/types.ts +21 -21
- package/src/components/see-more/SeeMore.stories.tsx +181 -181
- package/src/components/see-more/index.test.tsx +96 -0
- package/src/components/see-more/index.tsx +44 -44
- package/src/components/see-more/types.ts +4 -4
- package/src/components/select/Select.stories.tsx +411 -411
- package/src/components/select/index.test.tsx +256 -0
- package/src/components/select/index.tsx +155 -155
- package/src/components/select/types.ts +36 -36
- package/src/components/select-plan-button/SelectPlanButton.stories.tsx +184 -184
- package/src/components/select-plan-button/index.test.tsx +173 -0
- package/src/components/select-plan-button/index.tsx +63 -63
- package/src/components/select-plan-button/types.ts +17 -17
- package/src/components/skeleton/Skeleton.stories.tsx +179 -179
- package/src/components/skeleton/index.test.tsx +74 -0
- package/src/components/skeleton/index.tsx +61 -61
- package/src/components/skeleton/types.ts +4 -4
- package/src/components/spinner/Spinner.stories.tsx +335 -335
- package/src/components/spinner/index.test.tsx +76 -0
- package/src/components/spinner/index.tsx +44 -44
- package/src/components/spinner/types.ts +5 -5
- package/src/components/text/Text.stories.tsx +321 -321
- package/src/components/text/index.test.tsx +65 -0
- package/src/components/text/index.tsx +25 -25
- package/src/components/text/types.ts +45 -45
- package/src/components/tooltip/Tooltip.stories.tsx +219 -219
- package/src/components/tooltip/index.test.tsx +50 -0
- package/src/components/tooltip/index.tsx +74 -74
- package/src/components/tooltip/types.ts +7 -7
- package/src/components/view-cart-button/ViewCartButton.stories.tsx +252 -252
- package/src/components/view-cart-button/index.test.tsx +57 -0
- package/src/components/view-cart-button/index.tsx +42 -42
- package/src/components/view-cart-button/types.ts +5 -5
- package/src/contentful/blocks/accordion/Accordion.stories.mocks.tsx +128 -128
- package/src/contentful/blocks/accordion/Accordion.stories.tsx +98 -98
- package/src/contentful/blocks/accordion/index.test.tsx +218 -0
- package/src/contentful/blocks/accordion/index.tsx +114 -112
- package/src/contentful/blocks/accordion/types.ts +34 -34
- package/src/contentful/blocks/address-input-banner/index.test.tsx +132 -0
- package/src/contentful/blocks/address-input-banner/index.tsx +52 -52
- package/src/contentful/blocks/address-input-banner/types.ts +14 -14
- package/src/contentful/blocks/anchored-bottom-banner/index.test.tsx +287 -0
- package/src/contentful/blocks/anchored-bottom-banner/index.tsx +181 -181
- package/src/contentful/blocks/anchored-bottom-banner/types.ts +13 -13
- package/src/contentful/blocks/blogs-grid/BlogGrid.stories.mocks.tsx +144 -144
- package/src/contentful/blocks/blogs-grid/BlogGrid.stories.tsx +157 -156
- package/src/contentful/blocks/blogs-grid/index.test.tsx +355 -0
- package/src/contentful/blocks/blogs-grid/index.tsx +134 -134
- package/src/contentful/blocks/blogs-grid/types.ts +26 -26
- package/src/contentful/blocks/blogs-grid-base/index.test.tsx +274 -0
- package/src/contentful/blocks/blogs-grid-base/index.tsx +119 -119
- package/src/contentful/blocks/blogs-grid-base/types.ts +36 -36
- package/src/contentful/blocks/breadcrumbs/BreadcrumbNavigation.stories.tsx +147 -147
- package/src/contentful/blocks/breadcrumbs/index.test.tsx +281 -0
- package/src/contentful/blocks/breadcrumbs/index.tsx +95 -95
- package/src/contentful/blocks/breadcrumbs/types.ts +8 -8
- package/src/contentful/blocks/button/Button.stories.tsx +40 -40
- package/src/contentful/blocks/button/index.test.tsx +339 -0
- package/src/contentful/blocks/button/index.tsx +131 -131
- package/src/contentful/blocks/button/types.ts +39 -39
- package/src/contentful/blocks/callout/Callout.stories.tsx +23 -23
- package/src/contentful/blocks/callout/index.test.tsx +539 -0
- package/src/contentful/blocks/callout/index.tsx +277 -277
- package/src/contentful/blocks/callout/types.ts +78 -78
- package/src/contentful/blocks/cards/Cards.stories.tsx +23 -23
- package/src/contentful/blocks/cards/blog-card/index.test.tsx +218 -0
- package/src/contentful/blocks/cards/blog-card/index.tsx +129 -129
- package/src/contentful/blocks/cards/blog-card/types.ts +34 -34
- package/src/contentful/blocks/cards/floating-image-card/index.test.tsx +201 -0
- package/src/contentful/blocks/cards/floating-image-card/index.tsx +119 -119
- package/src/contentful/blocks/cards/floating-image-card/types.ts +30 -30
- package/src/contentful/blocks/cards/full-image-card/index.test.tsx +216 -0
- package/src/contentful/blocks/cards/full-image-card/index.tsx +130 -130
- package/src/contentful/blocks/cards/full-image-card/types.ts +29 -29
- package/src/contentful/blocks/cards/index.test.tsx +39 -0
- package/src/contentful/blocks/cards/index.tsx +13 -13
- package/src/contentful/blocks/cards/product-card/index.test.tsx +263 -0
- package/src/contentful/blocks/cards/product-card/index.tsx +251 -251
- package/src/contentful/blocks/cards/product-card/types.ts +28 -28
- package/src/contentful/blocks/cards/simple-card/index.test.tsx +364 -0
- package/src/contentful/blocks/cards/simple-card/index.tsx +325 -325
- package/src/contentful/blocks/cards/simple-card/types.ts +71 -71
- package/src/contentful/blocks/cards/testimonial-card/index.test.tsx +180 -0
- package/src/contentful/blocks/cards/testimonial-card/index.tsx +90 -90
- package/src/contentful/blocks/cards/testimonial-card/types.tsx +12 -12
- package/src/contentful/blocks/cards/types.ts +1 -1
- package/src/contentful/blocks/carousel/Carousel.stories.tsx +23 -23
- package/src/contentful/blocks/carousel/helper.test.tsx +539 -0
- package/src/contentful/blocks/carousel/helper.tsx +494 -494
- package/src/contentful/blocks/carousel/index.test.tsx +308 -0
- package/src/contentful/blocks/carousel/index.tsx +87 -87
- package/src/contentful/blocks/carousel/types.test.ts +16 -0
- package/src/contentful/blocks/carousel/types.ts +145 -145
- package/src/contentful/blocks/cart-retention-banner/index.test.tsx +409 -0
- package/src/contentful/blocks/cart-retention-banner/index.tsx +109 -109
- package/src/contentful/blocks/cart-retention-banner/types.ts +11 -11
- package/src/contentful/blocks/comparison-table/index.test.tsx +114 -0
- package/src/contentful/blocks/comparison-table/index.tsx +29 -29
- package/src/contentful/blocks/comparison-table/types.ts +6 -6
- package/src/contentful/blocks/cookiebanner/index.test.tsx +277 -0
- package/src/contentful/blocks/cookiebanner/index.tsx +146 -146
- package/src/contentful/blocks/cookiebanner/type.ts +7 -7
- package/src/contentful/blocks/cta-callout/CtaCallout.stories.tsx +46 -46
- package/src/contentful/blocks/cta-callout/index.test.tsx +244 -0
- package/src/contentful/blocks/cta-callout/index.tsx +73 -73
- package/src/contentful/blocks/cta-callout/types.ts +26 -26
- package/src/contentful/blocks/dynamic-tabs/index.test.tsx +240 -0
- package/src/contentful/blocks/dynamic-tabs/index.tsx +204 -204
- package/src/contentful/blocks/dynamic-tabs/types.ts +21 -21
- package/src/contentful/blocks/email-input-block/index.test.tsx +213 -0
- package/src/contentful/blocks/email-input-block/index.tsx +121 -116
- package/src/contentful/blocks/email-input-block/types.ts +16 -16
- package/src/contentful/blocks/find-kinetic/FindKinetic.stories.tsx +23 -23
- package/src/contentful/blocks/find-kinetic/index.test.tsx +269 -0
- package/src/contentful/blocks/find-kinetic/index.tsx +138 -130
- package/src/contentful/blocks/find-kinetic/types.ts +20 -19
- package/src/contentful/blocks/floating-banner/FloatingBanner.stories.tsx +34 -34
- package/src/contentful/blocks/floating-banner/index.test.tsx +246 -0
- package/src/contentful/blocks/floating-banner/index.tsx +97 -97
- package/src/contentful/blocks/floating-banner/types.ts +22 -22
- package/src/contentful/blocks/footer/Footer.stories.tsx +317 -317
- package/src/contentful/blocks/footer/index.test.tsx +302 -0
- package/src/contentful/blocks/footer/index.tsx +91 -91
- package/src/contentful/blocks/footer/types.ts +13 -13
- package/src/contentful/blocks/image-promo-bar/ImagePromoBar.stories.tsx +23 -23
- package/src/contentful/blocks/image-promo-bar/helper.test.tsx +61 -0
- package/src/contentful/blocks/image-promo-bar/helper.tsx +28 -28
- package/src/contentful/blocks/image-promo-bar/index.test.tsx +467 -0
- package/src/contentful/blocks/image-promo-bar/index.tsx +246 -246
- package/src/contentful/blocks/image-promo-bar/types.ts +44 -44
- package/src/contentful/blocks/image-promo-bar/vimeo-embed.test.tsx +142 -0
- package/src/contentful/blocks/image-promo-bar/vimeo-embed.tsx +93 -93
- package/src/contentful/blocks/image-promo-bar/youtube-embed.test.tsx +104 -0
- package/src/contentful/blocks/image-promo-bar/youtube-embed.tsx +46 -46
- package/src/contentful/blocks/modal/constants.ts +53 -53
- package/src/contentful/blocks/modal/index.test.tsx +209 -0
- package/src/contentful/blocks/modal/index.tsx +108 -108
- package/src/contentful/blocks/modal/types.ts +12 -12
- package/src/contentful/blocks/navigation/Navigation.stories.mocks.tsx +78 -0
- package/src/contentful/blocks/navigation/Navigation.stories.tsx +138 -0
- package/src/contentful/blocks/navigation/desktop-link-groups.tsx/index.test.tsx +208 -0
- package/src/contentful/blocks/navigation/desktop-link-groups.tsx/index.tsx +141 -139
- package/src/contentful/blocks/navigation/index.test.tsx +924 -0
- package/src/contentful/blocks/navigation/index.tsx +569 -568
- package/src/contentful/blocks/navigation/mobile-link-groups.tsx/index.test.tsx +131 -0
- package/src/contentful/blocks/navigation/mobile-link-groups.tsx/index.tsx +82 -82
- package/src/contentful/blocks/navigation/types.ts +71 -71
- package/src/contentful/blocks/primary-hero/PrimaryHero.stories.tsx +23 -23
- package/src/contentful/blocks/primary-hero/index.test.tsx +286 -0
- package/src/contentful/blocks/primary-hero/index.tsx +239 -236
- package/src/contentful/blocks/primary-hero/types.ts +37 -37
- package/src/contentful/blocks/search-block/index.test.tsx +268 -0
- package/src/contentful/blocks/search-block/index.tsx +90 -90
- package/src/contentful/blocks/search-block/types.ts +15 -15
- package/src/contentful/blocks/shape-background-wrapper/ShapeBackgroundWrapper.stories.tsx +26 -26
- package/src/contentful/blocks/shape-background-wrapper/index.test.tsx +284 -0
- package/src/contentful/blocks/shape-background-wrapper/index.tsx +124 -124
- package/src/contentful/blocks/shape-background-wrapper/types.ts +36 -36
- package/src/contentful/blocks/text/Text.stories.tsx +23 -23
- package/src/contentful/blocks/text/index.test.tsx +36 -0
- package/src/contentful/blocks/text/index.tsx +12 -12
- package/src/contentful/blocks/text/types.ts +1 -1
- package/src/contentful/index.test.ts +45 -0
- package/src/contentful/index.ts +105 -105
- package/src/global-mocks/contentful/to-document.ts +25 -0
- package/src/global-mocks/cookie.ts +48 -0
- package/src/global-mocks/cx.ts +37 -0
- package/src/global-mocks/index.ts +89 -0
- package/src/global-mocks/speed-card-bg.ts +27 -0
- package/src/global-mocks/utm.ts +49 -0
- package/src/hooks/contentful/use-contentful-rich-text.test.tsx +1758 -0
- package/src/hooks/contentful/use-contentful-rich-text.tsx +309 -309
- package/src/hooks/contentful/use-processed-check-list.test.tsx +277 -0
- package/src/hooks/contentful/use-processed-check-list.ts +63 -63
- package/src/hooks/use-body-scroll-lock.test.ts +134 -0
- package/src/hooks/use-body-scroll-lock.ts +34 -34
- package/src/hooks/use-carousel-swipe.test.ts +393 -0
- package/src/hooks/use-carousel-swipe.ts +264 -264
- package/src/hooks/use-outside-click.test.ts +142 -0
- package/src/hooks/use-outside-click.ts +17 -17
- package/src/index.ts +107 -107
- package/src/next/index.test.ts +7 -0
- package/src/next/index.ts +5 -5
- package/src/setupTests.ts +52 -46
- package/src/stories/DocsTemplate.tsx +24 -24
- package/src/styles/globals.css +343 -343
- package/src/types/global.d.ts +9 -9
- package/src/types/micro-components.ts +99 -99
- package/src/types/utm.ts +49 -49
- package/src/utils/contentful/to-document.test.ts +85 -0
- package/src/utils/contentful/to-document.ts +24 -24
- package/src/utils/cookie.test.ts +180 -0
- package/src/utils/cookie.ts +84 -84
- package/src/utils/cx.test.ts +90 -0
- package/src/utils/cx.ts +49 -49
- package/src/utils/index.test.ts +115 -0
- package/src/utils/index.ts +41 -41
- package/src/utils/speed-card-bg.test.ts +46 -0
- package/src/utils/speed-card-bg.ts +24 -24
- package/src/utils/utm.test.ts +359 -0
- package/src/utils/utm.ts +221 -221
|
@@ -0,0 +1,284 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ShapeBackgroundWrapper } from "./index";
|
|
3
|
+
|
|
4
|
+
import { render, screen } from "@testing-library/react";
|
|
5
|
+
|
|
6
|
+
describe("ShapeBackgroundWrapper", () => {
|
|
7
|
+
describe("Rendering with show=true (default)", () => {
|
|
8
|
+
it("renders children inside shape-bg-content wrapper", () => {
|
|
9
|
+
render(
|
|
10
|
+
<ShapeBackgroundWrapper background="white">
|
|
11
|
+
<p>Child content</p>
|
|
12
|
+
</ShapeBackgroundWrapper>
|
|
13
|
+
);
|
|
14
|
+
expect(screen.getByText("Child content")).toBeInTheDocument();
|
|
15
|
+
expect(
|
|
16
|
+
screen.getByText("Child content").closest(".shape-bg-content")
|
|
17
|
+
).toBeInTheDocument();
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
it("renders the outer container with shape-bg class", () => {
|
|
21
|
+
const { container } = render(
|
|
22
|
+
<ShapeBackgroundWrapper background="white">
|
|
23
|
+
<span>Test</span>
|
|
24
|
+
</ShapeBackgroundWrapper>
|
|
25
|
+
);
|
|
26
|
+
expect(container.querySelector(".shape-bg")).toBeInTheDocument();
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
it("renders content div with z-[1] for layering above SVG", () => {
|
|
30
|
+
const { container } = render(
|
|
31
|
+
<ShapeBackgroundWrapper background="white">
|
|
32
|
+
<span>Layered</span>
|
|
33
|
+
</ShapeBackgroundWrapper>
|
|
34
|
+
);
|
|
35
|
+
const content = container.querySelector(".shape-bg-content");
|
|
36
|
+
expect(content).toHaveClass("relative", "z-[1]");
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
describe("Rendering with show=false", () => {
|
|
41
|
+
it("renders children without shape-bg wrapper", () => {
|
|
42
|
+
const { container } = render(
|
|
43
|
+
<ShapeBackgroundWrapper show={false} background="navy">
|
|
44
|
+
<p>Hidden shape</p>
|
|
45
|
+
</ShapeBackgroundWrapper>
|
|
46
|
+
);
|
|
47
|
+
expect(screen.getByText("Hidden shape")).toBeInTheDocument();
|
|
48
|
+
expect(container.querySelector(".shape-bg")).not.toBeInTheDocument();
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
it("does not render any SVG when show is false", () => {
|
|
52
|
+
const { container } = render(
|
|
53
|
+
<ShapeBackgroundWrapper show={false} path="path1" background="white">
|
|
54
|
+
<span>No SVG</span>
|
|
55
|
+
</ShapeBackgroundWrapper>
|
|
56
|
+
);
|
|
57
|
+
expect(container.querySelector("svg")).not.toBeInTheDocument();
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it("applies className when show is false", () => {
|
|
61
|
+
const { container } = render(
|
|
62
|
+
<ShapeBackgroundWrapper show={false} className="custom-class">
|
|
63
|
+
<span>Styled</span>
|
|
64
|
+
</ShapeBackgroundWrapper>
|
|
65
|
+
);
|
|
66
|
+
expect(container.firstChild).toHaveClass("custom-class");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
it("applies custom background style when show is false and background is non-theme", () => {
|
|
70
|
+
const { container } = render(
|
|
71
|
+
<ShapeBackgroundWrapper
|
|
72
|
+
show={false}
|
|
73
|
+
background="linear-gradient(red, blue)"
|
|
74
|
+
>
|
|
75
|
+
<span>Gradient</span>
|
|
76
|
+
</ShapeBackgroundWrapper>
|
|
77
|
+
);
|
|
78
|
+
expect(container.firstChild).toHaveStyle({
|
|
79
|
+
background: "linear-gradient(red, blue)",
|
|
80
|
+
});
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
describe("SVG path rendering", () => {
|
|
85
|
+
it("renders path1 SVG when path='path1'", () => {
|
|
86
|
+
const { container } = render(
|
|
87
|
+
<ShapeBackgroundWrapper path="path1" background="white">
|
|
88
|
+
<span>Path1</span>
|
|
89
|
+
</ShapeBackgroundWrapper>
|
|
90
|
+
);
|
|
91
|
+
const svgs = container.querySelectorAll("svg");
|
|
92
|
+
expect(svgs).toHaveLength(1);
|
|
93
|
+
expect(svgs[0]).toHaveAttribute("width", "2262");
|
|
94
|
+
expect(svgs[0]).toHaveAttribute("height", "4359");
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
it("renders path2 SVG by default", () => {
|
|
98
|
+
const { container } = render(
|
|
99
|
+
<ShapeBackgroundWrapper background="white">
|
|
100
|
+
<span>Default path</span>
|
|
101
|
+
</ShapeBackgroundWrapper>
|
|
102
|
+
);
|
|
103
|
+
const svgs = container.querySelectorAll("svg");
|
|
104
|
+
expect(svgs).toHaveLength(1);
|
|
105
|
+
expect(svgs[0]).toHaveAttribute("width", "3739");
|
|
106
|
+
expect(svgs[0]).toHaveAttribute("height", "3666");
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it("renders path3 SVG when path='path3'", () => {
|
|
110
|
+
const { container } = render(
|
|
111
|
+
<ShapeBackgroundWrapper path="path3" background="white">
|
|
112
|
+
<span>Path3</span>
|
|
113
|
+
</ShapeBackgroundWrapper>
|
|
114
|
+
);
|
|
115
|
+
const svgs = container.querySelectorAll("svg");
|
|
116
|
+
expect(svgs).toHaveLength(1);
|
|
117
|
+
expect(svgs[0]).toHaveAttribute("width", "3044");
|
|
118
|
+
expect(svgs[0]).toHaveAttribute("height", "3248");
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
it("renders path4 SVG when path='path4'", () => {
|
|
122
|
+
const { container } = render(
|
|
123
|
+
<ShapeBackgroundWrapper path="path4" background="white">
|
|
124
|
+
<span>Path4</span>
|
|
125
|
+
</ShapeBackgroundWrapper>
|
|
126
|
+
);
|
|
127
|
+
const svgs = container.querySelectorAll("svg");
|
|
128
|
+
expect(svgs).toHaveLength(1);
|
|
129
|
+
expect(svgs[0]).toHaveAttribute("width", "3739");
|
|
130
|
+
expect(svgs[0]).toHaveAttribute("height", "3666");
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it("does not render SVG for unrecognized path value", () => {
|
|
134
|
+
const { container } = render(
|
|
135
|
+
<ShapeBackgroundWrapper path={"path5" as any} background="white">
|
|
136
|
+
<span>Unknown</span>
|
|
137
|
+
</ShapeBackgroundWrapper>
|
|
138
|
+
);
|
|
139
|
+
expect(container.querySelector("svg")).not.toBeInTheDocument();
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it("marks SVG with aria-hidden and focusable=false", () => {
|
|
143
|
+
const { container } = render(
|
|
144
|
+
<ShapeBackgroundWrapper path="path1" background="white">
|
|
145
|
+
<span>Accessible</span>
|
|
146
|
+
</ShapeBackgroundWrapper>
|
|
147
|
+
);
|
|
148
|
+
const svg = container.querySelector("svg")!;
|
|
149
|
+
expect(svg).toHaveAttribute("aria-hidden", "true");
|
|
150
|
+
expect(svg).toHaveAttribute("focusable", "false");
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
it("applies pointer-events-none to SVG", () => {
|
|
154
|
+
const { container } = render(
|
|
155
|
+
<ShapeBackgroundWrapper path="path2" background="white">
|
|
156
|
+
<span>Non-interactive</span>
|
|
157
|
+
</ShapeBackgroundWrapper>
|
|
158
|
+
);
|
|
159
|
+
const svg = container.querySelector("svg")!;
|
|
160
|
+
expect(svg).toHaveClass("pointer-events-none");
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
describe("Background themes", () => {
|
|
165
|
+
it.each([
|
|
166
|
+
["blue", "bg-[#07B2E2]"],
|
|
167
|
+
["green", "bg-[#26B170]"],
|
|
168
|
+
["yellow", "bg-[#F5FF1E]"],
|
|
169
|
+
["purple", "bg-[#931D69]"],
|
|
170
|
+
["white", "bg-white"],
|
|
171
|
+
["navy", "bg-[#00002D]"],
|
|
172
|
+
] as const)("applies %s background class", (bg, expectedClass) => {
|
|
173
|
+
const { container } = render(
|
|
174
|
+
<ShapeBackgroundWrapper background={bg}>
|
|
175
|
+
<span>BG Test</span>
|
|
176
|
+
</ShapeBackgroundWrapper>
|
|
177
|
+
);
|
|
178
|
+
const outer = container.querySelector(".shape-bg")!;
|
|
179
|
+
expect(outer.className).toContain(expectedClass);
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
it("applies inline style for custom (non-theme) background", () => {
|
|
183
|
+
const { container } = render(
|
|
184
|
+
<ShapeBackgroundWrapper background="#FF5733">
|
|
185
|
+
<span>Custom BG</span>
|
|
186
|
+
</ShapeBackgroundWrapper>
|
|
187
|
+
);
|
|
188
|
+
const outer = container.querySelector(".shape-bg") as HTMLElement;
|
|
189
|
+
expect(outer.style.background).toBe("rgb(255, 87, 51)");
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
it("falls back to bg-white when no background provided", () => {
|
|
193
|
+
const { container } = render(
|
|
194
|
+
<ShapeBackgroundWrapper>
|
|
195
|
+
<span>No BG</span>
|
|
196
|
+
</ShapeBackgroundWrapper>
|
|
197
|
+
);
|
|
198
|
+
const outer = container.querySelector(".shape-bg")!;
|
|
199
|
+
expect(outer.className).toContain("bg-white");
|
|
200
|
+
});
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
describe("Fill color (SVG)", () => {
|
|
204
|
+
it.each([
|
|
205
|
+
["blue", "text-[#07B2E2]"],
|
|
206
|
+
["green", "text-[#26B170]"],
|
|
207
|
+
["yellow", "text-[#F5FF1E]"],
|
|
208
|
+
["purple", "text-[#931D69]"],
|
|
209
|
+
["white", "text-white"],
|
|
210
|
+
["navy", "text-[#00002D]"],
|
|
211
|
+
] as const)("applies %s fill color to SVG", (fill, expectedClass) => {
|
|
212
|
+
const { container } = render(
|
|
213
|
+
<ShapeBackgroundWrapper fill={fill} background="white">
|
|
214
|
+
<span>Fill</span>
|
|
215
|
+
</ShapeBackgroundWrapper>
|
|
216
|
+
);
|
|
217
|
+
const svg = container.querySelector("svg")!;
|
|
218
|
+
expect(svg.className.baseVal).toContain(expectedClass);
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
it("defaults to yellow fill when fill not specified", () => {
|
|
222
|
+
const { container } = render(
|
|
223
|
+
<ShapeBackgroundWrapper background="white">
|
|
224
|
+
<span>Default fill</span>
|
|
225
|
+
</ShapeBackgroundWrapper>
|
|
226
|
+
);
|
|
227
|
+
const svg = container.querySelector("svg")!;
|
|
228
|
+
expect(svg.className.baseVal).toContain("text-[#F5FF1E]");
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
it("falls back to yellow for unrecognized fill value", () => {
|
|
232
|
+
const { container } = render(
|
|
233
|
+
<ShapeBackgroundWrapper fill="magenta" background="white">
|
|
234
|
+
<span>Unknown fill</span>
|
|
235
|
+
</ShapeBackgroundWrapper>
|
|
236
|
+
);
|
|
237
|
+
const svg = container.querySelector("svg")!;
|
|
238
|
+
expect(svg.className.baseVal).toContain("text-[#F5FF1E]");
|
|
239
|
+
});
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
describe("className prop", () => {
|
|
243
|
+
it("applies custom className to shape-bg wrapper", () => {
|
|
244
|
+
const { container } = render(
|
|
245
|
+
<ShapeBackgroundWrapper className="extra-class" background="white">
|
|
246
|
+
<span>Classy</span>
|
|
247
|
+
</ShapeBackgroundWrapper>
|
|
248
|
+
);
|
|
249
|
+
const outer = container.querySelector(".shape-bg")!;
|
|
250
|
+
expect(outer).toHaveClass("extra-class");
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
it("handles undefined className without errors", () => {
|
|
254
|
+
const { container } = render(
|
|
255
|
+
<ShapeBackgroundWrapper background="white">
|
|
256
|
+
<span>No class</span>
|
|
257
|
+
</ShapeBackgroundWrapper>
|
|
258
|
+
);
|
|
259
|
+
expect(container.querySelector(".shape-bg")).toBeInTheDocument();
|
|
260
|
+
});
|
|
261
|
+
});
|
|
262
|
+
|
|
263
|
+
describe("maxFit prop", () => {
|
|
264
|
+
it("applies max-content class when maxFit is true", () => {
|
|
265
|
+
const { container } = render(
|
|
266
|
+
<ShapeBackgroundWrapper maxFit={true} background="white">
|
|
267
|
+
<span>Max fit</span>
|
|
268
|
+
</ShapeBackgroundWrapper>
|
|
269
|
+
);
|
|
270
|
+
const outer = container.querySelector(".shape-bg")!;
|
|
271
|
+
expect(outer.className).toContain("max-content");
|
|
272
|
+
});
|
|
273
|
+
|
|
274
|
+
it("does not apply max-content when maxFit is false/undefined", () => {
|
|
275
|
+
const { container } = render(
|
|
276
|
+
<ShapeBackgroundWrapper background="white">
|
|
277
|
+
<span>No max fit</span>
|
|
278
|
+
</ShapeBackgroundWrapper>
|
|
279
|
+
);
|
|
280
|
+
const outer = container.querySelector(".shape-bg")!;
|
|
281
|
+
expect(outer.className).not.toContain("max-content");
|
|
282
|
+
});
|
|
283
|
+
});
|
|
284
|
+
});
|
|
@@ -1,124 +1,124 @@
|
|
|
1
|
-
// ShapeBackgroundWrapper.tsx
|
|
2
|
-
import React from "react";
|
|
3
|
-
import { ShapeBackgroundWrapperProps, ThemeKey } from "./types";
|
|
4
|
-
|
|
5
|
-
export const ShapeBackgroundWrapper: React.FC<ShapeBackgroundWrapperProps> = ({
|
|
6
|
-
children,
|
|
7
|
-
background,
|
|
8
|
-
className,
|
|
9
|
-
fill = "yellow",
|
|
10
|
-
maxFit,
|
|
11
|
-
show = true,
|
|
12
|
-
path = "path2",
|
|
13
|
-
}) => {
|
|
14
|
-
const variantClass = `${path}`;
|
|
15
|
-
|
|
16
|
-
const textColorClasses: Record<ThemeKey, string> = {
|
|
17
|
-
blue: "text-[#07B2E2]",
|
|
18
|
-
green: "text-[#26B170]",
|
|
19
|
-
yellow: "text-[#F5FF1E]",
|
|
20
|
-
purple: "text-[#931D69]",
|
|
21
|
-
white: "text-white",
|
|
22
|
-
navy: "text-[#00002D]",
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const bgColorClasses: Record<ThemeKey, string> = {
|
|
26
|
-
blue: "bg-[#07B2E2]",
|
|
27
|
-
green: "bg-[#26B170]",
|
|
28
|
-
yellow: "bg-[#F5FF1E]",
|
|
29
|
-
purple: "bg-[#931D69]",
|
|
30
|
-
white: "bg-white",
|
|
31
|
-
navy: "bg-[#00002D]",
|
|
32
|
-
};
|
|
33
|
-
|
|
34
|
-
const isThemeKey =
|
|
35
|
-
typeof background === "string" && background in bgColorClasses;
|
|
36
|
-
|
|
37
|
-
const bgClass = isThemeKey
|
|
38
|
-
? bgColorClasses[background as ThemeKey]
|
|
39
|
-
: undefined;
|
|
40
|
-
const bgStyle = background && !isThemeKey ? { background } : undefined;
|
|
41
|
-
|
|
42
|
-
const fillClass =
|
|
43
|
-
fill in textColorClasses
|
|
44
|
-
? textColorClasses[fill as ThemeKey]
|
|
45
|
-
: "text-[#F5FF1E]";
|
|
46
|
-
|
|
47
|
-
if (!show) {
|
|
48
|
-
return (
|
|
49
|
-
<div className={className} style={bgStyle}>
|
|
50
|
-
{children}
|
|
51
|
-
</div>
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return (
|
|
56
|
-
<div
|
|
57
|
-
className={`shape-bg relative overflow-hidden ${className ?? ""} ${maxFit ? "max-content" : ""} ${
|
|
58
|
-
bgClass ?? (!bgStyle ? "bg-white" : "")
|
|
59
|
-
}`}
|
|
60
|
-
style={bgStyle}
|
|
61
|
-
>
|
|
62
|
-
{path === "path1" && (
|
|
63
|
-
<svg
|
|
64
|
-
className={`shape-bg-svg pointer-events-none absolute left-1/2 top-[-2371px] z-0 translate-x-[-55%] ${variantClass} fill-current ${fillClass}`}
|
|
65
|
-
width="2262"
|
|
66
|
-
height="4359"
|
|
67
|
-
viewBox="0 0 2262 4359"
|
|
68
|
-
fill="none"
|
|
69
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
70
|
-
aria-hidden="true"
|
|
71
|
-
focusable="false"
|
|
72
|
-
>
|
|
73
|
-
<path d="M1838.72 444.021C2216.45 758.242 2351.22 1060.81 2202.83 1982.25C2062.95 2851.55 1923.57 4265.14 1394.48 4348.94C1079.75 4409.66 766.955 4172.68 508.523 4003.04C340.876 3884.89 192.855 3774.9 26.6866 3661.93C-27.6562 3624.7 8.69435 3542.15 74.1261 3555.69C415.628 3626.61 686.916 3615.36 942.942 3443.48C1410.95 3163.54 1632.32 2141.02 1629.56 1543.75C1637.51 910.76 1276.06 582.318 829.643 352.709C587.562 235.528 333.508 169.963 100.699 149.757C31.9431 143.965 25.0259 47.9703 92.459 33.1281C623.196 -84.6769 1404.59 131.886 1839.84 443.573" />
|
|
74
|
-
</svg>
|
|
75
|
-
)}
|
|
76
|
-
{path === "path2" && (
|
|
77
|
-
<svg
|
|
78
|
-
className={`shape-bg-svg pointer-events-none absolute left-1/2 top-[45.8px] z-0 translate-x-[-101%] ${variantClass} fill-current ${fillClass}`}
|
|
79
|
-
width="3739"
|
|
80
|
-
height="3666"
|
|
81
|
-
viewBox="0 0 3739 3666"
|
|
82
|
-
fill="none"
|
|
83
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
84
|
-
aria-hidden="true"
|
|
85
|
-
focusable="false"
|
|
86
|
-
>
|
|
87
|
-
<path d="M1662.93 3664.31C2153.52 3637.23 2442.1 3474.65 2872.31 2646.41C3278.25 1865.09 4009.1 647.09 3634.26 264.38C3417.79 27.9944 3025.37 31.7818 2716.76 13.9013C2511.72 8.81634 2327.31 8.87399 2126.55 0.511773C2060.73 -2.00127 2040.7 85.9475 2101.3 114.087C2417.76 260.743 2628.86 431.51 2731.94 722.142C2940.79 1225.9 2508.91 2178.82 2150.63 2656.7C1779.64 3169.63 1293.64 3217.84 798.345 3136.04C534.128 3085.8 291.072 2986.97 92.1133 2864.4C33.4593 2828.06 -29.3236 2901.01 15.967 2953.13C371.841 3364.12 1128.29 3656.09 1663.56 3665.34" />
|
|
88
|
-
</svg>
|
|
89
|
-
)}
|
|
90
|
-
{path === "path3" && (
|
|
91
|
-
<svg
|
|
92
|
-
className={`shape-bg-svg pointer-events-none absolute left-1/2 top-[-2600px] z-0 translate-x-[-55%] ${variantClass} fill-current ${fillClass}`}
|
|
93
|
-
width="3044"
|
|
94
|
-
height="3248"
|
|
95
|
-
viewBox="0 0 3044 3248"
|
|
96
|
-
fill="none"
|
|
97
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
98
|
-
aria-hidden="true"
|
|
99
|
-
focusable="false"
|
|
100
|
-
>
|
|
101
|
-
<path d="M1.21857 1353.6C-0.931975 1765.46 120.504 2015.15 791.765 2417.01C1424.98 2796.19 2407.16 3469.31 2746.34 3175.04C2955.08 3005.86 2971.76 2677.32 3002.33 2420C3016.95 2248.7 3026.23 2094.39 3043.38 1926.83C3048.81 1871.88 2976.24 1850.67 2949.63 1899.96C2810.91 2157.33 2657.35 2325.33 2408.95 2396.88C1976.88 2546.15 1201.39 2136.59 819.655 1812.63C409.231 1476.27 393.475 1067.19 486.97 656.895C542.372 438.358 637.352 239.983 749.974 79.7081C783.347 32.4684 725.487 -23.7534 679.587 11.5067C317.699 288.49 35.1358 906.671 0.328344 1354.07" />
|
|
102
|
-
</svg>
|
|
103
|
-
)}
|
|
104
|
-
{path === "path4" && (
|
|
105
|
-
<svg
|
|
106
|
-
className={`shape-bg-svg pointer-events-none absolute left-1/2 top-[-1966.1px] z-0 translate-x-[-48%] ${variantClass} fill-current ${fillClass}`}
|
|
107
|
-
width="3739"
|
|
108
|
-
height="3666"
|
|
109
|
-
viewBox="0 0 3739 3666"
|
|
110
|
-
fill="none"
|
|
111
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
112
|
-
aria-hidden="true"
|
|
113
|
-
focusable="false"
|
|
114
|
-
>
|
|
115
|
-
<path d="M1662.93 3664.31C2153.52 3637.23 2442.1 3474.65 2872.31 2646.41C3278.25 1865.1 4009.1 647.091 3634.26 264.381C3417.79 27.9951 3025.37 31.7826 2716.76 13.902C2511.72 8.81709 2327.31 8.87474 2126.55 0.512528C2060.73 -2.00052 2040.7 85.9483 2101.3 114.088C2417.76 260.743 2628.86 431.51 2731.94 722.143C2940.79 1225.9 2508.91 2178.82 2150.63 2656.7C1779.64 3169.63 1293.64 3217.84 798.345 3136.04C534.128 3085.8 291.072 2986.98 92.1133 2864.4C33.4593 2828.06 -29.3236 2901.01 15.967 2953.13C371.841 3364.12 1128.29 3656.09 1663.56 3665.34" />
|
|
116
|
-
</svg>
|
|
117
|
-
)}
|
|
118
|
-
|
|
119
|
-
<div className="shape-bg-content relative z-[1]">{children}</div>
|
|
120
|
-
</div>
|
|
121
|
-
);
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
export default ShapeBackgroundWrapper;
|
|
1
|
+
// ShapeBackgroundWrapper.tsx
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { ShapeBackgroundWrapperProps, ThemeKey } from "./types";
|
|
4
|
+
|
|
5
|
+
export const ShapeBackgroundWrapper: React.FC<ShapeBackgroundWrapperProps> = ({
|
|
6
|
+
children,
|
|
7
|
+
background,
|
|
8
|
+
className,
|
|
9
|
+
fill = "yellow",
|
|
10
|
+
maxFit,
|
|
11
|
+
show = true,
|
|
12
|
+
path = "path2",
|
|
13
|
+
}) => {
|
|
14
|
+
const variantClass = `${path}`;
|
|
15
|
+
|
|
16
|
+
const textColorClasses: Record<ThemeKey, string> = {
|
|
17
|
+
blue: "text-[#07B2E2]",
|
|
18
|
+
green: "text-[#26B170]",
|
|
19
|
+
yellow: "text-[#F5FF1E]",
|
|
20
|
+
purple: "text-[#931D69]",
|
|
21
|
+
white: "text-white",
|
|
22
|
+
navy: "text-[#00002D]",
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
const bgColorClasses: Record<ThemeKey, string> = {
|
|
26
|
+
blue: "bg-[#07B2E2]",
|
|
27
|
+
green: "bg-[#26B170]",
|
|
28
|
+
yellow: "bg-[#F5FF1E]",
|
|
29
|
+
purple: "bg-[#931D69]",
|
|
30
|
+
white: "bg-white",
|
|
31
|
+
navy: "bg-[#00002D]",
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const isThemeKey =
|
|
35
|
+
typeof background === "string" && background in bgColorClasses;
|
|
36
|
+
|
|
37
|
+
const bgClass = isThemeKey
|
|
38
|
+
? bgColorClasses[background as ThemeKey]
|
|
39
|
+
: undefined;
|
|
40
|
+
const bgStyle = background && !isThemeKey ? { background } : undefined;
|
|
41
|
+
|
|
42
|
+
const fillClass =
|
|
43
|
+
fill in textColorClasses
|
|
44
|
+
? textColorClasses[fill as ThemeKey]
|
|
45
|
+
: "text-[#F5FF1E]";
|
|
46
|
+
|
|
47
|
+
if (!show) {
|
|
48
|
+
return (
|
|
49
|
+
<div className={className} style={bgStyle}>
|
|
50
|
+
{children}
|
|
51
|
+
</div>
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return (
|
|
56
|
+
<div
|
|
57
|
+
className={`shape-bg relative overflow-hidden ${className ?? ""} ${maxFit ? "max-content" : ""} ${
|
|
58
|
+
bgClass ?? (!bgStyle ? "bg-white" : "")
|
|
59
|
+
}`}
|
|
60
|
+
style={bgStyle}
|
|
61
|
+
>
|
|
62
|
+
{path === "path1" && (
|
|
63
|
+
<svg
|
|
64
|
+
className={`shape-bg-svg pointer-events-none absolute left-1/2 top-[-2371px] z-0 translate-x-[-55%] ${variantClass} fill-current ${fillClass}`}
|
|
65
|
+
width="2262"
|
|
66
|
+
height="4359"
|
|
67
|
+
viewBox="0 0 2262 4359"
|
|
68
|
+
fill="none"
|
|
69
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
70
|
+
aria-hidden="true"
|
|
71
|
+
focusable="false"
|
|
72
|
+
>
|
|
73
|
+
<path d="M1838.72 444.021C2216.45 758.242 2351.22 1060.81 2202.83 1982.25C2062.95 2851.55 1923.57 4265.14 1394.48 4348.94C1079.75 4409.66 766.955 4172.68 508.523 4003.04C340.876 3884.89 192.855 3774.9 26.6866 3661.93C-27.6562 3624.7 8.69435 3542.15 74.1261 3555.69C415.628 3626.61 686.916 3615.36 942.942 3443.48C1410.95 3163.54 1632.32 2141.02 1629.56 1543.75C1637.51 910.76 1276.06 582.318 829.643 352.709C587.562 235.528 333.508 169.963 100.699 149.757C31.9431 143.965 25.0259 47.9703 92.459 33.1281C623.196 -84.6769 1404.59 131.886 1839.84 443.573" />
|
|
74
|
+
</svg>
|
|
75
|
+
)}
|
|
76
|
+
{path === "path2" && (
|
|
77
|
+
<svg
|
|
78
|
+
className={`shape-bg-svg pointer-events-none absolute left-1/2 top-[45.8px] z-0 translate-x-[-101%] ${variantClass} fill-current ${fillClass}`}
|
|
79
|
+
width="3739"
|
|
80
|
+
height="3666"
|
|
81
|
+
viewBox="0 0 3739 3666"
|
|
82
|
+
fill="none"
|
|
83
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
84
|
+
aria-hidden="true"
|
|
85
|
+
focusable="false"
|
|
86
|
+
>
|
|
87
|
+
<path d="M1662.93 3664.31C2153.52 3637.23 2442.1 3474.65 2872.31 2646.41C3278.25 1865.09 4009.1 647.09 3634.26 264.38C3417.79 27.9944 3025.37 31.7818 2716.76 13.9013C2511.72 8.81634 2327.31 8.87399 2126.55 0.511773C2060.73 -2.00127 2040.7 85.9475 2101.3 114.087C2417.76 260.743 2628.86 431.51 2731.94 722.142C2940.79 1225.9 2508.91 2178.82 2150.63 2656.7C1779.64 3169.63 1293.64 3217.84 798.345 3136.04C534.128 3085.8 291.072 2986.97 92.1133 2864.4C33.4593 2828.06 -29.3236 2901.01 15.967 2953.13C371.841 3364.12 1128.29 3656.09 1663.56 3665.34" />
|
|
88
|
+
</svg>
|
|
89
|
+
)}
|
|
90
|
+
{path === "path3" && (
|
|
91
|
+
<svg
|
|
92
|
+
className={`shape-bg-svg pointer-events-none absolute left-1/2 top-[-2600px] z-0 translate-x-[-55%] ${variantClass} fill-current ${fillClass}`}
|
|
93
|
+
width="3044"
|
|
94
|
+
height="3248"
|
|
95
|
+
viewBox="0 0 3044 3248"
|
|
96
|
+
fill="none"
|
|
97
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
98
|
+
aria-hidden="true"
|
|
99
|
+
focusable="false"
|
|
100
|
+
>
|
|
101
|
+
<path d="M1.21857 1353.6C-0.931975 1765.46 120.504 2015.15 791.765 2417.01C1424.98 2796.19 2407.16 3469.31 2746.34 3175.04C2955.08 3005.86 2971.76 2677.32 3002.33 2420C3016.95 2248.7 3026.23 2094.39 3043.38 1926.83C3048.81 1871.88 2976.24 1850.67 2949.63 1899.96C2810.91 2157.33 2657.35 2325.33 2408.95 2396.88C1976.88 2546.15 1201.39 2136.59 819.655 1812.63C409.231 1476.27 393.475 1067.19 486.97 656.895C542.372 438.358 637.352 239.983 749.974 79.7081C783.347 32.4684 725.487 -23.7534 679.587 11.5067C317.699 288.49 35.1358 906.671 0.328344 1354.07" />
|
|
102
|
+
</svg>
|
|
103
|
+
)}
|
|
104
|
+
{path === "path4" && (
|
|
105
|
+
<svg
|
|
106
|
+
className={`shape-bg-svg pointer-events-none absolute left-1/2 top-[-1966.1px] z-0 translate-x-[-48%] ${variantClass} fill-current ${fillClass}`}
|
|
107
|
+
width="3739"
|
|
108
|
+
height="3666"
|
|
109
|
+
viewBox="0 0 3739 3666"
|
|
110
|
+
fill="none"
|
|
111
|
+
xmlns="http://www.w3.org/2000/svg"
|
|
112
|
+
aria-hidden="true"
|
|
113
|
+
focusable="false"
|
|
114
|
+
>
|
|
115
|
+
<path d="M1662.93 3664.31C2153.52 3637.23 2442.1 3474.65 2872.31 2646.41C3278.25 1865.1 4009.1 647.091 3634.26 264.381C3417.79 27.9951 3025.37 31.7826 2716.76 13.902C2511.72 8.81709 2327.31 8.87474 2126.55 0.512528C2060.73 -2.00052 2040.7 85.9483 2101.3 114.088C2417.76 260.743 2628.86 431.51 2731.94 722.143C2940.79 1225.9 2508.91 2178.82 2150.63 2656.7C1779.64 3169.63 1293.64 3217.84 798.345 3136.04C534.128 3085.8 291.072 2986.98 92.1133 2864.4C33.4593 2828.06 -29.3236 2901.01 15.967 2953.13C371.841 3364.12 1128.29 3656.09 1663.56 3665.34" />
|
|
116
|
+
</svg>
|
|
117
|
+
)}
|
|
118
|
+
|
|
119
|
+
<div className="shape-bg-content relative z-[1]">{children}</div>
|
|
120
|
+
</div>
|
|
121
|
+
);
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
export default ShapeBackgroundWrapper;
|
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
|
|
3
|
-
export const svgPaths: Record<string, string> = {
|
|
4
|
-
path1:
|
|
5
|
-
"M6183.96 7035.43C6943.82 6952.66 7380.2 6676.58 7990.48 5362.95C8565.72 4123.69 9615.39 2181.9 9006.03 1622.93C8652.98 1276.95 8045.02 1315.49 7564.14 1313.75C7245.36 1323.32 6958.63 1339.47 6647.54 1342.72C6545.53 1343.83 6520.42 1482.38 6615.44 1520.24C7116.37 1719.55 7456.61 1965.53 7637.69 2405.03C7996.29 3164.74 7392.93 4672.05 6870.51 5439.14C6330.05 6261.86 5579.71 6377.14 4804.66 6292.58C4390.94 6237.27 4007.68 6104.9 3689.42 5932.73C3595.96 5881.89 3503.99 5999.87 3577.76 6076.26C4158.63 6680.16 5353 7066.59 6184.5 7035.07",
|
|
6
|
-
path2:
|
|
7
|
-
"M7084.87 3152.11C6998.44 2399.11 6718.09 1965.81 5389.62 1356.34C4136.36 781.869 2172.07 -265.216 1610.51 336.377C1262.56 684.784 1303.76 1287.15 1303.81 1763.48C1314.67 2079.29 1332.06 2363.37 1336.52 2671.54C1338.02 2772.59 1477.99 2797.98 1515.86 2704.01C1715.18 2208.55 1962.22 1872.45 2405.24 1694.74C3170.84 1342.39 4694.82 1945.74 5471.2 2466.11C6303.81 3004.57 6423.02 3748.26 6340.57 4515.68C6286.3 4925.29 6154.1 5304.42 5981.5 5619.04C5930.51 5711.42 6049.97 5802.96 6126.81 5730.18C6734.29 5157.06 7119.9 3975.43 7084.95 3151.67",
|
|
8
|
-
path3:
|
|
9
|
-
"M3161.08 2245.08C2401.23 2327.85 1964.85 2603.93 1354.57 3917.56C779.331 5156.82 -270.345 7098.61 339.023 7657.58C692.066 8003.56 1300.03 7965.02 1780.91 7966.76C2099.69 7957.19 2386.42 7941.04 2697.51 7937.79C2799.52 7936.68 2824.63 7798.13 2729.61 7760.27C2228.68 7560.96 1888.43 7314.98 1707.36 6875.48C1348.76 6115.77 1952.12 4608.46 2474.54 3841.37C3015 3018.65 3765.34 2903.37 4540.39 2987.93C4954.11 3043.24 5337.36 3175.61 5655.63 3347.77C5749.09 3398.62 5841.06 3280.64 5767.29 3204.25C5186.41 2600.35 3992.04 2213.93 3160.55 2245.44",
|
|
10
|
-
path4:
|
|
11
|
-
"M2260.18 6128.4C2346.6 6881.39 2626.96 7314.69 3955.43 7924.16C5208.69 8498.64 7172.98 9545.72 7734.98 8944.21C8082.94 8595.81 8041.74 7993.44 8041.68 7517.11C8030.82 7201.3 8013.43 6917.22 8008.98 6609.05C8007.48 6508 7867.51 6482.61 7829.64 6576.58C7630.32 7072.04 7383.27 7408.14 6940.26 7585.85C6174.65 7938.2 4650.68 7334.85 3874.29 6814.48C3041.68 6276.02 2922.48 5532.33 3004.93 4764.91C3059.2 4355.3 3191.4 3976.17 3364 3661.56C3414.98 3569.17 3295.53 3477.63 3218.68 3550.41C2611.21 4123.53 2225.6 5305.17 2260.54 6128.92",
|
|
12
|
-
|
|
13
|
-
path5:
|
|
14
|
-
"M1282.49 -1892.66C1660.21 -1578.44 1794.98 -1275.87 1646.6 -354.424C1506.72 514.868 1367.34 1928.46 838.242 2012.26C523.517 2072.99 210.72 1836 -47.7117 1666.37C-215.358 1548.21 -363.379 1438.22 -529.548 1325.25C-583.891 1288.03 -547.54 1205.47 -482.108 1219.01C-140.607 1289.93 130.682 1278.68 386.707 1106.8C854.714 826.863 1076.08 -195.662 1073.33 -792.933C1081.27 -1425.92 719.826 -1754.36 273.408 -1983.97C31.3272 -2101.15 -222.727 -2166.72 -455.536 -2186.92C-524.291 -2192.71 -531.208 -2288.71 -463.775 -2303.55C66.962 -2421.36 848.353 -2204.79 1283.6 -1893.11",
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
export type ThemeKey =
|
|
18
|
-
| "blue"
|
|
19
|
-
| "green"
|
|
20
|
-
| "yellow"
|
|
21
|
-
| "purple"
|
|
22
|
-
| "white"
|
|
23
|
-
| "navy";
|
|
24
|
-
|
|
25
|
-
// Infers the union of keys from the svgPaths constant
|
|
26
|
-
export type SvgPathKey = keyof typeof svgPaths;
|
|
27
|
-
|
|
28
|
-
export type ShapeBackgroundWrapperProps = {
|
|
29
|
-
path?: SvgPathKey;
|
|
30
|
-
fill?: ThemeKey | string;
|
|
31
|
-
className?: string;
|
|
32
|
-
children?: React.ReactNode;
|
|
33
|
-
maxFit?: boolean;
|
|
34
|
-
background?: ThemeKey | string;
|
|
35
|
-
show?: boolean;
|
|
36
|
-
};
|
|
1
|
+
import React from "react";
|
|
2
|
+
|
|
3
|
+
export const svgPaths: Record<string, string> = {
|
|
4
|
+
path1:
|
|
5
|
+
"M6183.96 7035.43C6943.82 6952.66 7380.2 6676.58 7990.48 5362.95C8565.72 4123.69 9615.39 2181.9 9006.03 1622.93C8652.98 1276.95 8045.02 1315.49 7564.14 1313.75C7245.36 1323.32 6958.63 1339.47 6647.54 1342.72C6545.53 1343.83 6520.42 1482.38 6615.44 1520.24C7116.37 1719.55 7456.61 1965.53 7637.69 2405.03C7996.29 3164.74 7392.93 4672.05 6870.51 5439.14C6330.05 6261.86 5579.71 6377.14 4804.66 6292.58C4390.94 6237.27 4007.68 6104.9 3689.42 5932.73C3595.96 5881.89 3503.99 5999.87 3577.76 6076.26C4158.63 6680.16 5353 7066.59 6184.5 7035.07",
|
|
6
|
+
path2:
|
|
7
|
+
"M7084.87 3152.11C6998.44 2399.11 6718.09 1965.81 5389.62 1356.34C4136.36 781.869 2172.07 -265.216 1610.51 336.377C1262.56 684.784 1303.76 1287.15 1303.81 1763.48C1314.67 2079.29 1332.06 2363.37 1336.52 2671.54C1338.02 2772.59 1477.99 2797.98 1515.86 2704.01C1715.18 2208.55 1962.22 1872.45 2405.24 1694.74C3170.84 1342.39 4694.82 1945.74 5471.2 2466.11C6303.81 3004.57 6423.02 3748.26 6340.57 4515.68C6286.3 4925.29 6154.1 5304.42 5981.5 5619.04C5930.51 5711.42 6049.97 5802.96 6126.81 5730.18C6734.29 5157.06 7119.9 3975.43 7084.95 3151.67",
|
|
8
|
+
path3:
|
|
9
|
+
"M3161.08 2245.08C2401.23 2327.85 1964.85 2603.93 1354.57 3917.56C779.331 5156.82 -270.345 7098.61 339.023 7657.58C692.066 8003.56 1300.03 7965.02 1780.91 7966.76C2099.69 7957.19 2386.42 7941.04 2697.51 7937.79C2799.52 7936.68 2824.63 7798.13 2729.61 7760.27C2228.68 7560.96 1888.43 7314.98 1707.36 6875.48C1348.76 6115.77 1952.12 4608.46 2474.54 3841.37C3015 3018.65 3765.34 2903.37 4540.39 2987.93C4954.11 3043.24 5337.36 3175.61 5655.63 3347.77C5749.09 3398.62 5841.06 3280.64 5767.29 3204.25C5186.41 2600.35 3992.04 2213.93 3160.55 2245.44",
|
|
10
|
+
path4:
|
|
11
|
+
"M2260.18 6128.4C2346.6 6881.39 2626.96 7314.69 3955.43 7924.16C5208.69 8498.64 7172.98 9545.72 7734.98 8944.21C8082.94 8595.81 8041.74 7993.44 8041.68 7517.11C8030.82 7201.3 8013.43 6917.22 8008.98 6609.05C8007.48 6508 7867.51 6482.61 7829.64 6576.58C7630.32 7072.04 7383.27 7408.14 6940.26 7585.85C6174.65 7938.2 4650.68 7334.85 3874.29 6814.48C3041.68 6276.02 2922.48 5532.33 3004.93 4764.91C3059.2 4355.3 3191.4 3976.17 3364 3661.56C3414.98 3569.17 3295.53 3477.63 3218.68 3550.41C2611.21 4123.53 2225.6 5305.17 2260.54 6128.92",
|
|
12
|
+
|
|
13
|
+
path5:
|
|
14
|
+
"M1282.49 -1892.66C1660.21 -1578.44 1794.98 -1275.87 1646.6 -354.424C1506.72 514.868 1367.34 1928.46 838.242 2012.26C523.517 2072.99 210.72 1836 -47.7117 1666.37C-215.358 1548.21 -363.379 1438.22 -529.548 1325.25C-583.891 1288.03 -547.54 1205.47 -482.108 1219.01C-140.607 1289.93 130.682 1278.68 386.707 1106.8C854.714 826.863 1076.08 -195.662 1073.33 -792.933C1081.27 -1425.92 719.826 -1754.36 273.408 -1983.97C31.3272 -2101.15 -222.727 -2166.72 -455.536 -2186.92C-524.291 -2192.71 -531.208 -2288.71 -463.775 -2303.55C66.962 -2421.36 848.353 -2204.79 1283.6 -1893.11",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export type ThemeKey =
|
|
18
|
+
| "blue"
|
|
19
|
+
| "green"
|
|
20
|
+
| "yellow"
|
|
21
|
+
| "purple"
|
|
22
|
+
| "white"
|
|
23
|
+
| "navy";
|
|
24
|
+
|
|
25
|
+
// Infers the union of keys from the svgPaths constant
|
|
26
|
+
export type SvgPathKey = keyof typeof svgPaths;
|
|
27
|
+
|
|
28
|
+
export type ShapeBackgroundWrapperProps = {
|
|
29
|
+
path?: SvgPathKey;
|
|
30
|
+
fill?: ThemeKey | string;
|
|
31
|
+
className?: string;
|
|
32
|
+
children?: React.ReactNode;
|
|
33
|
+
maxFit?: boolean;
|
|
34
|
+
background?: ThemeKey | string;
|
|
35
|
+
show?: boolean;
|
|
36
|
+
};
|
|
@@ -1,23 +1,23 @@
|
|
|
1
|
-
import { Text } from "./index";
|
|
2
|
-
|
|
3
|
-
import { DocsPage } from "@shared/stories/DocsTemplate";
|
|
4
|
-
import type { Meta, StoryObj } from "@storybook/react";
|
|
5
|
-
|
|
6
|
-
const meta: Meta<typeof Text> = {
|
|
7
|
-
title: "Contentful Blocks/Text",
|
|
8
|
-
component: Text,
|
|
9
|
-
tags: ["autodocs"],
|
|
10
|
-
parameters: {
|
|
11
|
-
layout: "centered",
|
|
12
|
-
docs: {
|
|
13
|
-
page: DocsPage,
|
|
14
|
-
description: {
|
|
15
|
-
component: "Contentful text block.",
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
args: { fields: {} },
|
|
20
|
-
};
|
|
21
|
-
export default meta;
|
|
22
|
-
type Story = StoryObj<typeof meta>;
|
|
23
|
-
export const Default: Story = {};
|
|
1
|
+
import { Text } from "./index";
|
|
2
|
+
|
|
3
|
+
import { DocsPage } from "@shared/stories/DocsTemplate";
|
|
4
|
+
import type { Meta, StoryObj } from "@storybook/react";
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Text> = {
|
|
7
|
+
title: "Contentful Blocks/Text",
|
|
8
|
+
component: Text,
|
|
9
|
+
tags: ["autodocs"],
|
|
10
|
+
parameters: {
|
|
11
|
+
layout: "centered",
|
|
12
|
+
docs: {
|
|
13
|
+
page: DocsPage,
|
|
14
|
+
description: {
|
|
15
|
+
component: "Contentful text block.",
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
args: { fields: {} },
|
|
20
|
+
};
|
|
21
|
+
export default meta;
|
|
22
|
+
type Story = StoryObj<typeof meta>;
|
|
23
|
+
export const Default: Story = {};
|