nvis-fe-cms-libs 2.1.1 → 2.1.3

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.
@@ -4808,6 +4808,133 @@ const PageChildrenSelectSection2 = ({ data, isDarkMode, t, section, imageBaseUrl
4808
4808
  ) })
4809
4809
  ] }) });
4810
4810
  };
4811
+ const HeroBannerSection = ({ data, t, isDarkMode, imageBaseUrl = "" }) => {
4812
+ var _a, _b;
4813
+ const [activeSlide, setActiveSlide] = useState(0);
4814
+ const extractBannerData = (data2) => {
4815
+ if (!(data2 == null ? void 0 : data2.sectionDataBindingItems) || data2.sectionDataBindingItems.length === 0) {
4816
+ return null;
4817
+ }
4818
+ const item = data2.sectionDataBindingItems[0];
4819
+ if (!item || !item.data) {
4820
+ return null;
4821
+ }
4822
+ const bannerData2 = item.data;
4823
+ if (!bannerData2.id && !bannerData2.name) {
4824
+ return null;
4825
+ }
4826
+ const extractedData = {
4827
+ id: bannerData2.id,
4828
+ name: bannerData2.name || "",
4829
+ description: bannerData2.description || "",
4830
+ images: Array.isArray(bannerData2.images) ? bannerData2.images : []
4831
+ };
4832
+ return extractedData;
4833
+ };
4834
+ const bannerData = extractBannerData(data);
4835
+ const getImageUrl = (imagePath) => {
4836
+ if (!imagePath) {
4837
+ return null;
4838
+ }
4839
+ if (imagePath.startsWith("http://") || imagePath.startsWith("https://")) {
4840
+ return imagePath;
4841
+ }
4842
+ return `${imageBaseUrl}${imagePath}`;
4843
+ };
4844
+ const slideImages = ((_a = bannerData == null ? void 0 : bannerData.images) == null ? void 0 : _a.map((img) => ({
4845
+ id: img.id || `img-${Math.random()}`,
4846
+ url: getImageUrl(img.url)
4847
+ }))) || [];
4848
+ useEffect(() => {
4849
+ if (slideImages.length <= 1) return;
4850
+ const interval = setInterval(() => {
4851
+ setActiveSlide((prev) => (prev + 1) % slideImages.length);
4852
+ }, 5e3);
4853
+ return () => clearInterval(interval);
4854
+ }, [slideImages.length]);
4855
+ const defaultImage = "https://images.unsplash.com/photo-1566073771259-6a8506099945?w=1920&h=1080&fit=crop&q=80";
4856
+ if (!bannerData) {
4857
+ return /* @__PURE__ */ jsxRuntimeExports.jsx("section", { className: "py-20 bg-body", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "max-w-7xl mx-auto px-4 text-center", children: [
4858
+ /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "text-lg font-semibold mb-2 text-main", children: (t == null ? void 0 : t("banner.noData.title")) || "Chưa có dữ liệu" }),
4859
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "text-muted", children: (t == null ? void 0 : t("banner.noData.description")) || "Hiện tại chưa có banner nào được thiết lập." })
4860
+ ] }) });
4861
+ }
4862
+ return /* @__PURE__ */ jsxRuntimeExports.jsxs(SectionWrapper, { isDarkMode, children: [
4863
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "absolute inset-0 overflow-hidden pointer-events-none", children: [
4864
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
4865
+ "div",
4866
+ {
4867
+ className: "absolute top-0 right-0 w-96 h-96 rounded-full opacity-20 blur-3xl",
4868
+ style: {
4869
+ background: isDarkMode ? "#1086CD" : "#1E3888"
4870
+ }
4871
+ }
4872
+ ),
4873
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
4874
+ "div",
4875
+ {
4876
+ className: "absolute bottom-0 left-0 w-96 h-96 rounded-full opacity-10 blur-3xl",
4877
+ style: {
4878
+ background: isDarkMode ? "#1E3888" : "#1086CD"
4879
+ }
4880
+ }
4881
+ )
4882
+ ] }),
4883
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "relative max-w-7xl mx-auto px-6 sm:px-8 lg:px-12", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "flex flex-col lg:flex-row items-center justify-between gap-8 lg:gap-12", children: [
4884
+ /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "w-full lg:w-1/2 lg:pr-8 lg:self-start lg:pt-8", children: [
4885
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
4886
+ "div",
4887
+ {
4888
+ className: "leading-tight mb-6",
4889
+ style: {
4890
+ color: isDarkMode ? "#F8FAFC" : "#1E3888"
4891
+ },
4892
+ dangerouslySetInnerHTML: { __html: bannerData.name }
4893
+ }
4894
+ ),
4895
+ bannerData.description && /* @__PURE__ */ jsxRuntimeExports.jsx(
4896
+ "div",
4897
+ {
4898
+ className: "text-lg sm:text-xl leading-relaxed mb-8",
4899
+ style: {
4900
+ color: isDarkMode ? "#CBD5E1" : "#475569"
4901
+ },
4902
+ dangerouslySetInnerHTML: { __html: bannerData.description }
4903
+ }
4904
+ )
4905
+ ] }),
4906
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "w-full lg:w-1/2 relative py-4 md:py-4 lg:py-5", children: /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "relative overflow-hidden shadow-2xl", style: { borderRadius: "48px 0 48px 0" }, children: [
4907
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
4908
+ "img",
4909
+ {
4910
+ src: ((_b = slideImages[activeSlide]) == null ? void 0 : _b.url) || defaultImage,
4911
+ alt: bannerData.name,
4912
+ className: "w-full h-auto object-cover transition-all duration-1000",
4913
+ style: {
4914
+ aspectRatio: "4/3",
4915
+ maxHeight: "500px"
4916
+ },
4917
+ onError: (e) => {
4918
+ e.target.src = defaultImage;
4919
+ }
4920
+ }
4921
+ ),
4922
+ slideImages.length > 1 && /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "absolute top-4 right-4 flex gap-2", children: slideImages.map((_, index2) => /* @__PURE__ */ jsxRuntimeExports.jsx(
4923
+ "button",
4924
+ {
4925
+ onClick: () => setActiveSlide(index2),
4926
+ className: "w-2 h-2 rounded-full transition-all duration-300",
4927
+ style: {
4928
+ background: activeSlide === index2 ? "white" : "rgba(255, 255, 255, 0.5)",
4929
+ width: activeSlide === index2 ? "24px" : "8px"
4930
+ }
4931
+ },
4932
+ index2
4933
+ )) })
4934
+ ] }) })
4935
+ ] }) })
4936
+ ] });
4937
+ };
4811
4938
  const index = {
4812
4939
  AboutCompanySection,
4813
4940
  CompanyValues,
@@ -4831,7 +4958,8 @@ const index = {
4831
4958
  PageHighlightSection,
4832
4959
  PageChildrenSelectSection,
4833
4960
  PageChildrenSelectSection1,
4834
- PageChildrenSelectSection2
4961
+ PageChildrenSelectSection2,
4962
+ HeroBannerSection
4835
4963
  };
4836
4964
  export {
4837
4965
  AboutCompanySection,
@@ -4843,6 +4971,7 @@ export {
4843
4971
  DiagramSection,
4844
4972
  DiagramSection2,
4845
4973
  FaqSection,
4974
+ HeroBannerSection,
4846
4975
  MilestoneSection,
4847
4976
  PageChildrenSelectSection,
4848
4977
  PageChildrenSelectSection1,