@bailaya/react 1.0.15 → 1.0.16
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.
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { StudioType, StudioProfile } from "@bailaya/core";
|
|
3
|
+
export interface StudioTypesGridProps {
|
|
4
|
+
/** Optional studio ID to override the default configured ID */
|
|
5
|
+
overrideId?: string;
|
|
6
|
+
/** Locale code (e.g., "en", "es") for localized descriptions (if shown) */
|
|
7
|
+
locale?: string;
|
|
8
|
+
/** Root grid wrapper */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Each card wrapper */
|
|
11
|
+
itemClassName?: string;
|
|
12
|
+
/** Wrapper around the image */
|
|
13
|
+
imageWrapperClassName?: string;
|
|
14
|
+
/** The `<img>` element itself */
|
|
15
|
+
imageClassName?: string;
|
|
16
|
+
/** Container for title (+ optional description) + CTA */
|
|
17
|
+
bodyClassName?: string;
|
|
18
|
+
/** Dance name heading */
|
|
19
|
+
titleClassName?: string;
|
|
20
|
+
/** Optional description paragraph (if you enable it) */
|
|
21
|
+
descriptionClassName?: string;
|
|
22
|
+
/** CTA button/link class */
|
|
23
|
+
buttonClassName?: string;
|
|
24
|
+
/** Text for the CTA (i18n-friendly). Default: "See Classes" */
|
|
25
|
+
seeClassesText?: string;
|
|
26
|
+
/** Prefix for the href. Default: "/classes/" */
|
|
27
|
+
hrefPrefix?: string;
|
|
28
|
+
/** Hide the CTA entirely. Default: false */
|
|
29
|
+
hideButton?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Optional link renderer to use custom component.
|
|
32
|
+
* If not provided, a plain <a> will be rendered.
|
|
33
|
+
*/
|
|
34
|
+
renderLink?: (opts: {
|
|
35
|
+
href: string;
|
|
36
|
+
className?: string;
|
|
37
|
+
children: React.ReactNode;
|
|
38
|
+
}) => React.ReactNode;
|
|
39
|
+
/** Optional custom render for each studio type; bypasses the default card layout entirely. */
|
|
40
|
+
renderItem?: (type: StudioType, profile: StudioProfile) => React.ReactNode;
|
|
41
|
+
/** Show localized description text under the title. Default: false */
|
|
42
|
+
showDescription?: boolean;
|
|
43
|
+
/** Optional filter/sort hook before render */
|
|
44
|
+
transformTypes?: (types: StudioType[]) => StudioType[];
|
|
45
|
+
/** Optional custom href builder; defaults to hrefPrefix + slug(name) */
|
|
46
|
+
hrefBuilder?: (type: StudioType) => string;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Grid of studio dance types (Salsa, Bachata, etc.) with optional CTA button.
|
|
50
|
+
*/
|
|
51
|
+
export declare const StudioTypesGrid: React.FC<StudioTypesGridProps>;
|
|
52
|
+
//# sourceMappingURL=StudioTypesGrid.d.ts.map
|
|
@@ -0,0 +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;AAyB/D,MAAM,WAAW,oBAAoB;IACjC,+DAA+D;IAC/D,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,2EAA2E;IAC3E,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,wBAAwB;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,wBAAwB;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,+BAA+B;IAC/B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B,iCAAiC;IACjC,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,yDAAyD;IACzD,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB,yBAAyB;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,wDAAwD;IACxD,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B,4BAA4B;IAC5B,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB,+DAA+D;IAC/D,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,4CAA4C;IAC5C,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;OAGG;IACH,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,SAAS,CAAC,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;KAAE,KAAK,KAAK,CAAC,SAAS,CAAC;IAExG,8FAA8F;IAC9F,UAAU,CAAC,EAAE,CAAC,IAAI,EAAE,UAAU,EAAE,OAAO,EAAE,aAAa,KAAK,KAAK,CAAC,SAAS,CAAC;IAE3E,sEAAsE;IACtE,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,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,CA+E1D,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.StudioTypesGrid = void 0;
|
|
8
|
+
const react_1 = __importDefault(require("react"));
|
|
9
|
+
const lucide_react_1 = require("lucide-react");
|
|
10
|
+
const useStudioProfile_1 = require("../hooks/useStudioProfile");
|
|
11
|
+
const LoadingIcon_1 = require("./ui/LoadingIcon");
|
|
12
|
+
/** Picks localized text with fallback to first available. */
|
|
13
|
+
function pickLocalizedText(map, locale) {
|
|
14
|
+
const obj = map !== null && map !== void 0 ? map : {};
|
|
15
|
+
if (locale && obj[locale])
|
|
16
|
+
return obj[locale];
|
|
17
|
+
const keys = Object.keys(obj);
|
|
18
|
+
return keys.length ? obj[keys[0]] : "";
|
|
19
|
+
}
|
|
20
|
+
/** Slugify dance names: lower, spaces→hyphens, strip accents & non-alphanum. */
|
|
21
|
+
function slugifyName(name) {
|
|
22
|
+
return name
|
|
23
|
+
.normalize("NFD")
|
|
24
|
+
.replace(/[\u0300-\u036f]/g, "") // strip accents
|
|
25
|
+
.toLowerCase()
|
|
26
|
+
.replace(/[^a-z0-9\s-]/g, "") // remove special chars
|
|
27
|
+
.trim()
|
|
28
|
+
.replace(/\s+/g, "-");
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Grid of studio dance types (Salsa, Bachata, etc.) with optional CTA button.
|
|
32
|
+
*/
|
|
33
|
+
const StudioTypesGrid = ({ overrideId, locale, className = "my-3 md:my-6 grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-8", itemClassName = "flex flex-col rounded-lg border border-[#DCDCDC] shadow-lg overflow-hidden", imageWrapperClassName = "w-full aspect-square p-2", imageClassName = "w-full h-full object-cover", bodyClassName = "p-3 flex flex-col flex-1", titleClassName = "text-3xl md:text-5xl font-geologica font-semibold text-[#2A2343] pb-4 text-start", descriptionClassName = "text-sm md:text-base text-[#464646] pb-3", buttonClassName = "mt-auto inline-flex items-center gap-2 px-6 py-3 rounded-md font-medium border border-transparent shadow-sm bg-[#2A2343] text-white hover:opacity-90 transition", seeClassesText = "See Classes", hrefPrefix = "/classes/", hideButton = false, renderLink, renderItem, showDescription = false, transformTypes, hrefBuilder, }) => {
|
|
34
|
+
var _a;
|
|
35
|
+
const { data: profile, loading, error } = (0, useStudioProfile_1.useStudioProfile)(overrideId);
|
|
36
|
+
if (loading)
|
|
37
|
+
return react_1.default.createElement("div", { className: className },
|
|
38
|
+
react_1.default.createElement(LoadingIcon_1.LoadingIcon, null));
|
|
39
|
+
if (error)
|
|
40
|
+
return react_1.default.createElement("div", { className: className }, error.message);
|
|
41
|
+
if (!profile || !((_a = profile.studioTypes) === null || _a === void 0 ? void 0 : _a.length))
|
|
42
|
+
return react_1.default.createElement("div", { className: className });
|
|
43
|
+
const types = transformTypes ? transformTypes(profile.studioTypes) : profile.studioTypes;
|
|
44
|
+
return (react_1.default.createElement("div", { className: className }, types.map((type) => {
|
|
45
|
+
if (renderItem) {
|
|
46
|
+
return react_1.default.createElement(react_1.default.Fragment, { key: type.name }, renderItem(type, profile));
|
|
47
|
+
}
|
|
48
|
+
const href = hrefBuilder
|
|
49
|
+
? hrefBuilder(type)
|
|
50
|
+
: `${hrefPrefix}${slugifyName(type.name)}`;
|
|
51
|
+
return (react_1.default.createElement("div", { key: type.name, className: itemClassName },
|
|
52
|
+
type.image && (react_1.default.createElement("div", { className: imageWrapperClassName },
|
|
53
|
+
react_1.default.createElement("img", { src: type.image, alt: type.name, className: imageClassName }))),
|
|
54
|
+
react_1.default.createElement("div", { className: bodyClassName },
|
|
55
|
+
react_1.default.createElement("h3", { className: titleClassName }, type.name),
|
|
56
|
+
showDescription && type.description && (react_1.default.createElement("p", { className: descriptionClassName }, pickLocalizedText(type.description, locale))),
|
|
57
|
+
!hideButton && (renderLink
|
|
58
|
+
? renderLink({
|
|
59
|
+
href,
|
|
60
|
+
className: buttonClassName,
|
|
61
|
+
children: (react_1.default.createElement(react_1.default.Fragment, null,
|
|
62
|
+
seeClassesText,
|
|
63
|
+
" ",
|
|
64
|
+
react_1.default.createElement(lucide_react_1.ArrowRight, null))),
|
|
65
|
+
})
|
|
66
|
+
: (react_1.default.createElement("a", { href: href, className: buttonClassName },
|
|
67
|
+
seeClassesText,
|
|
68
|
+
" ",
|
|
69
|
+
react_1.default.createElement(lucide_react_1.ArrowRight, null)))))));
|
|
70
|
+
})));
|
|
71
|
+
};
|
|
72
|
+
exports.StudioTypesGrid = StudioTypesGrid;
|
package/dist/index.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ export { ClassSchedule, ClassScheduleProps } from './components/ClassSchedule';
|
|
|
21
21
|
export { ClassScheduleByType, ClassScheduleByTypeProps } from './components/ClassScheduleByType';
|
|
22
22
|
export { InstructorList, InstructorListProps } from './components/InstructorList';
|
|
23
23
|
export { StudioProfileCard, StudioProfileCardProps } from './components/StudioProfileCard';
|
|
24
|
+
export { StudioTypesGrid, StudioTypesGridProps } from './components/StudioTypesGrid';
|
|
24
25
|
export { UserProfileCard, UserProfileCardProps } from './components/UserProfileCard';
|
|
25
26
|
export { StudioDescription } from './components/StudioDescription';
|
|
26
27
|
/**
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE9E;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE;;GAEG;AACH,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAE9E;;GAEG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D;;GAEG;AACH,OAAO,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAC/E,OAAO,EAAE,mBAAmB,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AACjG,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAC3F,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,eAAe,EAAE,oBAAoB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAEnE;;GAEG;AACH,cAAc,SAAS,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
19
19
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.StudioDescription = exports.UserProfileCard = exports.StudioProfileCard = exports.InstructorList = exports.ClassScheduleByType = exports.ClassSchedule = exports.useClassesByType = exports.useClasses = exports.useInstructors = exports.useStudioProfile = exports.useBailayaClient = exports.BailayaProvider = void 0;
|
|
22
|
+
exports.StudioDescription = exports.UserProfileCard = exports.StudioTypesGrid = exports.StudioProfileCard = exports.InstructorList = exports.ClassScheduleByType = exports.ClassSchedule = exports.useClassesByType = exports.useClasses = exports.useInstructors = exports.useStudioProfile = exports.useBailayaClient = exports.BailayaProvider = void 0;
|
|
23
23
|
/**
|
|
24
24
|
* Re-exported context and hooks for easy import
|
|
25
25
|
*/
|
|
@@ -48,6 +48,8 @@ var InstructorList_1 = require("./components/InstructorList");
|
|
|
48
48
|
Object.defineProperty(exports, "InstructorList", { enumerable: true, get: function () { return InstructorList_1.InstructorList; } });
|
|
49
49
|
var StudioProfileCard_1 = require("./components/StudioProfileCard");
|
|
50
50
|
Object.defineProperty(exports, "StudioProfileCard", { enumerable: true, get: function () { return StudioProfileCard_1.StudioProfileCard; } });
|
|
51
|
+
var StudioTypesGrid_1 = require("./components/StudioTypesGrid");
|
|
52
|
+
Object.defineProperty(exports, "StudioTypesGrid", { enumerable: true, get: function () { return StudioTypesGrid_1.StudioTypesGrid; } });
|
|
51
53
|
var UserProfileCard_1 = require("./components/UserProfileCard");
|
|
52
54
|
Object.defineProperty(exports, "UserProfileCard", { enumerable: true, get: function () { return UserProfileCard_1.UserProfileCard; } });
|
|
53
55
|
var StudioDescription_1 = require("./components/StudioDescription");
|