Added TailwindCSS

This commit is contained in:
Your Name committed 2025-04-27 23:50:21 +08:00
1 parent b6058c32ec
commit 58744133d1
4 files changed
+235 -81

No files matched your search

+14 -6
View File
@@ -4,12 +4,20 @@
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"build": "postcss src/styles.css -o dist/styles.css" "dev": "vite",
"build": "vite build",
"preview": "vite preview",
"css:dev": "npx postcss src/styles.css -o dist/styles.css --watch",
"css:build": "npx postcss src/styles.css -o dist/styles.css"
},
"devDependencies": {
"autoprefixer": "^10.4.14",
"postcss": "^8.4.27",
"postcss-cli": "^10.1.0",
"tailwindcss": "^3.3.3",
"vite": "^6.3.3"
}, },
"dependencies": { "dependencies": {
"autoprefixer": "^10.4.7", "bulma": "^1.0.4"
"postcss": "^8.4.14", }
"tailwindcss": "^3.0.24"
},
"devDependencies": {}
} }
+101
View File
@@ -1,3 +1,104 @@
@tailwind base; @tailwind base;
@tailwind components; @tailwind components;
@tailwind utilities; @tailwind utilities;
/* Any custom styles that can't be easily represented with Tailwind utilities */
@layer base {
html {
@apply bg-bg-light;
}
body {
@apply font-sans text-text-default pt-navbar-height;
}
}
@layer components {
.upvote-arrow {
@apply text-text-muted no-underline text-md leading-none inline-block pt-0.5;
}
.upvote-arrow:hover {
@apply text-link-hover;
}
.post-title {
@apply text-text-title font-normal text-base;
}
.post-title:hover {
@apply underline text-text-title;
}
.handle {
@apply text-text-muted ml-2 text-sm;
}
.time {
@apply text-text-muted ml-2 text-sm;
}
.rules-tips {
@apply text-md bg-rules-bg text-primary border-l-4 border-primary py-3 px-4;
}
.post-item {
@apply py-3 px-2 border-b border-border-light bg-transparent;
}
.post-item:last-child {
@apply border-b-0;
}
.nested-comment {
@apply ml-6 mt-4 border-l-2 border-gray-200 pl-4 text-md;
}
.reply-box {
@apply ml-8 mt-4;
}
.comment-header small.reply {
@apply underline text-xs cursor-pointer ml-2 inline-block;
}
}
/* Any absolutely custom styles that don't fit in Tailwind's utility pattern */
.carbon-demo {
background-color: #fff;
border-radius: 0.2em;
display: grid;
grid-template-columns: 130px 1fr;
justify-content: center;
margin: 60px auto;
max-width: 360px;
overflow: hidden;
position: relative;
padding: 0;
box-shadow: 0 15px 30px rgba(0, 0, 0, 0.08);
}
.carbon-demo > * {
box-sizing: border-box;
}
.carbon-demo .carbon-img {
height: auto;
width: 130px;
}
.carbon-demo .carbon-desc {
font-size: 0.875rem;
line-height: 1.35;
padding: 0.75rem;
}
.carbon-demo .carbon-via {
bottom: 1em;
font-size: 0.625em;
font-weight: 600;
left: calc(130px + 0.75rem);
letter-spacing: 0.1ch;
position: absolute;
text-transform: uppercase;
}
+44 -1
View File
@@ -5,7 +5,50 @@ module.exports = {
"./public/**/*.{html,js}" "./public/**/*.{html,js}"
], ],
theme: { theme: {
extend: {}, extend: {
colors: {
// Main brand colors from the CSS
primary: '#38315f', // Purple color used for text and accents
'primary-dark': '#2d274a', // Darker version for hover states
'navbar-bg': '#e5fa70', // Navbar background
'navbar-border': '#cddb60', // Navbar border
'bg-light': '#f8f9fa', // Light background
'bg-footer': '#e9ecef', // Footer background
'text-default': '#343a40', // Default text color
'text-muted': '#6c757d', // Muted/secondary text
'text-title': '#212529', // Post title color
'link-hover': '#ff6600', // Orange hover color for upvote arrows
'rules-bg': '#eef6f6', // Rules box background
'border-light': '#dee2e6', // Light borders
},
fontFamily: {
sans: [
'-apple-system',
'BlinkMacSystemFont',
'"Segoe UI"',
'Roboto',
'Helvetica',
'Arial',
'sans-serif',
'"Apple Color Emoji"',
'"Segoe UI Emoji"',
'"Segoe UI Symbol"'
],
},
fontSize: {
'xs': '0.75rem', // Very small text (like "reply")
'sm': '0.8rem', // Small text (like meta info)
'md': '0.9rem', // Medium-small text (like rules box)
'base': '1rem', // Base text size (like post titles)
'lg': '1.2rem', // Section headers
},
spacing: {
'navbar-height': '3.25rem', // Height of the navbar
},
boxShadow: {
'card': '0 15px 30px rgba(0, 0, 0, 0.08)',
}
},
}, },
plugins: [], plugins: [],
} }
+76 -74
View File
@@ -1,76 +1,83 @@
<!doctype html> <!doctype html>
<html lang="en"> <html lang="en" class="bg-bg-light">
<head> <head>
<meta charset="UTF-8" /> <meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="node_modules/bulma/css/bulma.min.css"> <!-- Remove Bulma and add Tailwind -->
<link rel="stylesheet" href="dist/styles.css"> <script src="https://cdn.tailwindcss.com"></script>
<!-- You would typically import your tailwind config here or via a build step -->
<title>User Profile - Behind the Desk</title> <title>User Profile - Behind the Desk</title>
<style>
.hover-underline:hover {
text-decoration: underline;
}
.table.is-light {
background-color: #f5f5f5; /* Light background color */
border: none; /* Remove table borders */
color: #38315f; /* Set text color */
}
.table.is-light th, .table.is-light td {
border: none; /* Remove cell borders */
}
</style>
</head> </head>
<body> <body class="font-sans text-text-default pt-navbar-height">
<nav class="navbar is-fixed-top" role="navigation" aria-label="main navigation"> <!-- Fixed Navbar -->
<div class="container"> <nav class="fixed top-0 left-0 right-0 bg-navbar-bg border-b border-navbar-border z-10" role="navigation" aria-label="main navigation">
<div class="navbar-brand"> <div class="max-w-6xl mx-auto px-4">
<a class="navbar-item has-text-weight-bold" href="/"> <div class="flex justify-between">
Behind the Desk <!-- Left side -->
</a> <div class="flex">
<a role="button" class="navbar-burger" aria-label="menu" aria-expanded="false" data-target="navbarBasicExample"> <!-- Brand logo -->
<span aria-hidden="true"></span><span aria-hidden="true"></span><span aria-hidden="true"></span> <a href="/" class="flex items-center px-2 py-3 text-primary font-bold">
</a> Behind the Desk
</div> </a>
<div id="navbarBasicExample" class="navbar-menu"> <!-- Primary Nav -->
<div class="navbar-start"> <div class="hidden md:flex items-center">
<a class="navbar-item" href="/">top 🔥</a> <a href="/" class="px-3 py-3 text-primary hover:bg-opacity-5 hover:bg-primary">top 🔥</a>
<a class="navbar-item" href="#">new</a> <a href="#" class="px-3 py-3 text-primary hover:bg-opacity-5 hover:bg-primary">new</a>
<a class="navbar-item" href="#">nearby</a> <a href="#" class="px-3 py-3 text-primary hover:bg-opacity-5 hover:bg-primary">nearby</a>
<a class="navbar-item" href="#">past</a> <a href="#" class="px-3 py-3 text-primary hover:bg-opacity-5 hover:bg-primary">past</a>
<a class="navbar-item" href="#">ask</a> <a href="#" class="px-3 py-3 text-primary hover:bg-opacity-5 hover:bg-primary">ask</a>
<a class="navbar-item" href="#">show</a> <a href="#" class="px-3 py-3 text-primary hover:bg-opacity-5 hover:bg-primary">show</a>
<a class="navbar-item" href="#">submit</a> <a href="#" class="px-3 py-3 text-primary hover:bg-opacity-5 hover:bg-primary">submit</a>
</div>
<div class="navbar-end">
<div class="navbar-item">
<a href="/login.html">login</a>
</div> </div>
</div> </div>
<!-- Right side -->
<div class="hidden md:flex items-center">
<a href="/login.html" class="px-3 py-3 text-primary hover:bg-opacity-5 hover:bg-primary">login</a>
</div>
<!-- Mobile menu button -->
<div class="md:hidden flex items-center">
<button id="mobile-menu-button" class="text-primary p-3">
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"></path>
</svg>
</button>
</div>
</div> </div>
</div> </div>
<!-- Mobile menu -->
<div id="mobile-menu" class="hidden md:hidden">
<a href="/" class="block py-2 px-4 text-primary hover:bg-opacity-5 hover:bg-primary">top 🔥</a>
<a href="#" class="block py-2 px-4 text-primary hover:bg-opacity-5 hover:bg-primary">new</a>
<a href="#" class="block py-2 px-4 text-primary hover:bg-opacity-5 hover:bg-primary">nearby</a>
<a href="#" class="block py-2 px-4 text-primary hover:bg-opacity-5 hover:bg-primary">past</a>
<a href="#" class="block py-2 px-4 text-primary hover:bg-opacity-5 hover:bg-primary">ask</a>
<a href="#" class="block py-2 px-4 text-primary hover:bg-opacity-5 hover:bg-primary">show</a>
<a href="#" class="block py-2 px-4 text-primary hover:bg-opacity-5 hover:bg-primary">submit</a>
<a href="/login.html" class="block py-2 px-4 text-primary hover:bg-opacity-5 hover:bg-primary">login</a>
</div>
</nav> </nav>
<main class="section main-content"> <main class="py-4 pb-16">
<div class="container login-container"> <div class="max-w-md mx-auto px-4 mt-8">
<div class="form-section"> <div class="mb-8">
<h2>User Profile</h2> <h2 class="text-lg text-primary mb-4">User Profile</h2>
<div class="user-profile"> <div class="bg-white rounded shadow">
<table class="table is-light"> <table class="w-full bg-gray-50 text-primary">
<tr> <tr>
<th>Username:</th> <th class="text-left py-2 px-4 font-normal">Username:</th>
<td>@username</td> <td class="py-2 px-4">@username</td>
</tr> </tr>
<tr> <tr>
<th>Created:</th> <th class="text-left py-2 px-4 font-normal">Created:</th>
<td>January 1, 2023</td> <td class="py-2 px-4">January 1, 2023</td>
</tr> </tr>
<tr> <tr>
<th>About:</th> <th class="text-left py-2 px-4 font-normal align-top">About:</th>
<td> <td class="py-2 px-4">
<ul> <ul>
<li class="hover-underline">Submissions: 10</li> <li class="hover:underline cursor-pointer">Submissions: 10</li>
<li class="hover-underline">Comments: 50</li> <li class="hover:underline cursor-pointer">Comments: 50</li>
<li class="hover-underline">Favorites: 20</li> <li class="hover:underline cursor-pointer">Favorites: 20</li>
</ul> </ul>
</td> </td>
</tr> </tr>
@@ -80,31 +87,26 @@
</div> </div>
</main> </main>
<footer class="footer"> <footer class="bg-bg-footer py-8">
<div class="container"> <div class="max-w-6xl mx-auto px-4">
<div class="footer-menu"> <div class="mt-4 text-center">
<a href="#">Privacy</a> <a href="#" class="text-text-muted mx-2 hover:underline">Privacy</a>
<a href="#">Terms</a> <a href="#" class="text-text-muted mx-2 hover:underline">Terms</a>
<a href="#">Contact</a> <a href="#" class="text-text-muted mx-2 hover:underline">Contact</a>
</div> </div>
</div> </div>
</footer> </footer>
<!-- Simple script to toggle mobile menu --> <!-- Mobile menu toggle script -->
<script> <script>
document.addEventListener('DOMContentLoaded', () => { document.addEventListener('DOMContentLoaded', () => {
const $navbarBurgers = Array.prototype.slice.call(document.querySelectorAll('.navbar-burger'), 0); const mobileMenuButton = document.getElementById('mobile-menu-button');
if ($navbarBurgers.length > 0) { const mobileMenu = document.getElementById('mobile-menu');
$navbarBurgers.forEach(el => {
el.addEventListener('click', () => { mobileMenuButton.addEventListener('click', () => {
const target = el.dataset.target; mobileMenu.classList.toggle('hidden');
const $target = document.getElementById(target); });
el.classList.toggle('is-active');
$target.classList.toggle('is-active');
});
});
}
}); });
</script> </script>
</body> </body>
</html> </html>