feat: add ripple effect, update theme styles and layout
This commit is contained in:
29
src/App.vue
29
src/App.vue
@@ -1,10 +1,35 @@
|
||||
<script setup>
|
||||
import Main from './components/Main.vue'
|
||||
import { ref } from 'vue'
|
||||
import Header from './components/Header.vue'
|
||||
import Footer from './components/Footer.vue'
|
||||
import Sidebar from './components/Sidebar.vue'
|
||||
|
||||
const isSidebarOpen = ref(true)
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Main />
|
||||
<Header @toggle-sidebar="isSidebarOpen = !isSidebarOpen" />
|
||||
<div class="app-body">
|
||||
<Sidebar :is-open="isSidebarOpen" />
|
||||
<main class="main-content">
|
||||
<router-view />
|
||||
</main>
|
||||
</div>
|
||||
<Footer />
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.app-body {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
width: 100%;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
flex: 1;
|
||||
padding: 2rem;
|
||||
width: 100%;
|
||||
max-width: 100%; /* Ensure it doesn't overflow */
|
||||
}
|
||||
</style>
|
||||
|
||||
38
src/components/Footer.vue
Normal file
38
src/components/Footer.vue
Normal file
@@ -0,0 +1,38 @@
|
||||
<script setup>
|
||||
const currentYear = new Date().getFullYear();
|
||||
const version = __APP_VERSION__;
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<footer class="app-footer unselectable">
|
||||
<div class="footer-content">
|
||||
<p>© {{ currentYear }} Tools App. v{{ version }}</p>
|
||||
</div>
|
||||
</footer>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.app-footer {
|
||||
width: 100%;
|
||||
padding: 1rem;
|
||||
background-color: #242424;
|
||||
border-top: 1px solid rgba(255, 255, 255, 0.1);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
margin-top: auto; /* Push to bottom in flex container */
|
||||
}
|
||||
|
||||
.footer-content {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 10px;
|
||||
}
|
||||
|
||||
p {
|
||||
font-size: 0.9rem;
|
||||
color: rgba(255, 255, 255, 0.6);
|
||||
margin: 0;
|
||||
font-family: monospace;
|
||||
}
|
||||
</style>
|
||||
114
src/components/Header.vue
Normal file
114
src/components/Header.vue
Normal file
@@ -0,0 +1,114 @@
|
||||
<script setup>
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { Sun, Moon } from 'lucide-vue-next'
|
||||
|
||||
defineEmits(['toggleSidebar'])
|
||||
|
||||
const isDark = ref(true)
|
||||
|
||||
const setTheme = (dark) => {
|
||||
isDark.value = dark
|
||||
const theme = dark ? 'dark' : 'light'
|
||||
document.documentElement.dataset.theme = theme
|
||||
localStorage.setItem('theme', theme)
|
||||
}
|
||||
|
||||
const toggleTheme = () => {
|
||||
setTheme(!isDark.value)
|
||||
}
|
||||
|
||||
onMounted(() => {
|
||||
const savedTheme = localStorage.getItem('theme')
|
||||
if (savedTheme) {
|
||||
setTheme(savedTheme === 'dark')
|
||||
} else {
|
||||
setTheme(true)
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<header class="app-header glass-panel unselectable">
|
||||
<div class="header-content">
|
||||
<div class="header-left">
|
||||
<button class="menu-btn" @click="$emit('toggleSidebar')" aria-label="Toggle Menu" v-ripple>
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
|
||||
<line x1="3" y1="12" x2="21" y2="12"></line>
|
||||
<line x1="3" y1="6" x2="21" y2="6"></line>
|
||||
<line x1="3" y1="18" x2="21" y2="18"></line>
|
||||
</svg>
|
||||
</button>
|
||||
<h1 class="app-title">Tools App</h1>
|
||||
</div>
|
||||
|
||||
<button
|
||||
class="btn-neon nav-btn icon-only"
|
||||
@click="toggleTheme"
|
||||
:title="isDark ? 'Switch to light mode' : 'Switch to dark mode'"
|
||||
v-ripple
|
||||
>
|
||||
<Sun v-if="isDark" :size="20" />
|
||||
<Moon v-else :size="20" />
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.app-header {
|
||||
/* Remove hardcoded colors and use theme variables */
|
||||
background: var(--glass-bg);
|
||||
color: var(--text-color);
|
||||
padding: 1rem;
|
||||
/* box-shadow handled by glass-panel class */
|
||||
position: relative;
|
||||
z-index: 100;
|
||||
border-left: none;
|
||||
border-right: none;
|
||||
border-top: none;
|
||||
border-radius: 0;
|
||||
}
|
||||
|
||||
.header-content {
|
||||
max-width: 100%;
|
||||
padding: 0;
|
||||
margin: 0 auto;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.header-left {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 1rem;
|
||||
}
|
||||
|
||||
.menu-btn {
|
||||
background: none;
|
||||
border: none;
|
||||
color: var(--text-color);
|
||||
cursor: pointer;
|
||||
padding: 0.5rem;
|
||||
border-radius: 4px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
transition: background-color 0.2s;
|
||||
}
|
||||
|
||||
.menu-btn:hover {
|
||||
background-color: var(--button-hover-bg);
|
||||
}
|
||||
|
||||
.app-title {
|
||||
margin: 0;
|
||||
font-size: 1.5rem;
|
||||
font-weight: 600;
|
||||
background: var(--title-gradient);
|
||||
-webkit-background-clip: text;
|
||||
-webkit-text-fill-color: transparent;
|
||||
background-clip: text;
|
||||
}
|
||||
</style>
|
||||
69
src/components/Sidebar.vue
Normal file
69
src/components/Sidebar.vue
Normal file
@@ -0,0 +1,69 @@
|
||||
<script setup>
|
||||
defineProps({
|
||||
isOpen: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
}
|
||||
})
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<aside class="sidebar unselectable" :class="{ 'is-open': isOpen }">
|
||||
<nav class="sidebar-nav">
|
||||
<router-link to="/passwords" class="nav-item" v-ripple>Passwords</router-link>
|
||||
</nav>
|
||||
</aside>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.sidebar {
|
||||
width: 0;
|
||||
background-color: var(--panel-bg);
|
||||
backdrop-filter: blur(12px);
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
overflow-x: hidden;
|
||||
transition: width 0.3s ease;
|
||||
border-right: 1px solid var(--panel-border);
|
||||
flex-shrink: 0;
|
||||
height: 100%;
|
||||
box-shadow: var(--panel-shadow);
|
||||
}
|
||||
|
||||
.sidebar.is-open {
|
||||
width: 250px;
|
||||
}
|
||||
|
||||
.sidebar-nav {
|
||||
padding: 0;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
width: 250px; /* Fixed width for content */
|
||||
}
|
||||
|
||||
.nav-item {
|
||||
display: block;
|
||||
padding: 0.5rem;
|
||||
color: var(--text-secondary);
|
||||
text-decoration: none;
|
||||
transition: background-color 0.2s, color 0.2s;
|
||||
white-space: nowrap;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.nav-item:hover {
|
||||
background-color: var(--button-hover-bg);
|
||||
color: var(--text-strong);
|
||||
}
|
||||
|
||||
.nav-item.router-link-active {
|
||||
color: var(--primary-accent);
|
||||
background-color: var(--toggle-bg);
|
||||
border-right: 2px solid var(--primary-accent);
|
||||
}
|
||||
|
||||
.divider {
|
||||
height: 1px;
|
||||
background-color: var(--panel-border);
|
||||
margin: 0.5rem 0;
|
||||
}
|
||||
</style>
|
||||
15
src/components/tools/Passwords.vue
Normal file
15
src/components/tools/Passwords.vue
Normal file
@@ -0,0 +1,15 @@
|
||||
<script setup>
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<div class="passwords-tool">
|
||||
<h2>Passwords Generator</h2>
|
||||
<p>This is the passwords generator tool (work in progress).</p>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.passwords-tool {
|
||||
padding: 1rem;
|
||||
}
|
||||
</style>
|
||||
34
src/directives/ripple.js
Normal file
34
src/directives/ripple.js
Normal file
@@ -0,0 +1,34 @@
|
||||
const Ripple = {
|
||||
mounted(el, binding) {
|
||||
el.style.position = 'relative';
|
||||
el.style.overflow = 'hidden';
|
||||
|
||||
el.addEventListener('click', function (e) {
|
||||
const rect = el.getBoundingClientRect();
|
||||
const x = e.clientX - rect.left;
|
||||
const y = e.clientY - rect.top;
|
||||
|
||||
const circle = document.createElement('span');
|
||||
const diameter = Math.max(rect.width, rect.height);
|
||||
const radius = diameter / 2;
|
||||
|
||||
circle.style.width = circle.style.height = `${diameter}px`;
|
||||
circle.style.left = `${x - radius}px`;
|
||||
circle.style.top = `${y - radius}px`;
|
||||
circle.classList.add('ripple');
|
||||
|
||||
// Allow custom color via directive value
|
||||
if (binding.value && typeof binding.value === 'string') {
|
||||
circle.style.backgroundColor = binding.value;
|
||||
}
|
||||
|
||||
el.appendChild(circle);
|
||||
|
||||
setTimeout(() => {
|
||||
circle.remove();
|
||||
}, 600); // Match animation duration
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
export default Ripple;
|
||||
@@ -1,5 +1,11 @@
|
||||
import { createApp } from 'vue'
|
||||
import './style.css'
|
||||
import App from './App.vue'
|
||||
import router from './router'
|
||||
import Ripple from './directives/ripple'
|
||||
|
||||
createApp(App).mount('#app')
|
||||
const app = createApp(App)
|
||||
|
||||
app.directive('ripple', Ripple)
|
||||
app.use(router)
|
||||
app.mount('#app')
|
||||
|
||||
23
src/router/index.js
Normal file
23
src/router/index.js
Normal file
@@ -0,0 +1,23 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import Main from '../components/Main.vue'
|
||||
import Passwords from '../components/tools/Passwords.vue'
|
||||
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'Home',
|
||||
component: Main
|
||||
},
|
||||
{
|
||||
path: '/passwords',
|
||||
name: 'Passwords',
|
||||
component: Passwords
|
||||
}
|
||||
]
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes
|
||||
})
|
||||
|
||||
export default router
|
||||
167
src/style.css
167
src/style.css
@@ -0,0 +1,167 @@
|
||||
:root {
|
||||
font-family: system-ui, Avenir, Helvetica, Arial, sans-serif;
|
||||
line-height: 1.5;
|
||||
font-weight: 400;
|
||||
|
||||
color-scheme: light dark;
|
||||
|
||||
/* --- Default Dark Theme Variables --- */
|
||||
--bg-gradient: radial-gradient(circle at center, #444 0%, #000000 100%);
|
||||
--glass-bg: rgba(255, 255, 255, 0.1);
|
||||
--glass-border: rgba(255, 255, 255, 0.2);
|
||||
--glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
|
||||
--text-color: #ffffff;
|
||||
--text-strong: #ffffff;
|
||||
--text-secondary: rgba(255, 255, 255, 0.85);
|
||||
--text-muted: rgba(255, 255, 255, 0.7);
|
||||
--accent-cyan: #00f2fe;
|
||||
--accent-purple: #4facfe;
|
||||
--primary-accent: #00f2fe;
|
||||
--title-glow: rgba(0, 255, 255, 0.2);
|
||||
--toggle-bg: rgba(255, 255, 255, 0.08);
|
||||
--toggle-border: rgba(255, 255, 255, 0.2);
|
||||
--toggle-shadow: 0 0 15px rgba(0, 0, 0, 0.2);
|
||||
--toggle-btn-border: rgba(255, 255, 255, 0.2);
|
||||
--toggle-hover-border: #ffffff;
|
||||
--toggle-active-shadow: 0 0 10px rgba(0, 242, 255, 0.3);
|
||||
--panel-bg: rgba(0, 0, 0, 0.4);
|
||||
--panel-border: rgba(255, 255, 255, 0.1);
|
||||
--panel-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
|
||||
--button-bg: rgba(255, 255, 255, 0.1);
|
||||
--button-border: rgba(255, 255, 255, 0.2);
|
||||
--button-text: #ffffff;
|
||||
--button-hover-bg: rgba(255, 255, 255, 0.25);
|
||||
--button-hover-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
|
||||
--button-active-shadow: 0 0 20px rgba(79, 172, 254, 0.4);
|
||||
--title-gradient: linear-gradient(45deg, #00f2fe, #4facfe);
|
||||
--ripple-color: rgba(255, 255, 255, 0.3);
|
||||
--nav-item-weight: 400;
|
||||
|
||||
color: var(--text-color);
|
||||
background-color: #242424; /* Fallback */
|
||||
background: var(--bg-gradient);
|
||||
background-attachment: fixed;
|
||||
|
||||
font-synthesis: none;
|
||||
text-rendering: optimizeLegibility;
|
||||
-webkit-font-smoothing: antialiased;
|
||||
-moz-osx-font-smoothing: grayscale;
|
||||
}
|
||||
|
||||
:root[data-theme="light"] {
|
||||
--bg-gradient: radial-gradient(circle at center, #ffffff 0%, #cccccc 100%);
|
||||
--glass-bg: rgba(255, 255, 255, 0.75);
|
||||
--glass-border: rgba(15, 23, 42, 0.12);
|
||||
--glass-shadow: 0 8px 32px 0 rgba(15, 23, 42, 0.12);
|
||||
--text-color: #000000;
|
||||
--text-strong: #000000;
|
||||
--text-secondary: #000000;
|
||||
--text-muted: rgba(0, 0, 0, 0.7);
|
||||
--accent-cyan: #0ea5e9;
|
||||
--accent-purple: #6366f1;
|
||||
--primary-accent: #0ea5e9;
|
||||
--title-glow: rgba(14, 165, 233, 0.35);
|
||||
--toggle-bg: rgba(255, 255, 255, 0.85);
|
||||
--toggle-border: rgba(15, 23, 42, 0.12);
|
||||
--toggle-shadow: 0 8px 20px rgba(15, 23, 42, 0.12);
|
||||
--toggle-btn-border: rgba(15, 23, 42, 0.18);
|
||||
--toggle-hover-border: rgba(15, 23, 42, 0.5);
|
||||
--toggle-active-shadow: 0 0 12px rgba(14, 165, 233, 0.25);
|
||||
--panel-bg: rgba(255, 255, 255, 0.7);
|
||||
--panel-border: rgba(15, 23, 42, 0.12);
|
||||
--panel-shadow: 0 12px 24px rgba(15, 23, 42, 0.12);
|
||||
--button-bg: rgba(255, 255, 255, 0.85);
|
||||
--button-border: rgba(15, 23, 42, 0.16);
|
||||
--button-text: #0f172a;
|
||||
--button-hover-bg: rgba(0, 0, 0, 0.05);
|
||||
--button-hover-shadow: 0 6px 18px rgba(15, 23, 42, 0.18);
|
||||
--button-active-shadow: 0 0 18px rgba(14, 165, 233, 0.25);
|
||||
--title-gradient: linear-gradient(45deg, #0ea5e9, #6366f1);
|
||||
--ripple-color: rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
body {
|
||||
margin: 0;
|
||||
display: flex;
|
||||
min-width: 320px;
|
||||
min-height: 100vh;
|
||||
}
|
||||
|
||||
#app {
|
||||
width: 100%;
|
||||
height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
/* Common UI Element Styles */
|
||||
.glass-panel {
|
||||
background: var(--glass-bg);
|
||||
backdrop-filter: blur(12px);
|
||||
-webkit-backdrop-filter: blur(12px);
|
||||
border: 1px solid var(--glass-border);
|
||||
box-shadow: var(--glass-shadow);
|
||||
}
|
||||
|
||||
.btn-neon {
|
||||
background: var(--button-bg);
|
||||
border: 1px solid var(--button-border);
|
||||
color: var(--button-text);
|
||||
padding: 8px 16px;
|
||||
border-radius: 8px;
|
||||
font-weight: 600;
|
||||
cursor: pointer;
|
||||
transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
|
||||
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
outline: none; /* Remove focus outline */
|
||||
}
|
||||
|
||||
/* Remove focus outline for all buttons */
|
||||
button:focus {
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.btn-neon:hover {
|
||||
background: var(--button-hover-bg);
|
||||
transform: translateY(-2px);
|
||||
box-shadow: var(--button-hover-shadow);
|
||||
border-color: var(--accent-cyan);
|
||||
}
|
||||
|
||||
.btn-neon:active {
|
||||
transform: translateY(1px);
|
||||
box-shadow: var(--button-active-shadow);
|
||||
}
|
||||
|
||||
.icon-only {
|
||||
padding: 8px;
|
||||
border-radius: 50%;
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.unselectable {
|
||||
user-select: none;
|
||||
-webkit-user-select: none;
|
||||
}
|
||||
|
||||
/* Ripple Effect */
|
||||
span.ripple {
|
||||
position: absolute;
|
||||
border-radius: 50%;
|
||||
transform: scale(0);
|
||||
animation: ripple 600ms linear;
|
||||
background-color: var(--ripple-color);
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@keyframes ripple {
|
||||
to {
|
||||
transform: scale(4);
|
||||
opacity: 0;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user