diff --git a/README.md b/README.md
new file mode 100644
index 0000000..d4104cf
--- /dev/null
+++ b/README.md
@@ -0,0 +1,78 @@
+# catcrafts.net
+
+A modern, responsive website built with C++ using Crafter.CppDOM and compiled to WebAssembly.
+
+## Features
+
+- Modern, clean design with gradient colors and smooth animations
+- Fully responsive layout that works on mobile and desktop
+- Blog functionality with multiple posts
+- Smooth navigation and transitions
+- Semantic HTML structure
+- Custom CSS with modern styling techniques
+
+## Project Structure
+
+```
+catcrafts.net/
+├── interfaces/ # Interface definitions
+│ ├── Catcrafts.cppm
+│ ├── Catcrafts-Views.cppm
+│ ├── Catcrafts-Component.cppm
+│ └── Catcrafts-Blog.cppm
+├── implementations/ # Implementation files
+│ ├── Catcrafts-Blog.cpp
+│ └── main.cpp
+├── styles.css # Modern CSS styling
+├── project.json # Build configuration
+├── run.sh # Development server script
+└── build.sh # Build script
+```
+
+## Building and Running
+
+### Prerequisites
+- C++ compiler with WebAssembly support
+- Caddy server for serving files
+
+### Quick Start
+
+1. Make the scripts executable:
+```bash
+chmod +x run.sh build.sh
+```
+
+2. Run the development server:
+```bash
+./run.sh
+```
+
+The website will be available at `http://localhost:8085`
+
+### Building Manually
+
+```bash
+./build.sh
+```
+
+## Technologies Used
+
+- **C++**: Core application logic
+- **Crafter.CppDOM**: DOM manipulation library
+- **WebAssembly**: Runtime environment
+- **CSS3**: Modern styling with animations and gradients
+- **HTML5**: Semantic markup
+
+## Customization
+
+To add new blog posts:
+1. Edit `interfaces/Catcrafts-Blog.cppm`
+2. Add new entries to the `posts` vector
+
+To modify styling:
+1. Edit `styles.css`
+2. Adjust colors, fonts, and layout as needed
+
+## License
+
+This project is licensed under the MIT License - see the LICENSE file for details.
\ No newline at end of file
diff --git a/implementations/Catcrafts-Blog.cpp b/implementations/Catcrafts-Blog.cpp
index e634a1e..1d54172 100644
--- a/implementations/Catcrafts-Blog.cpp
+++ b/implementations/Catcrafts-Blog.cpp
@@ -14,9 +14,17 @@ namespace Catcrafts {
std::string RenderBlog() {
std::string html = "";
for(const BlogPost& post : *posts) {
- html += std::format("{} {}
{}", post.name, post.date, post.content);
+ html += std::format(R"(
+
+
+
{}
+ {}
+
+
+ {}
+
+
)", post.name, post.date, post.content);
}
return html;
}
-}
-
+}
\ No newline at end of file
diff --git a/implementations/main.cpp b/implementations/main.cpp
index 3c88985..9e7dbd8 100644
--- a/implementations/main.cpp
+++ b/implementations/main.cpp
@@ -17,33 +17,23 @@ HtmlElementView* blogButton;
void RenderRoot(const std::string_view route) {
std::string pageContent;
- if(route == "/blog") { //currently pointless if but for adding more pages in the future
+ if(route == "/blog") {
pageContent = RenderBlog();
} else {
pageContent = RenderBlog(); //default route
}
+ // Set body content
+ main->SetInnerHTML(pageContent);
- body->SetInnerHTML(std::format(R"(
-Catcrafts.net
-
-
-{}
-
-)", pageContent));
-
- if(blogButton) {
- delete blogButton;
- }
- blogButton = new HtmlElementView("blog-nav-button");
- blogButton->AddClickListener([](Crafter::MouseEvent e) {
- PushState("{}", "", "/blog");
- RenderRoot("blog");
- });
+ // Update active nav link
+ // auto navLinks = document->GetElementsByClassName("nav-container")[0]->GetElementsByTagName("a");
+ // for(auto link : navLinks) {
+ // if(link->GetAttribute("id") == "blog-nav-button") {
+ // link->SetAttribute("class", "active");
+ // } else {
+ // link->SetAttribute("class", "");
+ // }
+ //}
}
int main() {
@@ -51,5 +41,11 @@ int main() {
RenderRoot(GetPathNameString());
});
+ blogButton = new HtmlElementView("blog-nav-button");
+ blogButton->AddClickListener([](Crafter::MouseEvent e) {
+ PushState("{}", "", "/blog");
+ RenderRoot("blog");
+ });
+
RenderRoot("/");
}
\ No newline at end of file
diff --git a/interfaces/Catcrafts-Blog.cppm b/interfaces/Catcrafts-Blog.cppm
index 6780201..a7e15f7 100644
--- a/interfaces/Catcrafts-Blog.cppm
+++ b/interfaces/Catcrafts-Blog.cppm
@@ -25,4 +25,4 @@ export namespace Catcrafts {
}
};
std::string RenderBlog();
-}
+}
\ No newline at end of file
diff --git a/interfaces/Catcrafts-Views.cppm b/interfaces/Catcrafts-Views.cppm
index f41d85f..950a4c8 100644
--- a/interfaces/Catcrafts-Views.cppm
+++ b/interfaces/Catcrafts-Views.cppm
@@ -11,10 +11,37 @@ import Crafter.CppDOM;
using namespace Crafter;
export namespace Catcrafts {
- HtmlElementView* body = new HtmlElementView("body");
+ HtmlElementView* body = new HtmlElementView("body", R"(
+
+