diff --git a/README.md b/README.md index 5d415f5..dbb9770 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ # Plain JS Framework, initially from cive, web-team 🚀 -

- since 21 Feb,2024 -

+

+ since 21 Feb,2024 +

- [ ] **Currently on Development.. 🔥** @@ -21,15 +21,14 @@ cive/ │ │ └── images/ │ │ │ ├── components/ -│ │ └── Home.js -│ │ └── About.js -│ │ └── Contact.js +│ │ └── home.html │ │ │ ├── css/ -│ │ └── custom.css -│ │ +│ │ └── style-main.css +│ │ +| | │ ├── js/ -│ │ └── custom.js +│ │ └── //... your custom JS │ │ │ ├── routes.js │ ├── App.js diff --git a/index.html b/index.html index 7479525..dace528 100644 --- a/index.html +++ b/index.html @@ -9,7 +9,7 @@ - + diff --git a/src/App.js b/src/App.js index e8e9572..4ba0c03 100644 --- a/src/App.js +++ b/src/App.js @@ -1,9 +1,4 @@ -// Define the routes and their corresponding HTML files -const routes = { - '/home': '/src/components/home.html', - '/about': '/src/components/about.html', - '/contact': '/src/components/contact.html' -}; +import { routes } from './routes.js'; // Function to navigate to a specific route function navigateTo(route) { @@ -12,10 +7,12 @@ function navigateTo(route) { // Fetch and render the HTML content of the corresponding file fetchHtml(routes[route]); } else { - // the custom 404 page - fetchHtml('/src/components/404.html'); + // Route Not Found Route + + // The custom 404 page + fetchHtml('/src/components/not-found/404.html'); - // Route not found, display a 404 error message + /* Uncomment to display custom message only ( No File ) */ //renderComponent('404: Page not found.'); } } @@ -25,13 +22,16 @@ function fetchHtml(path) { fetch(path) .then(response => { if (!response.ok) { + console.log(`(cive) File:: {path} not found!`); throw new Error('Failed to fetch HTML file'); + } return response.text(); }) .then(html => renderComponent(html)) .catch(error => { console.error(error); + console.log(`(cive) FailMessage:: Failed to load page!`) renderComponent('Failed to load page.'); }); } diff --git a/src/components/about.html b/src/components/about.html deleted file mode 100644 index 94d196f..0000000 --- a/src/components/about.html +++ /dev/null @@ -1,3 +0,0 @@ -

This is about

- -

here we go

diff --git a/src/components/contact.html b/src/components/contact.html deleted file mode 100644 index 689f220..0000000 --- a/src/components/contact.html +++ /dev/null @@ -1,3 +0,0 @@ -

hello this is contact

- -

Hello this is contact page

diff --git a/src/components/index.html b/src/components/index.html new file mode 100644 index 0000000..6f99951 --- /dev/null +++ b/src/components/index.html @@ -0,0 +1,3 @@ +

This is index page

+ +

here we go

diff --git a/src/components/404.html b/src/components/not-found/404.html similarity index 100% rename from src/components/404.html rename to src/components/not-found/404.html diff --git a/src/css/style-main.css b/src/css/style-main.css index e69de29..11fd0cb 100644 --- a/src/css/style-main.css +++ b/src/css/style-main.css @@ -0,0 +1,5 @@ +/* This makes your site little responsive */ + +* { + min-width: 0; +} \ No newline at end of file diff --git a/src/routes.js b/src/routes.js index e69de29..c61d649 100644 --- a/src/routes.js +++ b/src/routes.js @@ -0,0 +1,5 @@ +// Define the routes and their corresponding HTML files +export const routes = { + '/': '/src/components/index.html', + '/home': '/src/components/home.html', +};