Skip to content

Commit

Permalink
upgraded ui
Browse files Browse the repository at this point in the history
  • Loading branch information
ParisNeo committed Jul 21, 2024
1 parent 5a4a9c1 commit e41e4fb
Show file tree
Hide file tree
Showing 3 changed files with 160 additions and 7 deletions.
42 changes: 35 additions & 7 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<title>WebCraftorApps</title>
<style>
body {
font-family: Arial, sans-serif;
font-family: 'Arial', sans-serif;
background-color: #1e1e1e;
color: #c7c7c7;
display: flex;
Expand All @@ -15,32 +15,48 @@
justify-content: center;
height: 100vh;
margin: 0;
overflow: hidden;
animation: fadeIn 1s ease-in-out;
}
@keyframes fadeIn {
from { opacity: 0; }
to { opacity: 1; }
}
h1 {
margin-bottom: 20px;
font-size: 2.5em;
text-shadow: 2px 2px 5px rgba(0, 0, 0, 0.7);
}
.card-container {
display: flex;
flex-wrap: wrap;
justify-content: center;
gap: 20px;
padding: 20px;
}
.card {
background-color: #2e2e2e;
border-radius: 10px;
overflow: hidden;
width: 300px;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
transition: transform 0.2s;
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
transition: transform 0.3s, box-shadow 0.3s;
cursor: pointer;
position: relative;
overflow: hidden;
}
.card:hover {
transform: scale(1.05);
transform: translateY(-5px);
box-shadow: 0 8px 30px rgba(0, 0, 0, 0.7);
}
.card img {
width: 100%;
height: 200px;
object-fit: cover;
transition: transform 0.5s;
}
.card:hover img {
transform: scale(1.1);
}
.card-content {
padding: 15px;
Expand All @@ -50,15 +66,20 @@
color: #61dafb;
text-decoration: none;
font-size: 18px;
transition: color 0.3s;
}
.card-content a:hover {
color: #4ca3d9;
text-decoration: underline;
}
@media (max-width: 768px) {
.card {
width: 100%;
width: 90%;
max-width: 300px;
}
h1 {
font-size: 2em;
}
}
.refresh-button {
margin-top: 20px;
Expand All @@ -69,6 +90,7 @@
border-radius: 5px;
cursor: pointer;
font-size: 16px;
transition: background-color 0.3s;
}
.refresh-button:hover {
background-color: #4ca3d9;
Expand All @@ -87,7 +109,13 @@ <h1>WebCraftorApps</h1>
<div class="card" onclick="window.location.href='todo_app/index.html'">
<img src="todo_app/icon.png" alt="Todo App">
<div class="card-content">
<a href="todo_app/index.html">Todo App</a>
<a href="todo_app/index.html">Todo App projects</a>
</div>
</div>
<div class="card" onclick="window.location.href='simple_todo_app/index.html'">
<img src="simple_todo_app/icon.png" alt="Todo App">
<div class="card-content">
<a href="simple_todo_app/index.html">Todo App</a>
</div>
</div>
<div class="card" onclick="window.location.href='weight_tracking_app/index.html'">
Expand All @@ -109,7 +137,7 @@ <h1>WebCraftorApps</h1>
</div>
</div>
<div class="card" onclick="window.location.href='level_app/index.html'">
<img src="level_app/icon.png" alt="Snake game">
<img src="level_app/icon.png" alt="Level App">
<div class="card-content">
<a href="level_app/index.html">Level app (mobile only)</a>
</div>
Expand Down
Binary file added simple_todo_app/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
125 changes: 125 additions & 0 deletions simple_todo_app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Stylish To-Do List App</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/tailwind.min.css" rel="stylesheet">
<style>
body { transition: background-color 0.5s; }
.theme-light { background-color: #f9fafb; color: #111827; }
.theme-dark { background-color: #111827; color: #f9fafb; }
.theme-gray { background-color: #6b7280; color: #f9fafb; }
.theme-blue { background-color: #3b82f6; color: #f9fafb; }
.theme-green { background-color: #10b981; color: #f9fafb; }
.input-dark { background-color: #374151; color: #f9fafb; }
.settings { display: none; transition: opacity 0.5s; }
.settings.active { display: block; opacity: 1; }
.settings.hidden { opacity: 0; }
.todo-item-dark { background-color: #374151; color: #f9fafb; }
</style>
</head>
<body class="theme-gray" id="body">
<div class="max-w-md mx-auto p-5">
<h1 class="text-2xl font-bold text-center mb-4">To-Do List</h1>
<input type="text" id="todo-input" placeholder="Add a new task..." class="border p-2 w-full mb-2">
<button id="add-task-btn" onclick="addTodo()" class="bg-green-500 text-white p-2 w-full mb-2">Add Task</button>
<button id="export-btn" onclick="exportToExcel()" class="bg-blue-500 text-white p-2 w-full mb-2">Export to Excel</button>
<button onclick="toggleSettings()" class="bg-gray-500 text-white p-2 w-full mb-4">Settings</button>
<ul id="todo-list" class="space-y-2"></ul>
<div id="settings" class="settings hidden">
<h2 class="text-xl font-bold mb-2">Settings</h2>
<button onclick="toggleSettings()" class="bg-red-500 text-white p-2 mb-4">Back</button>
<label for="theme-selector" class="block mb-2">Select Theme:</label>
<select id="theme-selector" class="border p-2 w-full mb-4" onchange="changeTheme()">
<option value="gray">Gray Theme</option>
<option value="light">Light Theme</option>
<option value="dark">Dark Theme</option>
<option value="blue">Blue Theme</option>
<option value="green">Green Theme</option>
</select>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', loadTodos);

function addTodo() {
const input = document.getElementById('todo-input');
const todoText = input.value.trim();
if (todoText) {
const todos = JSON.parse(localStorage.getItem('todos')) || [];
todos.push({ text: todoText, done: false });
localStorage.setItem('todos', JSON.stringify(todos));
renderTodos();
input.value = '';
}
}
function removeTodo(index) {
const todos = JSON.parse(localStorage.getItem('todos'));
todos.splice(index, 1);
localStorage.setItem('todos', JSON.stringify(todos));
renderTodos();
}
function toggleDone(index) {
const todos = JSON.parse(localStorage.getItem('todos'));
todos[index].done = !todos[index].done;
localStorage.setItem('todos', JSON.stringify(todos));
renderTodos();
}
function renderTodos() {
const todos = JSON.parse(localStorage.getItem('todos')) || [];
const todoList = document.getElementById('todo-list');
todoList.innerHTML = '';
todos.forEach((todo, index) => {
const li = document.createElement('li');
li.className = `flex justify-between items-center p-2 rounded shadow ${todo.done ? 'line-through text-gray-500' : ''} ${document.body.classList.contains('theme-dark') ? 'todo-item-dark' : 'bg-white'}`;
li.innerHTML = `
<span onclick="toggleDone(${index})">${todo.text}</span>
<div>
<button class="bg-yellow-500 text-white p-1 rounded mr-1" onclick="toggleDone(${index})">Done</button>
<button class="bg-red-500 text-white p-1 rounded" onclick="removeTodo(${index})">Remove</button>
</div>
`;
todoList.appendChild(li);
});
}
function exportToExcel() {
let data = [];
const todos = JSON.parse(localStorage.getItem('todos')) || [];
todos.forEach(todo => {
data.push([todo.text]);
});
const csvContent = "data:text/csv;charset=utf-8," + data.map(e => e.join(",")).join("\n");
const encodedUri = encodeURI(csvContent);
const link = document.createElement("a");
link.setAttribute("href", encodedUri);
link.setAttribute("download", "todo_list.csv");
document.body.appendChild(link);
link.click();
document.body.removeChild(link);
}
function changeTheme() {
const body = document.getElementById('body');
const theme = document.getElementById('theme-selector').value;
body.className = `theme-${theme}`;
document.getElementById('todo-input').className = theme === 'dark' ? 'border p-2 w-full mb-2 input-dark' : 'border p-2 w-full mb-2';
localStorage.setItem('theme', theme);
renderTodos();
}
function toggleSettings() {
const settings = document.getElementById('settings');
const isActive = settings.classList.toggle('active');
settings.classList.toggle('hidden');
const elementsToHide = [document.getElementById('add-task-btn'), document.getElementById('export-btn'), document.getElementById('todo-list')];
elementsToHide.forEach(el => el.style.display = isActive ? 'none' : 'block');
}
function loadTodos() {
const theme = localStorage.getItem('theme') || 'gray';
document.getElementById('body').className = `theme-${theme}`;
document.getElementById('todo-input').className = theme === 'dark' ? 'border p-2 w-full mb-2 input-dark' : 'border p-2 w-full mb-2';
document.getElementById('theme-selector').value = theme;
renderTodos();
}
</script>
</body>
</html>

0 comments on commit e41e4fb

Please sign in to comment.