Skip to content

Commit 00ebb50

Browse files
index
1 parent 49b6684 commit 00ebb50

File tree

11 files changed

+512
-1
lines changed

11 files changed

+512
-1
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<div id="content_default" class="bg-neutral flex flex-col flex-1 transition-all duration-300 ease-in-out md:ml-64 h-dvh">
2+
{{header_default}}
3+
<div id="" class="flex flex-1 flex-col p-6 rounded-lg shadow overflow-hidden">
4+
{{hero_default}}
5+
</div>
6+
<!-- Content Footer -->
7+
<div class="p-4 h-5px flex items-center justify-center">
8+
<p class="text-sm"></p>
9+
</div>
10+
<script>
11+
</script>
12+
</div>
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<div id="footer_default" class="flex">
2+
<div class="h-5px w-64 flex items-center justify-center">
3+
<p class="text-sm">2023 My Website</p>
4+
</div>
5+
6+
<footer class="h-5px flex-1 flex items-center justify-center">
7+
<p class="text-lg"> 2023. All rights reserved.</p>
8+
</footer>
9+
10+
<script>
11+
</script>
12+
</div>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<div id="header_default">
2+
<header id="contentHeader" class="h-16 flex items-center justify-between w-full p-0 px-4">
3+
<div class="flex items-center space-x-4">
4+
<button id="contentHamburger" class="toggleSidebarButton hidden" aria-label="Toggle Sidebar"></button>
5+
<h1 id="auth-modeldropdown" class="text-lg"></h1>
6+
</div>
7+
{{themecontroller_default}}
8+
</header>
9+
<script>
10+
</script>
11+
</div>

projects/default/hero_default.html

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<div id="hero_default">
2+
<div class="hero bg-base-200">
3+
<div class="hero-content text-center">
4+
<div class="max-w-md">
5+
<h1 class="text-5xl font-bold">Hi there!</h1>
6+
<p class="py-6">
7+
MiniTemplate is a self-contained, modular, static, CDN-only template engine.
8+
Build your projects easily without dependency hell or the need for complex setups.
9+
</p>
10+
<button class="btn btn-primary" onclick="window.open('https://github.com/nostack-dev/minitemplate/blob/main/README.md', '_blank')">Get Started</button>
11+
</div>
12+
</div>
13+
</div>
14+
<script>
15+
</script>
16+
</div>

projects/default/index.html

Lines changed: 204 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,204 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
6+
<title>✍️ MiniTemplate - Simple Template Engine</title>
7+
8+
<!-- DaisyUI with Tailwind CDN -->
9+
<link href="https://cdn.jsdelivr.net/npm/daisyui@4.12.12/dist/full.min.css" rel="stylesheet" />
10+
<script src="https://cdn.tailwindcss.com"></script>
11+
</head>
12+
<body class="flex flex-col min-h-screen">
13+
14+
<div>
15+
<div id="sidebar_default" data-state="closed" class="bg-neutral w-64 h-full fixed top-0 left-0 flex flex-col justify-between transform -translate-x-full md:translate-x-0 transition-transform duration-300 ease-in-out z-10">
16+
<!-- Sidebar Header -->
17+
<div class="h-16 flex items-center justify-between px-4">
18+
<!-- Hamburger Icon (Always Visible) -->
19+
<button class="toggleSidebarButton" aria-label="Toggle Sidebar">
20+
21+
</button>
22+
23+
<button onclick="" aria-label="New Chat">
24+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="w-6 h-6">
25+
<path d="M12 19c4.418 0 8-3.582 8-8s-3.582-8-8-8S4 6.582 4 11a7.93 7.93 0 0 0 1.582 4.635l-1.39 3.483a1 1 0 0 0 1.266 1.266l3.483-1.39A7.93 7.93 0 0 0 12 19zm0-10v4m0 0v-4m-2 2h4"/>
26+
</svg>
27+
</button>
28+
</div>
29+
30+
<!-- Sidebar Navigation -->
31+
<nav class="flex-1 p-4">
32+
<ul class="menu w-full">
33+
<li>sidebar entry</li>
34+
</ul>
35+
</nav>
36+
37+
<!-- Sidebar Footer -->
38+
<div class="p-4 h-5px flex items-center justify-center">
39+
<p class="text-sm"></p>
40+
</div>
41+
42+
<!-- Self-contained JavaScript for Sidebar Toggle and Breakpoint Detection -->
43+
<script>
44+
(function() {
45+
document.addEventListener('DOMContentLoaded', function() {
46+
const sidebar = document.getElementById('sidebar_default');
47+
const toggleButtons = document.querySelectorAll('.toggleSidebarButton'); // Targeting all hamburger icons
48+
const mainContainer = document.body;
49+
const content = document.getElementById('content_component');
50+
const contentHamburger = document.getElementById('contentHamburger'); // The hamburger in the content header
51+
52+
function updateSidebarState() {
53+
if (window.innerWidth >= 768) { // Medium screens and larger
54+
sidebar.classList.remove('-translate-x-full', 'md:-translate-x-64');
55+
sidebar.classList.add('md:translate-x-0');
56+
sidebar.setAttribute('data-state', 'open');
57+
content.classList.add('md:ml-64');
58+
mainContainer.setAttribute('data-sidebar', 'open');
59+
contentHamburger.classList.add('hidden'); // Hide content hamburger when sidebar is open
60+
} else { // Small screens (mobile)
61+
sidebar.classList.add('-translate-x-full', 'md:-translate-x-64');
62+
sidebar.setAttribute('data-state', 'closed');
63+
content.classList.remove('md:ml-64');
64+
mainContainer.setAttribute('data-sidebar', 'closed');
65+
contentHamburger.classList.remove('hidden'); // Show content hamburger when sidebar is collapsed
66+
}
67+
}
68+
69+
// Add event listener to buttons for toggling the sidebar
70+
toggleButtons.forEach(button => {
71+
button.addEventListener('click', function() {
72+
const state = sidebar.getAttribute('data-state');
73+
if (state === 'open') {
74+
sidebar.classList.add('-translate-x-full', 'md:-translate-x-64');
75+
sidebar.setAttribute('data-state', 'closed');
76+
mainContainer.setAttribute('data-sidebar', 'closed');
77+
content.classList.remove('md:ml-64');
78+
contentHamburger.classList.remove('hidden'); // Show content hamburger when sidebar is collapsed
79+
} else {
80+
sidebar.classList.remove('-translate-x-full', 'md:-translate-x-64');
81+
sidebar.setAttribute('data-state', 'open');
82+
mainContainer.setAttribute('data-sidebar', 'open');
83+
content.classList.add('md:ml-64');
84+
contentHamburger.classList.add('hidden'); // Hide content hamburger when sidebar is open
85+
}
86+
});
87+
});
88+
89+
// Detect window resize and apply sidebar state accordingly
90+
window.addEventListener('resize', updateSidebarState);
91+
92+
// Set initial sidebar state based on screen size
93+
updateSidebarState();
94+
});
95+
})();
96+
</script>
97+
</div>
98+
<div id="content_default" class="bg-neutral flex flex-col flex-1 transition-all duration-300 ease-in-out md:ml-64 h-dvh">
99+
<div id="header_default">
100+
<header id="contentHeader" class="h-16 flex items-center justify-between w-full p-0 px-4">
101+
<div class="flex items-center space-x-4">
102+
<button id="contentHamburger" class="toggleSidebarButton hidden" aria-label="Toggle Sidebar"></button>
103+
<h1 id="auth-modeldropdown" class="text-lg"></h1>
104+
</div>
105+
<div id="themecontroller_default" class="dropdown">
106+
<div id="themeButton" tabindex="0" role="button" class="btn">
107+
Theme
108+
<svg width="12px" height="12px" class="inline-block h-2 w-2 fill-current opacity-60" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 2048 2048">
109+
<path d="M1799 349l242 241-1017 1017L7 590l242-241 775 775 775-775z"></path>
110+
</svg>
111+
</div>
112+
<ul id="themeDropdown" tabindex="0" class="dropdown-content bg-base-300 rounded-box z-[1] shadow-2xl hidden">
113+
<li>
114+
<input type="radio" name="theme-dropdown" class="theme-controller btn btn-sm btn-block btn-ghost justify-start" aria-label="Dark" value="dark" />
115+
</li>
116+
<li>
117+
<input type="radio" name="theme-dropdown" class="theme-controller btn btn-sm btn-block btn-ghost justify-start" aria-label="Light" value="light" />
118+
</li>
119+
<li>
120+
<input type="radio" name="theme-dropdown" class="theme-controller btn btn-sm btn-block btn-ghost justify-start" aria-label="Cyberpunk" value="cyberpunk" />
121+
</li>
122+
<li>
123+
<input type="radio" name="theme-dropdown" class="theme-controller btn btn-sm btn-block btn-ghost justify-start" aria-label="Business" value="business" />
124+
</li>
125+
<li>
126+
<input type="radio" name="theme-dropdown" class="theme-controller btn btn-sm btn-block btn-ghost justify-start" aria-label="Aqua" value="aqua" />
127+
</li>
128+
</ul>
129+
<script>
130+
(function() {
131+
document.addEventListener('DOMContentLoaded', function() {
132+
const themeButton = document.getElementById('themeButton');
133+
const themeDropdown = document.getElementById('themeDropdown');
134+
const themeOptions = document.querySelectorAll('.theme-controller');
135+
136+
// Set initial theme from local storage or default to "Theme"
137+
const savedTheme = localStorage.getItem('selectedTheme');
138+
if (savedTheme) {
139+
document.body.setAttribute('data-theme', savedTheme);
140+
const selectedOption = Array.from(themeOptions).find(option => option.value === savedTheme);
141+
if (selectedOption) {
142+
themeButton.childNodes[0].textContent = selectedOption.getAttribute('aria-label');
143+
selectedOption.checked = true;
144+
}
145+
}
146+
147+
// Toggle dropdown visibility when the button is clicked
148+
themeButton.addEventListener('click', function() {
149+
themeDropdown.classList.toggle('hidden');
150+
});
151+
152+
// Close the dropdown if clicked outside
153+
document.addEventListener('click', function(event) {
154+
if (!themeButton.contains(event.target) && !themeDropdown.contains(event.target)) {
155+
themeDropdown.classList.add('hidden');
156+
}
157+
});
158+
159+
// Apply selected theme, update button label, save to local storage, and close dropdown
160+
themeOptions.forEach(option => {
161+
option.addEventListener('change', function() {
162+
document.body.setAttribute('data-theme', this.value); // Change theme
163+
themeButton.childNodes[0].textContent = this.getAttribute('aria-label'); // Update button label
164+
localStorage.setItem('selectedTheme', this.value); // Save to local storage
165+
themeDropdown.classList.add('hidden'); // Close dropdown
166+
});
167+
});
168+
});
169+
})();
170+
</script>
171+
</div>
172+
</header>
173+
<script>
174+
</script>
175+
</div>
176+
<div id="" class="flex flex-1 flex-col p-6 rounded-lg shadow overflow-hidden">
177+
<div id="hero_default">
178+
<div class="hero bg-base-200">
179+
<div class="hero-content text-center">
180+
<div class="max-w-md">
181+
<h1 class="text-5xl font-bold">Hi there!</h1>
182+
<p class="py-6">
183+
MiniTemplate is a self-contained, modular, static, CDN-only template engine.
184+
Build your projects easily without dependency hell or the need for complex setups.
185+
</p>
186+
<button class="btn btn-primary" onclick="window.open('https://github.com/nostack-dev/minitemplate/blob/main/README.md', '_blank')">Get Started</button>
187+
</div>
188+
</div>
189+
</div>
190+
<script>
191+
</script>
192+
</div>
193+
</div>
194+
<!-- Content Footer -->
195+
<div class="p-4 h-5px flex items-center justify-center">
196+
<p class="text-sm"></p>
197+
</div>
198+
<script>
199+
</script>
200+
</div>
201+
</div>
202+
203+
</body>
204+
</html>

projects/default/run_add.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
# Function to find the project root directory
4+
find_project_root() {
5+
local dir="$(cd "${1:-$(pwd)}" && pwd)" # Convert to absolute path
6+
local root_files=("README.md" "LICENSE" "CONTRIBUTE.md" "CNAME")
7+
8+
while [[ "$dir" != "/" ]]; do
9+
for file in "${root_files[@]}"; do
10+
if [[ -f "$dir/$file" ]]; then
11+
echo "$dir" # Return the directory as the project root
12+
return 0
13+
fi
14+
done
15+
dir=$(dirname "$dir") # Move one level up
16+
done
17+
18+
return 1 # Return error if no root found
19+
}
20+
21+
# Find the project root directory
22+
project_root=$(find_project_root "$(dirname "${BASH_SOURCE[0]}")")
23+
24+
# Check if the project root was found
25+
if [[ -z "$project_root" ]]; then
26+
echo "Error: Could not find the project root."
27+
exit 1
28+
fi
29+
30+
# Append the scripts directory to the root path
31+
scripts_dir="$project_root/scripts"
32+
33+
# Print the final scripts directory for verification
34+
echo "Scripts directory path: $scripts_dir"
35+
36+
# Check if the add.sh script exists in the scripts directory
37+
if [[ ! -f "$scripts_dir/add.sh" ]]; then
38+
echo "Error: add.sh not found in $scripts_dir"
39+
exit 1
40+
fi
41+
42+
# Run the add.sh script with the passed arguments
43+
"$scripts_dir/add.sh" "$@"

projects/default/run_generate.sh

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
#!/bin/bash
2+
3+
# Function to find the project root directory
4+
find_project_root() {
5+
local dir="$(cd "${1:-$(pwd)}" && pwd)" # Convert to absolute path
6+
local root_files=("README.md" "LICENSE" "CONTRIBUTE.md" "CNAME")
7+
8+
while [[ "$dir" != "/" ]]; do
9+
for file in "${root_files[@]}"; do
10+
if [[ -f "$dir/$file" ]]; then
11+
echo "$dir" # Return the directory as the project root
12+
return 0
13+
fi
14+
done
15+
dir=$(dirname "$dir") # Move one level up
16+
done
17+
18+
return 1 # Return error if no root found
19+
}
20+
21+
# Find the project root directory
22+
project_root=$(find_project_root "$(dirname "${BASH_SOURCE[0]}")")
23+
24+
# Check if the project root was found
25+
if [[ -z "$project_root" ]]; then
26+
echo "Error: Could not find the project root."
27+
exit 1
28+
fi
29+
30+
# Append the scripts directory to the root path
31+
scripts_dir="$project_root/scripts"
32+
33+
# Print the final scripts directory for verification
34+
echo "Scripts directory path: $scripts_dir"
35+
36+
# Check if the generate_site.sh script exists in the scripts directory
37+
if [[ ! -f "$scripts_dir/generate_site.sh" ]]; then
38+
echo "Error: generate_site.sh not found in $scripts_dir"
39+
exit 1
40+
fi
41+
42+
# Run the generate_site.sh script
43+
"$scripts_dir/generate_site.sh"

0 commit comments

Comments
 (0)