style(css): edit globals.css to enhance theming and accessibility with CSS variables and responsive design

This commit is contained in:
ryan 2025-06-19 15:39:07 +03:00
parent 862c2587c1
commit 35e565467f
2 changed files with 402 additions and 16 deletions

View file

@ -1,26 +1,412 @@
@import "tailwindcss"; @import "tailwindcss/preflight";
@import "tailwindcss/utilities";
/* CSS Custom Properties (CSS Variables) */
:root { :root {
--background: #ffffff; --foreground-rgb: 0, 0, 0;
--foreground: #171717; --background-start-rgb: 214, 219, 220;
} --background-end-rgb: 255, 255, 255;
@theme inline { /* Custom color variables for consistency */
--color-background: var(--background); --color-primary: #3b82f6;
--color-foreground: var(--foreground); --color-primary-hover: #2563eb;
--font-sans: var(--font-geist-sans); --color-danger: #ef4444;
--font-mono: var(--font-geist-mono); --color-danger-hover: #dc2626;
--color-warning: #f59e0b;
--color-warning-hover: #d97706;
--color-success: #10b981;
--color-success-hover: #059669;
/* Border and spacing variables */
--border-color: #d1d5db;
--border-radius: 0.375rem;
--spacing-xs: 0.25rem;
--spacing-sm: 0.5rem;
--spacing-md: 1rem;
} }
@media (prefers-color-scheme: dark) { @media (prefers-color-scheme: dark) {
:root { :root {
--background: #0a0a0a; --foreground-rgb: 255, 255, 255;
--foreground: #ededed; --background-start-rgb: 0, 0, 0;
--background-end-rgb: 0, 0, 0;
--border-color: #374151;
} }
} }
/* Base body styles */
body { body {
background: var(--background); color: rgb(var(--foreground-rgb));
color: var(--foreground); background: linear-gradient(
font-family: Arial, Helvetica, sans-serif; to bottom,
transparent,
rgb(var(--background-end-rgb))
)
rgb(var(--background-start-rgb));
} }
/* =================================
TABLE STYLES
================================= */
table {
border-collapse: collapse;
width: 100%;
margin-bottom: var(--spacing-md);
background-color: white;
border-radius: var(--border-radius);
overflow: hidden;
box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06);
}
table th,
table td {
border: 1px solid var(--border-color);
padding: var(--spacing-sm);
text-align: left;
vertical-align: top;
position: relative;
min-width: 120px;
}
table th {
background-color: #f9fafb;
font-weight: 600;
position: sticky;
top: 0;
z-index: 10;
border-bottom: 2px solid var(--border-color);
}
/* Dark mode table styles */
@media (prefers-color-scheme: dark) {
table {
background-color: #1f2937;
}
table th {
background-color: #374151;
color: #f9fafb;
}
table td {
background-color: #1f2937;
color: #f9fafb;
}
}
/* =================================
DELETE BUTTON STYLES
================================= */
.delete-button {
position: absolute;
top: 2px;
right: 2px;
width: 20px;
height: 20px;
background-color: var(--color-danger);
color: white;
border: none;
border-radius: 50%;
font-size: 12px;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
z-index: 5;
transition: background-color 0.2s ease-in-out;
}
.delete-button:hover {
background-color: var(--color-danger-hover);
transform: scale(1.1);
}
.delete-button:focus {
outline: 2px solid var(--color-danger);
outline-offset: 2px;
}
.item-delete {
background-color: var(--color-danger);
}
.property-delete {
background-color: var(--color-warning);
}
.property-delete:hover {
background-color: var(--color-warning-hover);
}
/* =================================
EDITABLE CELL STYLES
================================= */
.editable-cell {
position: relative;
width: 100%;
min-height: 2rem;
}
.editable-cell input,
.editable-cell textarea {
width: 100%;
border: none;
outline: none;
background: transparent;
resize: none;
padding: var(--spacing-xs);
font-family: inherit;
font-size: inherit;
transition: all 0.2s ease-in-out;
}
.editable-cell input:focus,
.editable-cell textarea:focus {
background-color: #fef3c7;
border: 2px solid var(--color-warning);
border-radius: var(--border-radius);
}
.focused-cell {
background-color: #fef3c7 !important;
border: 2px solid var(--color-warning) !important;
border-radius: var(--border-radius);
}
/* =================================
TYPEAHEAD STYLES
================================= */
.typeahead-container {
position: relative;
width: 100%;
}
.suggestions-dropdown {
position: absolute;
top: 100%;
left: 0;
right: 0;
background: white;
border: 1px solid var(--border-color);
border-top: none;
border-radius: 0 0 var(--border-radius) var(--border-radius);
box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
z-index: 50;
max-height: 200px;
overflow-y: auto;
}
.suggestion-item {
padding: var(--spacing-sm);
cursor: pointer;
border-bottom: 1px solid #f3f4f6;
transition: background-color 0.15s ease-in-out;
}
.suggestion-item:hover,
.suggestion-item.selected {
background-color: #dbeafe;
}
.suggestion-item:last-child {
border-bottom: none;
}
/* Dark mode typeahead styles */
@media (prefers-color-scheme: dark) {
.suggestions-dropdown {
background: #374151;
border-color: #4b5563;
}
.suggestion-item {
color: #f9fafb;
border-bottom-color: #4b5563;
}
.suggestion-item:hover,
.suggestion-item.selected {
background-color: #4b5563;
}
}
/* =================================
FORM INPUT STYLES
================================= */
#new-property {
padding: var(--spacing-sm);
border: 1px solid var(--border-color);
border-radius: var(--border-radius);
width: 300px;
margin-right: var(--spacing-sm);
transition: border-color 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
#new-property:focus {
outline: none;
border-color: var(--color-primary);
box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}
/* =================================
LOADING SPINNER
================================= */
.loading-spinner {
display: inline-block;
width: 16px;
height: 16px;
border: 2px solid #f3f4f6;
border-radius: 50%;
border-top-color: var(--color-primary);
animation: spin 1s ease-in-out infinite;
}
@keyframes spin {
to {
transform: rotate(360deg);
}
}
/* =================================
RESPONSIVE DESIGN
================================= */
.table-container {
overflow-x: auto;
border-radius: var(--border-radius);
border: 1px solid var(--border-color);
}
@media (max-width: 768px) {
table {
min-width: 600px;
}
table th,
table td {
min-width: 100px;
padding: var(--spacing-xs);
font-size: 0.875rem;
}
.delete-button {
width: 18px;
height: 18px;
font-size: 10px;
}
#new-property {
width: 250px;
}
}
@media (max-width: 480px) {
table th,
table td {
min-width: 80px;
padding: 0.125rem;
font-size: 0.75rem;
}
#new-property {
width: 200px;
}
}
/* =================================
UTILITY CLASSES
================================= */
.text-truncate {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.visually-hidden {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0, 0, 0, 0);
white-space: nowrap;
border: 0;
}
/* =================================
ANIMATIONS
================================= */
@keyframes fadeIn {
from {
opacity: 0;
transform: translateY(-10px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@keyframes slideIn {
from {
opacity: 0;
transform: translateX(-20px);
}
to {
opacity: 1;
transform: translateX(0);
}
}
.new-row {
animation: fadeIn 0.3s ease-in-out;
}
.slide-in {
animation: slideIn 0.2s ease-in-out;
}
/* =================================
ACCESSIBILITY IMPROVEMENTS
================================= */
/* Focus indicators */
button:focus,
input:focus,
textarea:focus,
select:focus {
outline: 2px solid var(--color-primary);
outline-offset: 2px;
}
/* Reduced motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
*,
*::before,
*::after {
animation-duration: 0.01ms !important;
animation-iteration-count: 1 !important;
transition-duration: 0.01ms !important;
}
}
/* High contrast mode support */
@media (prefers-contrast: high) {
table th,
table td {
border-width: 2px;
}
.delete-button {
border: 2px solid white;
}
}

View file

@ -57,7 +57,7 @@ export interface PropertyResponse {
globalUsageCount: number; globalUsageCount: number;
} }
// Wikidata types (for future integration) // Wikidata types
export interface WikidataSuggestion { export interface WikidataSuggestion {
id: string; id: string;
label: string; label: string;