diff --git a/next.config.js b/next.config.js index 732303bf..6dbf5eac 100644 --- a/next.config.js +++ b/next.config.js @@ -16,16 +16,11 @@ function scanSubdirectories(directory) { const subdirectories = [] fs.readdirSync(directory).forEach(file => { - // 这段代码会将landing排除在可选主题中 - - // const fullPath = path.join(directory, file) - // const stats = fs.statSync(fullPath) - // landing主题默认隐藏掉,一般网站不会用到 - // if (stats.isDirectory() && file !== 'landing') { - // subdirectories.push(file) - // } - - subdirectories.push(file) + const fullPath = path.join(directory, file) + const stats = fs.statSync(fullPath) + if (stats.isDirectory()) { + subdirectories.push(file) + } }) return subdirectories diff --git a/themes/landing-2/components/About.js b/themes/starter/components/About.js similarity index 93% rename from themes/landing-2/components/About.js rename to themes/starter/components/About.js index 6ac66a83..8279ec06 100644 --- a/themes/landing-2/components/About.js +++ b/themes/starter/components/About.js @@ -31,7 +31,7 @@ export const About = () => {

Know More @@ -107,11 +107,11 @@ export const About = () => { y2="178.431" gradientUnits="userSpaceOnUse" > - + @@ -143,11 +143,11 @@ export const About = () => { y2="133.937" gradientUnits="userSpaceOnUse" > - + @@ -179,11 +179,11 @@ export const About = () => { y2="256.79" gradientUnits="userSpaceOnUse" > - + diff --git a/themes/landing-2/components/BackToTopButton.js b/themes/starter/components/BackToTopButton.js similarity index 69% rename from themes/landing-2/components/BackToTopButton.js rename to themes/starter/components/BackToTopButton.js index bcb404de..1f201684 100644 --- a/themes/landing-2/components/BackToTopButton.js +++ b/themes/starter/components/BackToTopButton.js @@ -31,16 +31,18 @@ export const BackToTopButton = () => { t--; return (-c / 2) * (t * (t - 2) - 1) + b; }; - - document.querySelector('.back-to-top').onclick = () => { - scrollTo(document.documentElement); - }; + const backToTop = document.querySelector('.back-to-top') + if (backToTop) { + backToTop.onclick = () => { + scrollTo(document.documentElement); + }; + } window.addEventListener('scroll', navBarScollListener) return () => { window.removeEventListener('scroll', navBarScollListener) } - }) + }, []) // 滚动监听 const throttleMs = 200 @@ -49,20 +51,17 @@ export const BackToTopButton = () => { const scrollY = window.scrollY; // 显示或隐藏返回顶部按钮 const backToTop = document.querySelector('.back-to-top'); - backToTop.style.display = scrollY > 50 ? 'flex' : 'none'; + if (backToTop) { + backToTop.style.display = scrollY > 50 ? 'flex' : 'none'; + } }, throttleMs) ) return <> {/* */} - + + + {/* */} } diff --git a/themes/landing-2/components/Blog.js b/themes/starter/components/Blog.js similarity index 97% rename from themes/landing-2/components/Blog.js rename to themes/starter/components/Blog.js index bf68e5d2..37249f0e 100644 --- a/themes/landing-2/components/Blog.js +++ b/themes/starter/components/Blog.js @@ -41,7 +41,7 @@ export const Blog = () => {

Meet AutoManage, the best AI management tools @@ -75,7 +75,7 @@ export const Blog = () => {

How to earn more money as a wellness coach @@ -109,7 +109,7 @@ export const Blog = () => {

The no-fuss guide to upselling and cross selling diff --git a/themes/landing-2/components/Brand.js b/themes/starter/components/Brand.js similarity index 100% rename from themes/landing-2/components/Brand.js rename to themes/starter/components/Brand.js diff --git a/themes/landing-2/components/CTA.js b/themes/starter/components/CTA.js similarity index 98% rename from themes/landing-2/components/CTA.js rename to themes/starter/components/CTA.js index ae1a195a..702fafb9 100644 --- a/themes/landing-2/components/CTA.js +++ b/themes/starter/components/CTA.js @@ -25,7 +25,7 @@ export const CTA = () => { majority have suffered in some form.

Start using Play diff --git a/themes/landing-2/components/Contact.js b/themes/starter/components/Contact.js similarity index 100% rename from themes/landing-2/components/Contact.js rename to themes/starter/components/Contact.js diff --git a/themes/landing-2/components/DarkModeButton.js b/themes/starter/components/DarkModeButton.js similarity index 98% rename from themes/landing-2/components/DarkModeButton.js rename to themes/starter/components/DarkModeButton.js index 0a89e7a0..9d4ceef1 100644 --- a/themes/landing-2/components/DarkModeButton.js +++ b/themes/starter/components/DarkModeButton.js @@ -6,7 +6,7 @@ export const DarkModeButton = () => { const router = useRouter() return <> Learn More @@ -85,7 +85,7 @@ export const Features = () => { Lorem Ipsum is simply dummy text of the printing and industry.

Learn More @@ -152,7 +152,7 @@ export const Features = () => { Lorem Ipsum is simply dummy text of the printing and industry.

Learn More @@ -199,7 +199,7 @@ export const Features = () => { Lorem Ipsum is simply dummy text of the printing and industry.

Learn More diff --git a/themes/landing-2/components/Footer.js b/themes/starter/components/Footer.js similarity index 97% rename from themes/landing-2/components/Footer.js rename to themes/starter/components/Footer.js index ba20e84a..2b26ff7e 100644 --- a/themes/landing-2/components/Footer.js +++ b/themes/starter/components/Footer.js @@ -10,7 +10,7 @@ export const Footer = () => {
{

{ { { {
Purchase Now @@ -117,7 +117,7 @@ export const Pricing = () => {
Purchase Now @@ -164,7 +164,7 @@ export const Pricing = () => { Purchase Now diff --git a/themes/landing-2/components/SVG404.js b/themes/starter/components/SVG404.js similarity index 100% rename from themes/landing-2/components/SVG404.js rename to themes/starter/components/SVG404.js diff --git a/themes/landing-2/components/Team.js b/themes/starter/components/Team.js similarity index 87% rename from themes/landing-2/components/Team.js rename to themes/starter/components/Team.js index 35412537..616be1df 100644 --- a/themes/landing-2/components/Team.js +++ b/themes/starter/components/Team.js @@ -49,212 +49,212 @@ export const Team = () => { xmlns="http://www.w3.org/2000/svg" > @@ -272,7 +272,7 @@ export const Team = () => {

{ { { xmlns="http://www.w3.org/2000/svg" > @@ -476,7 +476,7 @@ export const Team = () => {

{ { { xmlns="http://www.w3.org/2000/svg" > @@ -680,7 +680,7 @@ export const Team = () => {

{ { { xmlns="http://www.w3.org/2000/svg" > @@ -884,7 +884,7 @@ export const Team = () => {

{ { { + console.log('加载swiper') + await loadExternalResource('https://cdnjs.cloudflare.com/ajax/libs/Swiper/11.0.5/swiper-bundle.css', 'css'); + await loadExternalResource('https://cdnjs.cloudflare.com/ajax/libs/Swiper/11.0.5/swiper-bundle.min.js', 'js'); + + const Swiper = window.Swiper + if (!Swiper) { + return + } + // Testimonial + const testimonialSwiper = new Swiper('.testimonial-carousel', { + slidesPerView: 1, + spaceBetween: 30, + + // Navigation arrows + navigation: { + nextEl: '.swiper-button-next', + prevEl: '.swiper-button-prev' + }, + + breakpoints: { + 640: { + slidesPerView: 2, + spaceBetween: 30 + }, + 1024: { + slidesPerView: 3, + spaceBetween: 30 + }, + 1280: { + slidesPerView: 3, + spaceBetween: 30 + } + } + }); + console.log('swiper', testimonialSwiper) +}; + export const Testimonials = () => { + useEffect(() => { + loadExternal() + }, []) return <> {/* */}
{ - await loadExternalResource('https://cdnjs.cloudflare.com/ajax/libs/Swiper/11.0.5/swiper-bundle.min.js', 'js'); - await loadExternalResource('https://cdnjs.cloudflare.com/ajax/libs/Swiper/11.0.5/swiper-bundle.css', 'css'); await loadExternalResource('https://cdnjs.cloudflare.com/ajax/libs/wow/1.1.2/wow.min.js', 'js'); // 配合animatecss 实现延时滚动动画,和AOS动画相似 const WOW = window.WOW; @@ -63,10 +61,8 @@ const LayoutBase = (props) => { loadExternal() }, []) - return <> - -
- + return
+ } diff --git a/themes/theme.js b/themes/theme.js index ddb30a77..e14a7a32 100644 --- a/themes/theme.js +++ b/themes/theme.js @@ -8,7 +8,6 @@ export const { THEMES = [] } = getConfig().publicRuntimeConfig /** * 加载全局布局 - * 如果是 * @param {*} themeQuery * @returns */ @@ -39,7 +38,7 @@ export const getLayoutByTheme = ({ router, theme }) => { setTimeout(() => { checkThemeDOM() }, 100); - return ThemeComponents[ThemeComponents.getLayoutNameByPath('-1')] + return ThemeComponents[ThemeComponents.getLayoutNameByPath(router.pathname)] } }