@bailaya/react 1.0.16 → 1.0.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.
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { StudioType, StudioProfile } from "@bailaya/core";
|
|
3
|
+
import "./styles.css";
|
|
3
4
|
export interface StudioTypesGridProps {
|
|
4
|
-
/** Optional studio ID to override the default configured ID */
|
|
5
5
|
overrideId?: string;
|
|
6
|
-
/** Locale code (e.g., "en", "es") for localized descriptions (if shown) */
|
|
7
6
|
locale?: string;
|
|
8
7
|
/** Root grid wrapper */
|
|
9
8
|
className?: string;
|
|
@@ -28,7 +27,7 @@ export interface StudioTypesGridProps {
|
|
|
28
27
|
/** Hide the CTA entirely. Default: false */
|
|
29
28
|
hideButton?: boolean;
|
|
30
29
|
/**
|
|
31
|
-
* Optional link renderer
|
|
30
|
+
* Optional link renderer.
|
|
32
31
|
* If not provided, a plain <a> will be rendered.
|
|
33
32
|
*/
|
|
34
33
|
renderLink?: (opts: {
|
|
@@ -36,7 +35,7 @@ export interface StudioTypesGridProps {
|
|
|
36
35
|
className?: string;
|
|
37
36
|
children: React.ReactNode;
|
|
38
37
|
}) => React.ReactNode;
|
|
39
|
-
/** Optional custom render for each studio type; bypasses
|
|
38
|
+
/** Optional custom render for each studio type; bypasses default layout */
|
|
40
39
|
renderItem?: (type: StudioType, profile: StudioProfile) => React.ReactNode;
|
|
41
40
|
/** Show localized description text under the title. Default: false */
|
|
42
41
|
showDescription?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"StudioTypesGrid.d.ts","sourceRoot":"","sources":["../../src/components/StudioTypesGrid.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"StudioTypesGrid.d.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AE1B,8CAA8C;IAC9C,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,UAAU,EAAE,CAAC;IAEvD,wEAAwE;IACxE,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,KAAK,MAAM,CAAC;CAC9C;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA4E1D,CAAC"}
|
|
@@ -9,6 +9,7 @@ const react_1 = __importDefault(require("react"));
|
|
|
9
9
|
const lucide_react_1 = require("lucide-react");
|
|
10
10
|
const useStudioProfile_1 = require("../hooks/useStudioProfile");
|
|
11
11
|
const LoadingIcon_1 = require("./ui/LoadingIcon");
|
|
12
|
+
require("./styles.css");
|
|
12
13
|
/** Picks localized text with fallback to first available. */
|
|
13
14
|
function pickLocalizedText(map, locale) {
|
|
14
15
|
const obj = map !== null && map !== void 0 ? map : {};
|
|
@@ -30,7 +31,7 @@ function slugifyName(name) {
|
|
|
30
31
|
/**
|
|
31
32
|
* Grid of studio dance types (Salsa, Bachata, etc.) with optional CTA button.
|
|
32
33
|
*/
|
|
33
|
-
const StudioTypesGrid = ({ overrideId, locale, className = "
|
|
34
|
+
const StudioTypesGrid = ({ overrideId, locale, className = "by-classesGrid", itemClassName = "by-card", imageWrapperClassName = "by-imageWrap", imageClassName = "by-img", bodyClassName = "by-body", titleClassName = "by-title", descriptionClassName = "by-desc", buttonClassName = "by-btn", seeClassesText = "See Classes", hrefPrefix = "/classes/", hideButton = false, renderLink, renderItem, showDescription = false, transformTypes, hrefBuilder, }) => {
|
|
34
35
|
var _a;
|
|
35
36
|
const { data: profile, loading, error } = (0, useStudioProfile_1.useStudioProfile)(overrideId);
|
|
36
37
|
if (loading)
|
|
@@ -45,25 +46,22 @@ const StudioTypesGrid = ({ overrideId, locale, className = "my-3 md:my-6 grid gr
|
|
|
45
46
|
if (renderItem) {
|
|
46
47
|
return react_1.default.createElement(react_1.default.Fragment, { key: type.name }, renderItem(type, profile));
|
|
47
48
|
}
|
|
48
|
-
const href = hrefBuilder
|
|
49
|
-
? hrefBuilder(type)
|
|
50
|
-
: `${hrefPrefix}${slugifyName(type.name)}`;
|
|
49
|
+
const href = hrefBuilder ? hrefBuilder(type) : `${hrefPrefix}${slugifyName(type.name)}`;
|
|
51
50
|
return (react_1.default.createElement("div", { key: type.name, className: itemClassName },
|
|
52
51
|
type.image && (react_1.default.createElement("div", { className: imageWrapperClassName },
|
|
53
52
|
react_1.default.createElement("img", { src: type.image, alt: type.name, className: imageClassName }))),
|
|
54
53
|
react_1.default.createElement("div", { className: bodyClassName },
|
|
55
54
|
react_1.default.createElement("h3", { className: titleClassName }, type.name),
|
|
56
55
|
showDescription && type.description && (react_1.default.createElement("p", { className: descriptionClassName }, pickLocalizedText(type.description, locale))),
|
|
57
|
-
!hideButton &&
|
|
58
|
-
? renderLink({
|
|
56
|
+
!hideButton &&
|
|
57
|
+
(renderLink ? (renderLink({
|
|
59
58
|
href,
|
|
60
59
|
className: buttonClassName,
|
|
61
60
|
children: (react_1.default.createElement(react_1.default.Fragment, null,
|
|
62
61
|
seeClassesText,
|
|
63
62
|
" ",
|
|
64
63
|
react_1.default.createElement(lucide_react_1.ArrowRight, null))),
|
|
65
|
-
})
|
|
66
|
-
: (react_1.default.createElement("a", { href: href, className: buttonClassName },
|
|
64
|
+
})) : (react_1.default.createElement("a", { href: href, className: buttonClassName },
|
|
67
65
|
seeClassesText,
|
|
68
66
|
" ",
|
|
69
67
|
react_1.default.createElement(lucide_react_1.ArrowRight, null)))))));
|
package/package.json
CHANGED
|
@@ -1,14 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bailaya/react",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"description": "A React component library for the BailaYa public API",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/index.js",
|
|
9
|
+
"./styles.css": "./dist/styles.css"
|
|
10
|
+
},
|
|
7
11
|
"files": [
|
|
8
12
|
"dist"
|
|
9
13
|
],
|
|
10
14
|
"scripts": {
|
|
11
|
-
"build": "tsc --build",
|
|
15
|
+
"build": "tsc --build && npm run copy:css",
|
|
16
|
+
"copy:css": "copyfiles -u 1 \"src/**/*.css\" dist",
|
|
12
17
|
"test": "jest"
|
|
13
18
|
},
|
|
14
19
|
"peerDependencies": {
|