umwd-components 0.1.55 → 0.1.57

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.
@@ -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('next/link');
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("p", null, "HeroSection");
25
- //<HeroSection key={block.id} data={block} />;
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,
@@ -7,6 +7,7 @@
7
7
  'use strict';
8
8
 
9
9
  var _rollupPluginBabelHelpers = require('../../_virtual/_rollupPluginBabelHelpers.js');
10
+ var React = require('react');
10
11
 
11
12
  function getIcon(name) {
12
13
  switch (name) {
@@ -0,0 +1,43 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ var React = require('react');
10
+ var Link = require('next/link');
11
+ var StrapiImage = require('./StrapiImage.js');
12
+
13
+ function HeroSection(_ref) {
14
+ let {
15
+ data
16
+ } = _ref;
17
+ const {
18
+ heading,
19
+ subHeading,
20
+ image,
21
+ link
22
+ } = data;
23
+ return /*#__PURE__*/React.createElement("header", {
24
+ className: "relative h-[600px] overflow-hidden"
25
+ }, /*#__PURE__*/React.createElement(StrapiImage.StrapiImage, {
26
+ alt: "Background",
27
+ className: "absolute inset-0 object-cover w-full h-full",
28
+ height: 1080,
29
+ src: image.url,
30
+ width: 1920
31
+ }), /*#__PURE__*/React.createElement("div", {
32
+ className: "relative z-10 flex flex-col items-center justify-center h-full text-center text-white bg-black bg-opacity-20"
33
+ }, /*#__PURE__*/React.createElement("h1", {
34
+ className: "text-4xl font-bold md:text-5xl lg:text-6xl"
35
+ }, heading), /*#__PURE__*/React.createElement("p", {
36
+ className: "mt-4 text-lg md:text-xl lg:text-2xl"
37
+ }, subHeading), /*#__PURE__*/React.createElement(Link, {
38
+ 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",
39
+ href: link.url
40
+ }, link.text)));
41
+ }
42
+
43
+ exports.HeroSection = HeroSection;
@@ -0,0 +1,33 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ 'use strict';
8
+
9
+ var React = require('react');
10
+ var Image = require('next/image');
11
+ var utils = require('../../lib/utils.js');
12
+
13
+ function StrapiImage(_ref) {
14
+ let {
15
+ src,
16
+ alt,
17
+ height,
18
+ width,
19
+ className
20
+ } = _ref;
21
+ if (!src) return null;
22
+ const imageUrl = utils.getStrapiMedia(src);
23
+ const imageFallback = "https://placehold.co/".concat(width, "x").concat(height);
24
+ return /*#__PURE__*/React.createElement(Image, {
25
+ src: imageUrl !== null && imageUrl !== void 0 ? imageUrl : imageFallback,
26
+ alt: alt,
27
+ height: height,
28
+ width: width,
29
+ className: className
30
+ });
31
+ }
32
+
33
+ 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 'next/link';
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("p", null, "HeroSection");
21
- //<HeroSection key={block.id} data={block} />;
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,
@@ -5,6 +5,7 @@
5
5
  */
6
6
 
7
7
  import { extends as _extends } from '../../_virtual/_rollupPluginBabelHelpers.js';
8
+ import React from 'react';
8
9
 
9
10
  function getIcon(name) {
10
11
  switch (name) {
@@ -0,0 +1,41 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ import React from 'react';
8
+ import Link from 'next/link';
9
+ import { StrapiImage } from './StrapiImage.js';
10
+
11
+ function HeroSection(_ref) {
12
+ let {
13
+ data
14
+ } = _ref;
15
+ const {
16
+ heading,
17
+ subHeading,
18
+ image,
19
+ link
20
+ } = data;
21
+ return /*#__PURE__*/React.createElement("header", {
22
+ className: "relative h-[600px] overflow-hidden"
23
+ }, /*#__PURE__*/React.createElement(StrapiImage, {
24
+ alt: "Background",
25
+ className: "absolute inset-0 object-cover w-full h-full",
26
+ height: 1080,
27
+ src: image.url,
28
+ width: 1920
29
+ }), /*#__PURE__*/React.createElement("div", {
30
+ className: "relative z-10 flex flex-col items-center justify-center h-full text-center text-white bg-black bg-opacity-20"
31
+ }, /*#__PURE__*/React.createElement("h1", {
32
+ className: "text-4xl font-bold md:text-5xl lg:text-6xl"
33
+ }, heading), /*#__PURE__*/React.createElement("p", {
34
+ className: "mt-4 text-lg md:text-xl lg:text-2xl"
35
+ }, subHeading), /*#__PURE__*/React.createElement(Link, {
36
+ 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",
37
+ href: link.url
38
+ }, link.text)));
39
+ }
40
+
41
+ export { HeroSection };
@@ -0,0 +1,31 @@
1
+ /*
2
+ * UMWD-Components
3
+ * @copyright Jelle Paulus
4
+ * @license MIT
5
+ */
6
+
7
+ import React from 'react';
8
+ import Image from 'next/image';
9
+ import { getStrapiMedia } from '../../lib/utils.js';
10
+
11
+ function StrapiImage(_ref) {
12
+ let {
13
+ src,
14
+ alt,
15
+ height,
16
+ width,
17
+ className
18
+ } = _ref;
19
+ if (!src) return null;
20
+ const imageUrl = getStrapiMedia(src);
21
+ const imageFallback = "https://placehold.co/".concat(width, "x").concat(height);
22
+ return /*#__PURE__*/React.createElement(Image, {
23
+ src: imageUrl !== null && imageUrl !== void 0 ? imageUrl : imageFallback,
24
+ alt: alt,
25
+ height: height,
26
+ width: width,
27
+ className: className
28
+ });
29
+ }
30
+
31
+ 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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "umwd-components",
3
- "version": "0.1.55",
3
+ "version": "0.1.57",
4
4
  "description": "UMWD Component library",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -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 <p>HeroSection</p>; //<HeroSection key={block.id} data={block} />;
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":
@@ -1,3 +1,5 @@
1
+ import React from "react";
2
+
1
3
  function getIcon(name: string) {
2
4
  switch (name) {
3
5
  case "CLOCK_ICON":
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import Link from "next/link";
2
3
  import { Logo } from "@/components/custom/Logo";
3
4
 
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import Link from "next/link";
2
3
  import { Logo } from "@/components/custom/Logo";
3
4
  import { Button } from "@mui/material";
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import Link from "next/link";
2
3
  import { StrapiImage } from "./StrapiImage.tsx";
3
4
 
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import Link from "next/link";
2
3
 
3
4
  function MountainIcon(props: any) {
@@ -1,3 +1,4 @@
1
+ import React from "react";
1
2
  import Image from "next/image";
2
3
  import { getStrapiMedia } from "../../lib/utils.ts";
3
4