umwd-components 0.1.55 → 0.1.56
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/cjs/components/Page.js +5 -5
- package/dist/cjs/components/custom/HeroSection.js +42 -0
- package/dist/cjs/components/custom/StrapiImage.js +32 -0
- package/dist/cjs/lib/utils.js +28 -0
- package/dist/esm/components/Page.js +5 -5
- package/dist/esm/components/custom/HeroSection.js +40 -0
- package/dist/esm/components/custom/StrapiImage.js +30 -0
- package/dist/esm/lib/utils.js +25 -0
- package/package.json +1 -1
- package/src/components/Page.js +1 -2
|
@@ -13,16 +13,16 @@ var _rollupPluginBabelHelpers = require('../_virtual/_rollupPluginBabelHelpers.j
|
|
|
13
13
|
var React = require('react');
|
|
14
14
|
var PropTypes = require('prop-types');
|
|
15
15
|
var TextImageBlock = require('./TextImageBlock.js');
|
|
16
|
-
require('
|
|
17
|
-
require('next/image');
|
|
16
|
+
var HeroSection = require('./custom/HeroSection.js');
|
|
18
17
|
var FeaturesSection = require('./custom/FeaturesSection.js');
|
|
19
|
-
require('@mui/material');
|
|
20
18
|
|
|
21
19
|
function blockRenderer(block) {
|
|
22
20
|
switch (block.__component) {
|
|
23
21
|
case "layout.hero-section":
|
|
24
|
-
return /*#__PURE__*/React.createElement(
|
|
25
|
-
|
|
22
|
+
return /*#__PURE__*/React.createElement(HeroSection.HeroSection, {
|
|
23
|
+
key: block.id,
|
|
24
|
+
data: block
|
|
25
|
+
});
|
|
26
26
|
case "layout.feature-section":
|
|
27
27
|
return /*#__PURE__*/React.createElement(FeaturesSection.FeatureSection, {
|
|
28
28
|
key: block.id,
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
var Link = require('next/link');
|
|
10
|
+
var StrapiImage = require('./StrapiImage.js');
|
|
11
|
+
|
|
12
|
+
function HeroSection(_ref) {
|
|
13
|
+
let {
|
|
14
|
+
data
|
|
15
|
+
} = _ref;
|
|
16
|
+
const {
|
|
17
|
+
heading,
|
|
18
|
+
subHeading,
|
|
19
|
+
image,
|
|
20
|
+
link
|
|
21
|
+
} = data;
|
|
22
|
+
return /*#__PURE__*/React.createElement("header", {
|
|
23
|
+
className: "relative h-[600px] overflow-hidden"
|
|
24
|
+
}, /*#__PURE__*/React.createElement(StrapiImage.StrapiImage, {
|
|
25
|
+
alt: "Background",
|
|
26
|
+
className: "absolute inset-0 object-cover w-full h-full",
|
|
27
|
+
height: 1080,
|
|
28
|
+
src: image.url,
|
|
29
|
+
width: 1920
|
|
30
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
31
|
+
className: "relative z-10 flex flex-col items-center justify-center h-full text-center text-white bg-black bg-opacity-20"
|
|
32
|
+
}, /*#__PURE__*/React.createElement("h1", {
|
|
33
|
+
className: "text-4xl font-bold md:text-5xl lg:text-6xl"
|
|
34
|
+
}, heading), /*#__PURE__*/React.createElement("p", {
|
|
35
|
+
className: "mt-4 text-lg md:text-xl lg:text-2xl"
|
|
36
|
+
}, subHeading), /*#__PURE__*/React.createElement(Link, {
|
|
37
|
+
className: "mt-8 inline-flex items-center justify-center px-6 py-3 text-base font-medium text-black bg-white rounded-md shadow hover:bg-gray-100",
|
|
38
|
+
href: link.url
|
|
39
|
+
}, link.text)));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
exports.HeroSection = HeroSection;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
var Image = require('next/image');
|
|
10
|
+
var utils = require('../../lib/utils.js');
|
|
11
|
+
|
|
12
|
+
function StrapiImage(_ref) {
|
|
13
|
+
let {
|
|
14
|
+
src,
|
|
15
|
+
alt,
|
|
16
|
+
height,
|
|
17
|
+
width,
|
|
18
|
+
className
|
|
19
|
+
} = _ref;
|
|
20
|
+
if (!src) return null;
|
|
21
|
+
const imageUrl = utils.getStrapiMedia(src);
|
|
22
|
+
const imageFallback = "https://placehold.co/".concat(width, "x").concat(height);
|
|
23
|
+
return /*#__PURE__*/React.createElement(Image, {
|
|
24
|
+
src: imageUrl !== null && imageUrl !== void 0 ? imageUrl : imageFallback,
|
|
25
|
+
alt: alt,
|
|
26
|
+
height: height,
|
|
27
|
+
width: width,
|
|
28
|
+
className: className
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
exports.StrapiImage = StrapiImage;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
// import { type ClassValue, clsx } from "clsx";
|
|
10
|
+
// import { twMerge } from "tailwind-merge";
|
|
11
|
+
//
|
|
12
|
+
// export function cn(...inputs: ClassValue[]) {
|
|
13
|
+
// return twMerge(clsx(inputs));
|
|
14
|
+
// }
|
|
15
|
+
|
|
16
|
+
function getStrapiURL() {
|
|
17
|
+
var _process$env$NEXT_PUB;
|
|
18
|
+
return (_process$env$NEXT_PUB = process.env.NEXT_PUBLIC_STRAPI_URL) !== null && _process$env$NEXT_PUB !== void 0 ? _process$env$NEXT_PUB : "http://localhost:1337";
|
|
19
|
+
}
|
|
20
|
+
function getStrapiMedia(url) {
|
|
21
|
+
if (url == null) return null;
|
|
22
|
+
if (url.startsWith("data:")) return url;
|
|
23
|
+
if (url.startsWith("http") || url.startsWith("//")) return url;
|
|
24
|
+
return "".concat(getStrapiURL()).concat(url);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
exports.getStrapiMedia = getStrapiMedia;
|
|
28
|
+
exports.getStrapiURL = getStrapiURL;
|
|
@@ -9,16 +9,16 @@ import { extends as _extends } from '../_virtual/_rollupPluginBabelHelpers.js';
|
|
|
9
9
|
import React from 'react';
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import TextImageBlock from './TextImageBlock.js';
|
|
12
|
-
import '
|
|
13
|
-
import 'next/image';
|
|
12
|
+
import { HeroSection } from './custom/HeroSection.js';
|
|
14
13
|
import { FeatureSection } from './custom/FeaturesSection.js';
|
|
15
|
-
import '@mui/material';
|
|
16
14
|
|
|
17
15
|
function blockRenderer(block) {
|
|
18
16
|
switch (block.__component) {
|
|
19
17
|
case "layout.hero-section":
|
|
20
|
-
return /*#__PURE__*/React.createElement(
|
|
21
|
-
|
|
18
|
+
return /*#__PURE__*/React.createElement(HeroSection, {
|
|
19
|
+
key: block.id,
|
|
20
|
+
data: block
|
|
21
|
+
});
|
|
22
22
|
case "layout.feature-section":
|
|
23
23
|
return /*#__PURE__*/React.createElement(FeatureSection, {
|
|
24
24
|
key: block.id,
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import Link from 'next/link';
|
|
8
|
+
import { StrapiImage } from './StrapiImage.js';
|
|
9
|
+
|
|
10
|
+
function HeroSection(_ref) {
|
|
11
|
+
let {
|
|
12
|
+
data
|
|
13
|
+
} = _ref;
|
|
14
|
+
const {
|
|
15
|
+
heading,
|
|
16
|
+
subHeading,
|
|
17
|
+
image,
|
|
18
|
+
link
|
|
19
|
+
} = data;
|
|
20
|
+
return /*#__PURE__*/React.createElement("header", {
|
|
21
|
+
className: "relative h-[600px] overflow-hidden"
|
|
22
|
+
}, /*#__PURE__*/React.createElement(StrapiImage, {
|
|
23
|
+
alt: "Background",
|
|
24
|
+
className: "absolute inset-0 object-cover w-full h-full",
|
|
25
|
+
height: 1080,
|
|
26
|
+
src: image.url,
|
|
27
|
+
width: 1920
|
|
28
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
29
|
+
className: "relative z-10 flex flex-col items-center justify-center h-full text-center text-white bg-black bg-opacity-20"
|
|
30
|
+
}, /*#__PURE__*/React.createElement("h1", {
|
|
31
|
+
className: "text-4xl font-bold md:text-5xl lg:text-6xl"
|
|
32
|
+
}, heading), /*#__PURE__*/React.createElement("p", {
|
|
33
|
+
className: "mt-4 text-lg md:text-xl lg:text-2xl"
|
|
34
|
+
}, subHeading), /*#__PURE__*/React.createElement(Link, {
|
|
35
|
+
className: "mt-8 inline-flex items-center justify-center px-6 py-3 text-base font-medium text-black bg-white rounded-md shadow hover:bg-gray-100",
|
|
36
|
+
href: link.url
|
|
37
|
+
}, link.text)));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
export { HeroSection };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import Image from 'next/image';
|
|
8
|
+
import { getStrapiMedia } from '../../lib/utils.js';
|
|
9
|
+
|
|
10
|
+
function StrapiImage(_ref) {
|
|
11
|
+
let {
|
|
12
|
+
src,
|
|
13
|
+
alt,
|
|
14
|
+
height,
|
|
15
|
+
width,
|
|
16
|
+
className
|
|
17
|
+
} = _ref;
|
|
18
|
+
if (!src) return null;
|
|
19
|
+
const imageUrl = getStrapiMedia(src);
|
|
20
|
+
const imageFallback = "https://placehold.co/".concat(width, "x").concat(height);
|
|
21
|
+
return /*#__PURE__*/React.createElement(Image, {
|
|
22
|
+
src: imageUrl !== null && imageUrl !== void 0 ? imageUrl : imageFallback,
|
|
23
|
+
alt: alt,
|
|
24
|
+
height: height,
|
|
25
|
+
width: width,
|
|
26
|
+
className: className
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export { StrapiImage };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* UMWD-Components
|
|
3
|
+
* @copyright Jelle Paulus
|
|
4
|
+
* @license MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
// import { type ClassValue, clsx } from "clsx";
|
|
8
|
+
// import { twMerge } from "tailwind-merge";
|
|
9
|
+
//
|
|
10
|
+
// export function cn(...inputs: ClassValue[]) {
|
|
11
|
+
// return twMerge(clsx(inputs));
|
|
12
|
+
// }
|
|
13
|
+
|
|
14
|
+
function getStrapiURL() {
|
|
15
|
+
var _process$env$NEXT_PUB;
|
|
16
|
+
return (_process$env$NEXT_PUB = process.env.NEXT_PUBLIC_STRAPI_URL) !== null && _process$env$NEXT_PUB !== void 0 ? _process$env$NEXT_PUB : "http://localhost:1337";
|
|
17
|
+
}
|
|
18
|
+
function getStrapiMedia(url) {
|
|
19
|
+
if (url == null) return null;
|
|
20
|
+
if (url.startsWith("data:")) return url;
|
|
21
|
+
if (url.startsWith("http") || url.startsWith("//")) return url;
|
|
22
|
+
return "".concat(getStrapiURL()).concat(url);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export { getStrapiMedia, getStrapiURL };
|
package/package.json
CHANGED
package/src/components/Page.js
CHANGED
|
@@ -5,12 +5,11 @@ import PropTypes from "prop-types";
|
|
|
5
5
|
import TextImageBlock from "./TextImageBlock";
|
|
6
6
|
import { HeroSection } from "./custom/HeroSection.tsx";
|
|
7
7
|
import { FeatureSection } from "./custom/FeaturesSection.tsx";
|
|
8
|
-
import { Typography } from "@mui/material";
|
|
9
8
|
|
|
10
9
|
function blockRenderer(block) {
|
|
11
10
|
switch (block.__component) {
|
|
12
11
|
case "layout.hero-section":
|
|
13
|
-
return <
|
|
12
|
+
return <HeroSection key={block.id} data={block} />;
|
|
14
13
|
case "layout.feature-section":
|
|
15
14
|
return <FeatureSection key={block.id} data={block} />;
|
|
16
15
|
case "layout.text-image-section":
|