From 50ccfd0462299080d9a922df8d27382054eaadec Mon Sep 17 00:00:00 2001 From: alissawix Date: Sun, 16 Jun 2024 21:25:17 +0300 Subject: [PATCH 1/4] add template board paths to config --- codux.config.json | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/codux.config.json b/codux.config.json index f0f4107..5db2262 100644 --- a/codux.config.json +++ b/codux.config.json @@ -10,7 +10,24 @@ "templatesPath": "src/_codux/component-templates" }, "newBoard": { - "templatesPath": "src/_codux/board-templates" + "templatesPath": "src/_codux/board-templates", + "templatesConfig": { + "5-documentation": { + "path": "src/_codux/boards/documentation" + }, + "1-component-with-data": { + "path": "src/_codux/boards/components" + }, + "4-component-empty": { + "path": "src/_codux/boards/components" + }, + "2-page-fake-data": { + "path": "src/_codux/boards/pages" + }, + "3-page-real-data": { + "path": "src/_codux/boards/pages" + } + } }, "safeRender": { "maxInstancesPerComponent": 1000 From e92d107834358d697e5fba3940a8855b2e932a4d Mon Sep 17 00:00:00 2001 From: alissawix Date: Wed, 19 Jun 2024 10:16:37 +0300 Subject: [PATCH 2/4] move thank you page --- src/_codux/board-wrappers/page-wrapper.tsx | 3 ++- .../boards/pages/thank-you-page/page-thank-you.board.tsx | 2 +- .../thank-you-page/thank-you-page.module.scss | 0 .../thank-you-page/thank-you-page.tsx | 9 ++------- src/router/routes.tsx | 2 +- 5 files changed, 6 insertions(+), 10 deletions(-) rename src/{components => pages}/thank-you-page/thank-you-page.module.scss (100%) rename src/{components => pages}/thank-you-page/thank-you-page.tsx (78%) diff --git a/src/_codux/board-wrappers/page-wrapper.tsx b/src/_codux/board-wrappers/page-wrapper.tsx index a31f8df..c7b92b5 100644 --- a/src/_codux/board-wrappers/page-wrapper.tsx +++ b/src/_codux/board-wrappers/page-wrapper.tsx @@ -10,8 +10,9 @@ import { CartOpenContextProvider } from '/src/components/cart/cart-open-context' type Props = { children: React.ReactNode; /** @important */ - settings?: FakeDataSettings; path?: string; + /** @important */ + settings?: FakeDataSettings; }; export function PageWrapper(props: Props) { diff --git a/src/_codux/boards/pages/thank-you-page/page-thank-you.board.tsx b/src/_codux/boards/pages/thank-you-page/page-thank-you.board.tsx index 1267bfa..aa4ff01 100644 --- a/src/_codux/boards/pages/thank-you-page/page-thank-you.board.tsx +++ b/src/_codux/boards/pages/thank-you-page/page-thank-you.board.tsx @@ -1,4 +1,4 @@ -import { ThankYouPage } from '../../../../components/thank-you-page/thank-you-page'; +import { ThankYouPage } from '../../../../pages/thank-you-page/thank-you-page'; import { ContentSlot, createBoard } from '@wixc3/react-board'; import { PageWrapper } from '/src/_codux/board-wrappers/page-wrapper'; diff --git a/src/components/thank-you-page/thank-you-page.module.scss b/src/pages/thank-you-page/thank-you-page.module.scss similarity index 100% rename from src/components/thank-you-page/thank-you-page.module.scss rename to src/pages/thank-you-page/thank-you-page.module.scss diff --git a/src/components/thank-you-page/thank-you-page.tsx b/src/pages/thank-you-page/thank-you-page.tsx similarity index 78% rename from src/components/thank-you-page/thank-you-page.tsx rename to src/pages/thank-you-page/thank-you-page.tsx index 9192169..dacbbb4 100644 --- a/src/components/thank-you-page/thank-you-page.tsx +++ b/src/pages/thank-you-page/thank-you-page.tsx @@ -1,19 +1,14 @@ -import classNames from 'classnames'; import styles from './thank-you-page.module.scss'; import CommonStyles_module from '../../styles/common-styles.module.scss'; import { Link, useSearchParams } from 'react-router-dom'; import { ROUTES } from '../../router/config'; -export interface ThankYouPageProps { - className?: string; -} - -export const ThankYouPage = ({ className }: ThankYouPageProps) => { +export const ThankYouPage = () => { const [search] = useSearchParams(); const orderId = search.get('orderId'); return ( -
+

Thank You!

diff --git a/src/router/routes.tsx b/src/router/routes.tsx index 7461b83..ac33e15 100644 --- a/src/router/routes.tsx +++ b/src/router/routes.tsx @@ -5,7 +5,7 @@ import { AboutPage } from '../pages/about-page/about-page'; import { ROUTES } from './config'; import { ProductDetailsPage } from '../pages/product-details-page/product-details-page'; import { ProductsPage } from '../pages/products-page/products-page'; -import { ThankYouPage } from '../components/thank-you-page/thank-you-page'; +import { ThankYouPage } from '../pages/thank-you-page/thank-you-page'; export const getRoutes: () => RouteObject[] = () => [ { From deb9fbcbadd65344f329b60396251151d1ce1ef2 Mon Sep 17 00:00:00 2001 From: alissawix Date: Wed, 19 Jun 2024 10:17:35 +0300 Subject: [PATCH 3/4] add page component template and remove props from pages --- codux.config.json | 7 ++++++- .../component-templates/page/new-component.module.scss | 4 ++++ src/_codux/component-templates/page/new-component.tsx | 6 ++++++ src/pages/about-page/about-page.tsx | 9 ++------- src/pages/home-page/home-page.tsx | 9 ++------- src/pages/product-details-page/product-details-page.tsx | 8 ++------ src/pages/products-page/products-page.tsx | 9 ++------- 7 files changed, 24 insertions(+), 28 deletions(-) create mode 100644 src/_codux/component-templates/page/new-component.module.scss create mode 100644 src/_codux/component-templates/page/new-component.tsx diff --git a/codux.config.json b/codux.config.json index 5db2262..32369e7 100644 --- a/codux.config.json +++ b/codux.config.json @@ -7,7 +7,12 @@ }, "newComponent": { "componentsPath": "src/components", - "templatesPath": "src/_codux/component-templates" + "templatesPath": "src/_codux/component-templates", + "templatesConfig": { + "page": { + "path": "src/pages" + } + } }, "newBoard": { "templatesPath": "src/_codux/board-templates", diff --git a/src/_codux/component-templates/page/new-component.module.scss b/src/_codux/component-templates/page/new-component.module.scss new file mode 100644 index 0000000..5e0f394 --- /dev/null +++ b/src/_codux/component-templates/page/new-component.module.scss @@ -0,0 +1,4 @@ +@import '@styles/theme.module.scss'; + +.root { +} diff --git a/src/_codux/component-templates/page/new-component.tsx b/src/_codux/component-templates/page/new-component.tsx new file mode 100644 index 0000000..379f10d --- /dev/null +++ b/src/_codux/component-templates/page/new-component.tsx @@ -0,0 +1,6 @@ +import styles from './new-component.module.scss'; +import commonStyles from '@styles/common-styles.module.scss'; + +export const NewComponent = () => { + return

NewComponent
; +}; diff --git a/src/pages/about-page/about-page.tsx b/src/pages/about-page/about-page.tsx index 3ab850b..1e09dac 100644 --- a/src/pages/about-page/about-page.tsx +++ b/src/pages/about-page/about-page.tsx @@ -1,13 +1,8 @@ -import classNames from 'classnames'; import styles from './about-page.module.scss'; -export interface AboutPageProps { - className?: string; -} - -export const AboutPage = ({ className }: AboutPageProps) => { +export const AboutPage = () => { return ( -
+

I'm a Title

diff --git a/src/pages/home-page/home-page.tsx b/src/pages/home-page/home-page.tsx index 274227d..d046f48 100644 --- a/src/pages/home-page/home-page.tsx +++ b/src/pages/home-page/home-page.tsx @@ -1,4 +1,3 @@ -import classNames from 'classnames'; import styles from './home-page.module.scss'; import { HeroImage } from './hero-image/hero-image'; import { ROUTES } from '../../router/config'; @@ -6,17 +5,13 @@ import { Link, useNavigate } from 'react-router-dom'; import { ProductCard } from '../../components/product-card/product-card'; import { usePromotedProducts } from '../../api/api-hooks'; -export interface HomePageProps { - className?: string; -} - -export const HomePage = ({ className }: HomePageProps) => { +export const HomePage = () => { const navigate = useNavigate(); const { data: products } = usePromotedProducts(); return ( -

+
= ({ className }) => { +export const ProductDetailsPage = () => { const { setIsOpen } = useContext(CartOpenContext); const { slug: productSlug } = useParams(); @@ -52,7 +48,7 @@ export const ProductDetailsPage: React.FC = ({ classNam } return ( -
+
{ +export const ProductsPage = () => { const { data: myProducts, isLoading } = useProducts(); if (!myProducts && isLoading) { @@ -19,7 +14,7 @@ export const ProductsPage = ({ className }: ProductsPageProps) => { } return ( -
+

All Products

{myProducts?.map( From fa8fbf6250ea2cee5e405dc4a4a451e766bf170a Mon Sep 17 00:00:00 2001 From: alissawix Date: Thu, 20 Jun 2024 15:50:53 +0300 Subject: [PATCH 4/4] configure default board template from page component template --- codux.config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/codux.config.json b/codux.config.json index 32369e7..0164537 100644 --- a/codux.config.json +++ b/codux.config.json @@ -10,7 +10,8 @@ "templatesPath": "src/_codux/component-templates", "templatesConfig": { "page": { - "path": "src/pages" + "path": "src/pages", + "boardTemplate": "2-page-fake-data" } } },