diff --git a/.storybook/foundations/Components.stories.tsx b/.storybook/foundations/Components.stories.tsx new file mode 100644 index 00000000..cb1df366 --- /dev/null +++ b/.storybook/foundations/Components.stories.tsx @@ -0,0 +1,89 @@ +import React from 'react'; +import type { Meta, StoryObj } from '@storybook/react-vite'; +import Button from '@atoms/Button'; +import Card from '@atoms/Card'; +import TechBadge from '@atoms/TechBadge'; +import DateChip from '@atoms/DateChip'; +import SecurityBadge from '@atoms/SecurityBadge'; +import SecurityClassification from '@atoms/SecurityClassification'; +import SkillChip from '@molecules/SkillChip'; +import SocialLinks from '@molecules/SocialLinks'; +import { Group, Page, foundationParameters } from './kit'; + +const meta: Meta = { + title: 'Foundations/Components at a glance', + parameters: foundationParameters, +}; +export default meta; + +const rowStyle: React.CSSProperties = { display: 'flex', flexWrap: 'wrap', gap: 'var(--spacing-3)', alignItems: 'center' }; + +export const ComponentsAtAGlance: StoryObj = { + name: 'Components at a glance', + render: () => ( + + +
+
+ + + + + +
+
+ + + +
+
+
+ + +
+ + + +
+ } + > +

Three control-plane nodes and four workers, reconciled from Git by Flux.

+
+ + +
+ + +
+ + +
+
+ + + + + + +
+
+ + +
+
+ +
+
+
+
+ ), +}; diff --git a/.storybook/foundations/Layout.stories.tsx b/.storybook/foundations/Layout.stories.tsx index eb9992de..e3f4c46f 100644 --- a/.storybook/foundations/Layout.stories.tsx +++ b/.storybook/foundations/Layout.stories.tsx @@ -13,6 +13,11 @@ const SEMANTIC_SPACING = ['--card-padding', '--button-padding-y', '--button-padd const RADII = ['--border-radius-sm', '--border-radius', '--border-radius-md', '--border-radius-lg', '--border-radius-xl', '--border-radius-pill', '--border-radius-circle']; const BORDERS = ['--border-width-thin', '--border-width-medium', '--border-width-thick']; const SHADOWS = ['--box-shadow-sm', '--shadow-md', '--box-shadow', '--box-shadow-lg']; +const SURFACE_PANELS = ['--surface-card', '--surface-card-raised', '--surface-inset']; +const SURFACE_LINES = ['--surface-border', '--surface-border-strong', '--surface-divider']; +const SURFACE_SHAPES = ['--radius-card', '--radius-control', '--radius-chip']; +const SURFACE_ELEVATION = ['--shadow-card', '--shadow-card-hover', '--ring-focus']; +const SURFACE_CONTROLS = ['--control-height-sm', '--control-height', '--control-padding-x']; const BREAKPOINTS = ['--breakpoint-sm', '--breakpoint-md', '--breakpoint-lg', '--breakpoint-xl', '--breakpoint-xxl']; const LAYERS = ['--z-index-dropdown', '--z-index-sticky', '--z-index-fixed', '--z-index-modal-backdrop', '--z-index-modal', '--z-index-popover', '--z-index-toast']; @@ -44,7 +49,7 @@ export const SpacingAndShape: StoryObj = { - + {RADII.map((name) => (
@@ -66,15 +71,64 @@ export const SpacingAndShape: StoryObj = { -
- - {SHADOWS.map((name) => ( -
- {name} + + {SHADOWS.map((name) => ( +
+ {name} +
+ ))} +
+ + + + + {SURFACE_PANELS.map((name) => ( +
+
+
+
- ))} - +
+ ))} + +
+ {SURFACE_LINES.map((name) => ( + +
+ + ))}
+

Shape

+ + {SURFACE_SHAPES.map((name) => ( +
+
+
+ +
+
+ ))} + +

Elevation and focus

+ + {SURFACE_ELEVATION.map((name) => ( +
+
+
+ +
+
+ ))} + +

Controls

+ + {SURFACE_CONTROLS.map((name) => ( + + ))} + diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx index 3a5a9be1..7bfdd9a3 100644 --- a/.storybook/preview.tsx +++ b/.storybook/preview.tsx @@ -42,7 +42,7 @@ const preview: Preview = { layout: 'centered', options: { storySort: { - order: ['Introduction', 'Foundations', ['Colors', 'Typography', 'Spacing and shape', 'Motion'], 'Atoms', 'Molecules', 'Organisms', 'Layout', 'Templates'], + order: ['Introduction', 'Foundations', ['Components at a glance', 'Colors', 'Typography', 'Spacing and shape', 'Motion'], 'Atoms', 'Molecules', 'Organisms', 'Layout', 'Templates'], }, }, }, diff --git a/config/vite/dev/clusterStatus.ts b/config/vite/dev/clusterStatus.ts new file mode 100644 index 00000000..1006785c --- /dev/null +++ b/config/vite/dev/clusterStatus.ts @@ -0,0 +1,38 @@ +import type { Plugin } from 'vite'; +// @ts-expect-error plain JS module shared with the production server +import { createClusterStatusHandler } from '../prod/clusterStatus.js'; + +/** + * Serves GET /api/cluster-status from the Vite dev server with the same + * handler the production Express server uses. + */ +export default function clusterStatusDevPlugin(): Plugin { + const handler = createClusterStatusHandler(); + return { + name: 'cluster-status-dev', + apply: 'serve', + configureServer(server) { + server.middlewares.use('/api/cluster-status', (req, res) => { + const adapter = { + status(code: number) { + res.statusCode = code; + return adapter; + }, + set(name: string, value: string) { + res.setHeader(name, value); + return adapter; + }, + json(body: unknown) { + res.setHeader('Content-Type', 'application/json'); + res.end(JSON.stringify(body)); + return adapter; + }, + }; + handler(req, adapter).catch(() => { + res.statusCode = 503; + res.end('{"error":"Cluster status unavailable"}'); + }); + }); + }, + }; +} diff --git a/config/vite/index.ts b/config/vite/index.ts index 5ef58464..549806c0 100644 --- a/config/vite/index.ts +++ b/config/vite/index.ts @@ -15,6 +15,7 @@ import getCorePlugins from './plugins/core'; import getPwaPlugins from './plugins/pwa'; import getCodeSplittingConfig from './optimization/splitting'; import getViteDevConfig from './dev/vite'; +import clusterStatusDevPlugin from './dev/clusterStatus'; // Initialize environment variables const { initEnv, getClientEnv, isProd, isDev, getNodeEnv } = envConfig; @@ -39,6 +40,9 @@ export default defineConfig(({ command, mode }) => { // Progressive Web App features and analysis tools ...getPwaPlugins({ isProd: isProd(), analyze: isAnalyze }), + + // Dev-only /api/cluster-status (the production Express server has its own) + clusterStatusDevPlugin(), ].filter(Boolean); // Remove any false/undefined entries // Vite development server configuration @@ -104,7 +108,9 @@ export default defineConfig(({ command, mode }) => { terserOptions: isProd() ? { compress: { passes: 2, - drop_console: true, + // Strip debug logging; warnings, errors and console.info (the devtools + // greeting in src/index.tsx) stay + pure_funcs: ['console.log', 'console.debug'], drop_debugger: true }, format: { diff --git a/config/vite/prod/clusterStatus.js b/config/vite/prod/clusterStatus.js new file mode 100644 index 00000000..7053390d --- /dev/null +++ b/config/vite/prod/clusterStatus.js @@ -0,0 +1,99 @@ +// Live cluster numbers for the site, read from Kromgo badges. +// Kromgo sends no CORS headers, so the server fetches the badges and the +// browser only ever talks to /api/cluster-status. + +/* global AbortSignal */ + +export const CLUSTER_BADGE_IDS = [ + 'cluster_status', + 'cluster_node_count', + 'cluster_pod_count', + 'services_up', + 'cluster_uptime_days', + 'cluster_age_days', + 'cluster_cpu_usage', + 'cluster_memory_usage', + 'cluster_power_usage', + 'cluster_alert_count', + 'talos_version', + 'kubernetes_version', + 'flux_version', +]; + +const DEFAULT_KROMGO_URL = 'https://kromgo.chelonianlabs.com'; +const CACHE_TTL_MS = 60_000; +const TIMEOUT_MS = 3_000; +const MAX_FIELD_LENGTH = 64; + +// Keep only short non-empty strings; anything else is dropped. +const cleanString = (value) => + typeof value === 'string' && value.length > 0 ? value.slice(0, MAX_FIELD_LENGTH) : null; + +// Shape one badge down to the three public fields, or null if unusable. +export function shapeBadge(raw) { + if (!raw || typeof raw !== 'object') return null; + const value = cleanString(raw.value); + if (value === null) return null; + return { + title: cleanString(raw.title) ?? '', + value, + color: cleanString(raw.color) ?? '', + }; +} + +async function fetchBadge(fetchImpl, baseUrl, id, timeoutMs) { + try { + const response = await fetchImpl(`${baseUrl}/badges/${id}?format=json`, { + signal: AbortSignal.timeout(timeoutMs), + headers: { Accept: 'application/json' }, + }); + if (!response.ok) return null; + return shapeBadge(await response.json()); + } catch { + return null; + } +} + +/** + * Creates the GET /api/cluster-status handler. + * Options are injectable for tests. + */ +export function createClusterStatusHandler({ + fetchImpl = (...args) => fetch(...args), + baseUrl = process.env.KROMGO_URL || DEFAULT_KROMGO_URL, + ttlMs = CACHE_TTL_MS, + timeoutMs = TIMEOUT_MS, + now = Date.now, +} = {}) { + const base = baseUrl.replace(/\/+$/, ''); + let cache = null; // { at, body } + let inflight = null; + + async function load() { + const results = await Promise.all( + CLUSTER_BADGE_IDS.map(async (id) => [id, await fetchBadge(fetchImpl, base, id, timeoutMs)]) + ); + const badges = {}; + for (const [id, badge] of results) { + if (badge) badges[id] = badge; + } + if (Object.keys(badges).length === 0) return null; + return { updatedAt: new Date(now()).toISOString(), badges }; + } + + return async function clusterStatusHandler(req, res) { + let body = cache && now() - cache.at < ttlMs ? cache.body : null; + if (!body) { + inflight ??= load().finally(() => { + inflight = null; + }); + body = await inflight; + if (body) cache = { at: now(), body }; + } + if (!body) { + res.status(503).set('Cache-Control', 'no-store').json({ error: 'Cluster status unavailable' }); + return; + } + res.set('Cache-Control', 'public, max-age=60').json(body); + }; +} diff --git a/config/vite/prod/server.js b/config/vite/prod/server.js index a694d537..418909f6 100644 --- a/config/vite/prod/server.js +++ b/config/vite/prod/server.js @@ -3,6 +3,7 @@ import path from 'path'; import { fileURLToPath } from 'url'; import fs from 'fs/promises'; import { existsSync } from 'fs'; +import { createClusterStatusHandler } from './clusterStatus.js'; const __filename = fileURLToPath(import.meta.url); const __dirname = path.dirname(__filename); @@ -35,6 +36,9 @@ const prodConfig = { const app = createBaseServer({ ...prodConfig, registerRoutes: registerHealthRoutes }); function registerHealthRoutes(app) { +// Live cluster numbers from Kromgo (cached 60 s) +app.get('/api/cluster-status', createClusterStatusHandler()); + // Production-specific comprehensive health check app.get('/health/comprehensive', async (req, res) => { const healthReport = { diff --git a/config/vite/server.js b/config/vite/server.js index f517886b..9dec1dad 100644 --- a/config/vite/server.js +++ b/config/vite/server.js @@ -197,6 +197,16 @@ export function createBaseServer(config = {}) { } })); + // RFC 8615 well-known files (security.txt). express.static skips dot-folders, + // so mount this one explicitly; nothing else starting with a dot is served. + app.use('/.well-known', express.static(path.join(buildPath, '.well-known'), { + setHeaders: (res) => { + res.set('X-Content-Type-Options', 'nosniff'); + res.set('Cache-Control', 'public, max-age=86400'); + } + })); + app.use('/.well-known', (req, res) => res.status(404).type('text/plain').send('Not found')); + // Serve main static files AFTER specific routes to avoid conflicts app.use(express.static(buildPath, { ...getStaticHeaders(), diff --git a/index.html b/index.html index 68a325c9..8e11c9f6 100644 --- a/index.html +++ b/index.html @@ -2,15 +2,16 @@ - + + - - + + - + diff --git a/public/.well-known/security.txt b/public/.well-known/security.txt index bbee5065..408e6220 100644 --- a/public/.well-known/security.txt +++ b/public/.well-known/security.txt @@ -1,7 +1,4 @@ -Contact: mailto:security@chelonianlabs.com -Expires: 2025-12-31T23:59:59.000Z -Preferred-Language: en +Contact: mailto:contact@chelonianlabs.com +Expires: 2027-11-21T00:00:00.000Z +Preferred-Languages: en Canonical: https://derekmackley.com/.well-known/security.txt -Policy: https://github.com/DapperDivers/developer-portfolio/blob/main/.github/SECURITY_POLICY.md -# Our security acknowledgments page -Acknowledgments: https://github.com/DapperDivers/developer-portfolio/blob/main/.github/SECURITY_ACKNOWLEDGMENTS.md \ No newline at end of file diff --git a/public/apple-touch-icon.png b/public/apple-touch-icon.png new file mode 100644 index 00000000..3206fad3 Binary files /dev/null and b/public/apple-touch-icon.png differ diff --git a/public/favicon-192.png b/public/favicon-192.png new file mode 100644 index 00000000..a0e7e82b Binary files /dev/null and b/public/favicon-192.png differ diff --git a/public/favicon-32.png b/public/favicon-32.png new file mode 100644 index 00000000..c7bdb996 Binary files /dev/null and b/public/favicon-32.png differ diff --git a/public/favicon-512.png b/public/favicon-512.png new file mode 100644 index 00000000..d3040d13 Binary files /dev/null and b/public/favicon-512.png differ diff --git a/public/favicon.png b/public/favicon.png index 1b2034d9..d379f31e 100644 Binary files a/public/favicon.png and b/public/favicon.png differ diff --git a/public/humans.txt b/public/humans.txt new file mode 100644 index 00000000..ae7dc1fd --- /dev/null +++ b/public/humans.txt @@ -0,0 +1,16 @@ +/* TEAM */ +Human: Derek Mackley +Role: Principal Security Engineer +Site: https://derekmackley.com +Location: Canton, GA, USA + +/* THANKS */ +The open source maintainers this site stands on, and the homelab, +which keeps me honest about operations. + +/* SITE */ +Hosting: a Kubernetes cluster (Talos Linux, Flux CD) in a garage, + increasingly operated by AI agents +Stack: React, TypeScript, Vite, Framer Motion, Tailwind, Storybook +Source: https://github.com/DapperDivers/developer-portfolio +Security contact: /.well-known/security.txt diff --git a/public/manifest.json b/public/manifest.json index 2772d195..b8153927 100644 --- a/public/manifest.json +++ b/public/manifest.json @@ -2,20 +2,25 @@ "short_name": "Portfolio", "name": "Derek's Portfolio", "description": "Portfolio of Derek Mackley, Principal Security Engineer.", - "icons": [ - { - "src": "./favicon.png", - "type": "image/png", - "sizes": "192x192" - }, - { - "src": "./favicon.png", - "type": "image/png", - "sizes": "512x512" - } - ], + "icons": [ + { + "src": "./favicon-32.png", + "type": "image/png", + "sizes": "32x32" + }, + { + "src": "./favicon-192.png", + "type": "image/png", + "sizes": "192x192" + }, + { + "src": "./favicon-512.png", + "type": "image/png", + "sizes": "512x512" + } + ], "start_url": "./index.html", "display": "standalone", - "theme_color": "#11cdef", - "background_color": "#11cdef" + "theme_color": "#0a192f", + "background_color": "#0a192f" } diff --git a/public/site.webmanifest b/public/site.webmanifest index cfb10cc8..6998d13f 100644 --- a/public/site.webmanifest +++ b/public/site.webmanifest @@ -4,7 +4,17 @@ "description": "Portfolio of Derek Mackley, a Principal Security Engineer working across product security, platform engineering and AI agent security", "icons": [ { - "src": "/favicon.png", + "src": "/favicon-32.png", + "sizes": "32x32", + "type": "image/png" + }, + { + "src": "/apple-touch-icon.png", + "sizes": "180x180", + "type": "image/png" + }, + { + "src": "/favicon-192.png", "sizes": "192x192", "type": "image/png" }, @@ -14,8 +24,8 @@ "type": "image/png" } ], - "theme_color": "#006ee6", - "background_color": "#ffffff", + "theme_color": "#0a192f", + "background_color": "#0a192f", "display": "standalone", "start_url": "/", "orientation": "portrait" diff --git a/public/turtle.png b/public/turtle.png new file mode 100644 index 00000000..c73c5eee Binary files /dev/null and b/public/turtle.png differ diff --git a/src/assets/css/design-system/index.css b/src/assets/css/design-system/index.css index af858bc6..9e4a9b20 100644 --- a/src/assets/css/design-system/index.css +++ b/src/assets/css/design-system/index.css @@ -17,6 +17,7 @@ @import './tokens/transitions.css'; @import './tokens/breakpoints.css'; @import './tokens/z-index.css'; +@import './tokens/surfaces.css'; /* All design tokens are now in the main token files */ diff --git a/src/assets/css/design-system/tokens/surfaces.css b/src/assets/css/design-system/tokens/surfaces.css new file mode 100644 index 00000000..d19bb207 --- /dev/null +++ b/src/assets/css/design-system/tokens/surfaces.css @@ -0,0 +1,30 @@ +:root { + /* + * Surfaces: the shared look of anything that sits on the page as a panel. + * Cards, terminal windows, badges and buttons all draw from these so they + * read as one family. Values are built from the colour tokens. + */ + + /* Panels */ + --surface-card: rgba(var(--color-navy-rgb), 0.88); + --surface-card-raised: #0d2137; + --surface-inset: rgba(var(--color-primary-rgb), 0.04); + --surface-border: rgba(var(--color-primary-rgb), 0.2); + --surface-border-strong: rgba(var(--color-primary-rgb), 0.5); + --surface-divider: rgba(var(--color-primary-rgb), 0.12); + + /* Shape */ + --radius-card: var(--border-radius-lg); + --radius-control: var(--border-radius-md); + --radius-chip: var(--border-radius-pill); + + /* Elevation and glow */ + --shadow-card: 0 10px 30px rgba(0, 0, 0, 0.35); + --shadow-card-hover: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--surface-border-strong), 0 0 24px rgba(var(--color-primary-rgb), 0.15); + --ring-focus: 0 0 0 3px rgba(var(--color-primary-rgb), 0.45); + + /* Interactive controls */ + --control-height-sm: 2rem; + --control-height: 2.5rem; + --control-padding-x: var(--spacing-4); +} diff --git a/src/assets/css/tailwind.css b/src/assets/css/tailwind.css index 66635c33..5e2d9859 100644 --- a/src/assets/css/tailwind.css +++ b/src/assets/css/tailwind.css @@ -493,7 +493,7 @@ a.btn[aria-disabled="true"] { .project-title::after { @apply content-[''] absolute bottom-0 left-0 w-[50px] h-[3px] rounded-sm; - background-color: var(--color-accent); + background-color: var(--color-primary); } .project-description { @@ -521,11 +521,6 @@ a.btn[aria-disabled="true"] { @apply flex-1 flex items-center justify-center gap-1 transition-all; } -.demo-button { - background-color: var(--color-accent); - @apply text-white; -} - .project-button:hover, .project-button:focus { transform: translateY(-2px); /* was @apply -translate-y-[2px] */ } @@ -613,11 +608,7 @@ a.btn[aria-disabled="true"] { } .skeleton-gradient { - background: linear-gradient(90deg, - rgb(243 244 246) 0%, /* gray-100 */ - rgb(229 231 235) 50%, /* gray-200 */ - rgb(243 244 246) 100% /* gray-100 */ - ); + background: linear-gradient(90deg, rgba(var(--color-primary-rgb), 0.04) 0%, rgba(var(--color-primary-rgb), 0.1) 50%, rgba(var(--color-primary-rgb), 0.04) 100%); background-size: 200% 100%; animation: skeleton-loading 1.5s infinite; } @@ -646,7 +637,7 @@ a.btn[aria-disabled="true"] { .skeleton-image { @apply h-[180px]; - background: linear-gradient(90deg, rgb(243 244 246) 0%, rgb(229 231 235) 50%, rgb(243 244 246) 100%); + background: linear-gradient(90deg, rgba(var(--color-primary-rgb), 0.04) 0%, rgba(var(--color-primary-rgb), 0.1) 50%, rgba(var(--color-primary-rgb), 0.04) 100%); background-size: 200% 100%; animation: skeleton-loading 1.5s infinite; } @@ -657,14 +648,14 @@ a.btn[aria-disabled="true"] { .skeleton-title { @apply h-6 w-[70%] rounded; - background: linear-gradient(90deg, rgb(243 244 246) 0%, rgb(229 231 235) 50%, rgb(243 244 246) 100%); + background: linear-gradient(90deg, rgba(var(--color-primary-rgb), 0.04) 0%, rgba(var(--color-primary-rgb), 0.1) 50%, rgba(var(--color-primary-rgb), 0.04) 100%); background-size: 200% 100%; animation: skeleton-loading 1.5s infinite; } .skeleton-description { @apply h-[60px] rounded; - background: linear-gradient(90deg, rgb(243 244 246) 0%, rgb(229 231 235) 50%, rgb(243 244 246) 100%); + background: linear-gradient(90deg, rgba(var(--color-primary-rgb), 0.04) 0%, rgba(var(--color-primary-rgb), 0.1) 50%, rgba(var(--color-primary-rgb), 0.04) 100%); background-size: 200% 100%; animation: skeleton-loading 1.5s infinite; } @@ -677,7 +668,7 @@ a.btn[aria-disabled="true"] { .skeleton-tags::after { content: ""; @apply h-[26px] w-20 rounded-full; - background: linear-gradient(90deg, rgb(243 244 246) 0%, rgb(229 231 235) 50%, rgb(243 244 246) 100%); + background: linear-gradient(90deg, rgba(var(--color-primary-rgb), 0.04) 0%, rgba(var(--color-primary-rgb), 0.1) 50%, rgba(var(--color-primary-rgb), 0.04) 100%); background-size: 200% 100%; animation: skeleton-loading 1.5s infinite; } @@ -690,11 +681,25 @@ a.btn[aria-disabled="true"] { .skeleton-actions::after { content: ""; @apply h-9 flex-1 rounded; - background: linear-gradient(90deg, rgb(243 244 246) 0%, rgb(229 231 235) 50%, rgb(243 244 246) 100%); + background: linear-gradient(90deg, rgba(var(--color-primary-rgb), 0.04) 0%, rgba(var(--color-primary-rgb), 0.1) 50%, rgba(var(--color-primary-rgb), 0.04) 100%); background-size: 200% 100%; animation: skeleton-loading 1.5s infinite; } +@media (prefers-reduced-motion: reduce) { + .skeleton-gradient, + .skeleton-shimmer, + .skeleton-image, + .skeleton-title, + .skeleton-description, + .skeleton-tags::before, + .skeleton-tags::after, + .skeleton-actions::before, + .skeleton-actions::after { + animation: none; + } +} + /* Experience card skeleton specific styles */ .experience-card-skeleton { @apply h-[450px] bg-background rounded-lg overflow-hidden shadow-sm flex flex-col relative; @@ -704,21 +709,21 @@ a.btn[aria-disabled="true"] { .skeleton-header { @apply h-16 w-full; - background: linear-gradient(90deg, rgb(243 244 246) 0%, rgb(229 231 235) 50%, rgb(243 244 246) 100%); + background: linear-gradient(90deg, rgba(var(--color-primary-rgb), 0.04) 0%, rgba(var(--color-primary-rgb), 0.1) 50%, rgba(var(--color-primary-rgb), 0.04) 100%); background-size: 200% 100%; animation: skeleton-loading 1.5s infinite; } .skeleton-image-circle { @apply h-16 w-16 rounded-full mx-auto mb-4; - background: linear-gradient(90deg, rgb(243 244 246) 0%, rgb(229 231 235) 50%, rgb(243 244 246) 100%); + background: linear-gradient(90deg, rgba(var(--color-primary-rgb), 0.04) 0%, rgba(var(--color-primary-rgb), 0.1) 50%, rgba(var(--color-primary-rgb), 0.04) 100%); background-size: 200% 100%; animation: skeleton-loading 1.5s infinite; } .skeleton-subtitle { @apply h-4 w-2/3 rounded mt-2; - background: linear-gradient(90deg, rgb(243 244 246) 0%, rgb(229 231 235) 50%, rgb(243 244 246) 100%); + background: linear-gradient(90deg, rgba(var(--color-primary-rgb), 0.04) 0%, rgba(var(--color-primary-rgb), 0.1) 50%, rgba(var(--color-primary-rgb), 0.04) 100%); background-size: 200% 100%; animation: skeleton-loading 1.5s infinite; } @@ -732,14 +737,14 @@ a.btn[aria-disabled="true"] { .skeleton-icon { @apply h-12 w-12 rounded-full mb-2; - background: linear-gradient(90deg, rgb(243 244 246) 0%, rgb(229 231 235) 50%, rgb(243 244 246) 100%); + background: linear-gradient(90deg, rgba(var(--color-primary-rgb), 0.04) 0%, rgba(var(--color-primary-rgb), 0.1) 50%, rgba(var(--color-primary-rgb), 0.04) 100%); background-size: 200% 100%; animation: skeleton-loading 1.5s infinite; } .skeleton-name { @apply h-4 w-full rounded; - background: linear-gradient(90deg, rgb(243 244 246) 0%, rgb(229 231 235) 50%, rgb(243 244 246) 100%); + background: linear-gradient(90deg, rgba(var(--color-primary-rgb), 0.04) 0%, rgba(var(--color-primary-rgb), 0.1) 50%, rgba(var(--color-primary-rgb), 0.04) 100%); background-size: 200% 100%; animation: skeleton-loading 1.5s infinite; } diff --git a/src/components/atoms/Button/Button.css b/src/components/atoms/Button/Button.css index 35287313..7f35df1b 100644 --- a/src/components/atoms/Button/Button.css +++ b/src/components/atoms/Button/Button.css @@ -1,611 +1,232 @@ /** - * Button Component - * - * Styles for the Button component following atomic design principles. - * Uses design tokens for consistent styling across the application. - * Updated with improved readability, enhanced cybersecurity theme, and better contrast. + * Button + * + * One button system. Every variant sets the same few custom properties + * (--btn-*) on a shared base, so shape, height, type and focus are identical + * everywhere. Font: JetBrains Mono for all buttons. + * + * Canonical variants: primary, secondary, ghost. + * Status variants (success, danger, warning, info, critical, high, medium, + * low) are outlined and tinted with their level colour. + * Aliases: link -> ghost with underline, cyberpunk -> secondary, + * light/dark -> neutral outline / card surface. */ -.btn { +.btn.btn { + --btn-fg: var(--color-primary); + --btn-bg: transparent; + --btn-border: var(--color-primary); + --btn-fg-hover: var(--btn-fg); + --btn-bg-hover: rgba(var(--color-primary-rgb), 0.1); + --btn-border-hover: var(--btn-border); + display: inline-flex; align-items: center; justify-content: center; + gap: var(--spacing-2); + box-sizing: border-box; + min-height: var(--control-height); + padding: 0 var(--control-padding-x); font-family: var(--font-family-jetbrains); + font-size: var(--font-size-sm); font-weight: var(--font-weight-semibold); - font-size: var(--font-size-base); - line-height: 1.4; + line-height: 1; + letter-spacing: var(--letter-spacing-technical); text-align: center; text-decoration: none; + text-shadow: none; white-space: nowrap; vertical-align: middle; cursor: pointer; user-select: none; - padding: var(--spacing-3) var(--spacing-4); - border: 1px solid transparent; - border-radius: var(--border-radius); - transition: var(--transition-base); position: relative; - overflow: hidden; - letter-spacing: var(--letter-spacing-wide); - min-height: 44px; /* Better touch target */ - box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2); -} - -/* Button variants with improved contrast */ -.btn-primary { - background: linear-gradient( - 135deg, - var(--color-cyan) 0%, - color-mix(in srgb, var(--color-cyan) 90%, var(--color-primary-dark)) 100% - ); - color: var(--color-navy); - border-color: var(--color-cyan); - font-weight: var(--font-weight-bold); - text-shadow: 0 1px 2px rgba(var(--color-navy-rgb), 0.3); - box-shadow: - 0 4px 12px rgba(var(--color-cyan-rgb), 0.3), - 0 2px 4px rgba(0, 0, 0, 0.2); -} - -.btn-primary:hover, .btn-primary:focus { - background: linear-gradient( - 135deg, - color-mix(in srgb, var(--color-cyan) 85%, white) 0%, - var(--color-cyan) 100% - ); - border-color: color-mix(in srgb, var(--color-cyan) 85%, white); - box-shadow: - 0 6px 16px rgba(var(--color-cyan-rgb), 0.4), - 0 0 20px rgba(var(--color-cyan-rgb), 0.2), - 0 4px 8px rgba(0, 0, 0, 0.3); - transform: translateY(-1px); -} - -.btn-secondary { - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.95) 0%, - rgba(var(--color-navy-rgb), 0.9) 100% - ); - color: var(--color-cyan); - border: 1px solid rgba(var(--color-cyan-rgb), 0.6); - font-weight: var(--font-weight-semibold); - backdrop-filter: blur(10px); - box-shadow: - 0 4px 12px rgba(0, 0, 0, 0.3), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.1); -} - -.btn-secondary:hover, .btn-secondary:focus { - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.98) 0%, - rgba(var(--color-navy-rgb), 0.95) 100% - ); - border-color: var(--color-cyan); - color: color-mix(in srgb, var(--color-cyan) 90%, white); - box-shadow: - 0 6px 16px rgba(0, 0, 0, 0.4), - 0 0 20px rgba(var(--color-cyan-rgb), 0.2), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.15); - transform: translateY(-1px); -} - -.btn-success { - background: linear-gradient( - 135deg, - var(--color-level-low) 0%, - color-mix(in srgb, var(--color-level-low) 85%, black) 100% - ); - color: var(--color-white); - border-color: var(--color-level-low); - font-weight: var(--font-weight-semibold); - text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); - box-shadow: - 0 4px 12px rgba(var(--color-level-low-rgb), 0.3), - 0 2px 4px rgba(0, 0, 0, 0.2); -} - -.btn-success:hover, .btn-success:focus { - background: linear-gradient( - 135deg, - color-mix(in srgb, var(--color-level-low) 90%, white) 0%, - var(--color-level-low) 100% - ); - border-color: color-mix(in srgb, var(--color-level-low) 90%, white); - box-shadow: - 0 6px 16px rgba(var(--color-level-low-rgb), 0.4), - 0 0 20px rgba(var(--color-level-low-rgb), 0.2), - 0 4px 8px rgba(0, 0, 0, 0.3); - transform: translateY(-1px); -} - -.btn-danger { - background: linear-gradient( - 135deg, - var(--color-level-critical) 0%, - color-mix(in srgb, var(--color-level-critical) 85%, black) 100% - ); - color: var(--color-white); - border-color: var(--color-level-critical); - font-weight: var(--font-weight-semibold); - text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); - box-shadow: - 0 4px 12px rgba(var(--color-level-critical-rgb), 0.3), - 0 2px 4px rgba(0, 0, 0, 0.2); -} - -.btn-danger:hover, .btn-danger:focus { - background: linear-gradient( - 135deg, - color-mix(in srgb, var(--color-level-critical) 90%, white) 0%, - var(--color-level-critical) 100% - ); - border-color: color-mix(in srgb, var(--color-level-critical) 90%, white); - box-shadow: - 0 6px 16px rgba(var(--color-level-critical-rgb), 0.4), - 0 0 20px rgba(var(--color-level-critical-rgb), 0.2), - 0 4px 8px rgba(0, 0, 0, 0.3); - transform: translateY(-1px); -} - -.btn-warning { - background: linear-gradient( - 135deg, - var(--color-level-medium) 0%, - color-mix(in srgb, var(--color-level-medium) 85%, black) 100% - ); - color: var(--color-navy); - border-color: var(--color-level-medium); - font-weight: var(--font-weight-semibold); - text-shadow: 0 1px 2px rgba(var(--color-navy-rgb), 0.3); - box-shadow: - 0 4px 12px rgba(var(--color-level-medium-rgb), 0.3), - 0 2px 4px rgba(0, 0, 0, 0.2); -} - -.btn-warning:hover, .btn-warning:focus { - background: linear-gradient( - 135deg, - color-mix(in srgb, var(--color-level-medium) 90%, white) 0%, - var(--color-level-medium) 100% - ); - border-color: color-mix(in srgb, var(--color-level-medium) 90%, white); - box-shadow: - 0 6px 16px rgba(var(--color-level-medium-rgb), 0.4), - 0 0 20px rgba(var(--color-level-medium-rgb), 0.2), - 0 4px 8px rgba(0, 0, 0, 0.3); - transform: translateY(-1px); + overflow: visible; + color: var(--btn-fg); + background: var(--btn-bg); + border: 1px solid var(--btn-border); + border-radius: var(--radius-control); + box-shadow: none; + backdrop-filter: none; + transition: + background-color 0.2s ease, + border-color 0.2s ease, + color 0.2s ease, + box-shadow 0.2s ease; +} + +.btn.btn:hover { + color: var(--btn-fg-hover); + background: var(--btn-bg-hover); + border-color: var(--btn-border-hover); + text-shadow: none; + transform: none; } -.btn-info { - background: linear-gradient( - 135deg, - var(--color-level-info) 0%, - color-mix(in srgb, var(--color-level-info) 85%, black) 100% - ); - color: var(--color-white); - border-color: var(--color-level-info); - font-weight: var(--font-weight-semibold); - text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); - box-shadow: - 0 4px 12px rgba(var(--color-level-info-rgb), 0.3), - 0 2px 4px rgba(0, 0, 0, 0.2); +/* Sizes: two heights. "lg" is kept as an alias of the default size. */ +.btn.btn-sm { + min-height: var(--control-height-sm); + padding: 0 var(--spacing-3); + font-size: var(--font-size-xs); + border-radius: var(--radius-control); } -.btn-info:hover, .btn-info:focus { - background: linear-gradient( - 135deg, - color-mix(in srgb, var(--color-level-info) 90%, white) 0%, - var(--color-level-info) 100% - ); - border-color: color-mix(in srgb, var(--color-level-info) 90%, white); - box-shadow: - 0 6px 16px rgba(var(--color-level-info-rgb), 0.4), - 0 0 20px rgba(var(--color-level-info-rgb), 0.2), - 0 4px 8px rgba(0, 0, 0, 0.3); - transform: translateY(-1px); +.btn.btn-lg { + min-height: var(--control-height); + padding: 0 var(--control-padding-x); + font-size: var(--font-size-sm); + border-radius: var(--radius-control); } -/* Security level variants */ -.btn-critical { - background: linear-gradient( - 135deg, - var(--color-level-critical) 0%, - color-mix(in srgb, var(--color-level-critical) 85%, black) 100% - ); - color: var(--color-white); - border-color: var(--color-level-critical); +/* Primary: solid cyan, navy text */ +.btn.btn-primary { + --btn-fg: var(--color-navy); + --btn-bg: var(--color-primary); + --btn-border: var(--color-primary); + --btn-bg-hover: var(--color-primary-light); + --btn-border-hover: var(--color-primary-light); font-weight: var(--font-weight-bold); - text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); } -.btn-critical:hover, .btn-critical:focus { - background: linear-gradient( - 135deg, - color-mix(in srgb, var(--color-level-critical) 90%, white) 0%, - var(--color-level-critical) 100% - ); - border-color: color-mix(in srgb, var(--color-level-critical) 90%, white); - box-shadow: - 0 6px 16px rgba(var(--color-level-critical-rgb), 0.4), - 0 0 20px rgba(var(--color-level-critical-rgb), 0.3); - transform: translateY(-1px); +.btn.btn-primary:hover { + box-shadow: 0 0 0 1px var(--color-primary-light), 0 6px 18px rgba(var(--color-primary-rgb), 0.25); } -.btn-high { - background: linear-gradient( - 135deg, - var(--color-level-high) 0%, - color-mix(in srgb, var(--color-level-high) 85%, black) 100% - ); - color: var(--color-white); - border-color: var(--color-level-high); - font-weight: var(--font-weight-semibold); - text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); -} - -.btn-high:hover, .btn-high:focus { - background: linear-gradient( - 135deg, - color-mix(in srgb, var(--color-level-high) 90%, white) 0%, - var(--color-level-high) 100% - ); - border-color: color-mix(in srgb, var(--color-level-high) 90%, white); - box-shadow: - 0 6px 16px rgba(var(--color-level-high-rgb), 0.4), - 0 0 20px rgba(var(--color-level-high-rgb), 0.2); - transform: translateY(-1px); -} - -.btn-medium { - background: linear-gradient( - 135deg, - var(--color-level-medium) 0%, - color-mix(in srgb, var(--color-level-medium) 85%, black) 100% - ); - color: var(--color-navy); - border-color: var(--color-level-medium); - font-weight: var(--font-weight-semibold); - text-shadow: 0 1px 2px rgba(var(--color-navy-rgb), 0.3); +/* Secondary: outlined cyan on transparent, cyan text. The cyberpunk + variant is kept as an alias. */ +.btn.btn-secondary, +.btn.btn-cyberpunk { + --btn-fg: var(--color-primary); + --btn-bg: transparent; + --btn-border: var(--surface-border-strong); + --btn-border-hover: var(--color-primary); } -.btn-medium:hover, .btn-medium:focus { - background: linear-gradient( - 135deg, - color-mix(in srgb, var(--color-level-medium) 90%, white) 0%, - var(--color-level-medium) 100% - ); - border-color: color-mix(in srgb, var(--color-level-medium) 90%, white); - box-shadow: - 0 6px 16px rgba(var(--color-level-medium-rgb), 0.4), - 0 0 20px rgba(var(--color-level-medium-rgb), 0.2); - transform: translateY(-1px); +/* Ghost: low emphasis. The link variant is kept as an alias. */ +.btn.btn-ghost, +.btn.btn-link { + --btn-fg: var(--color-text-muted); + --btn-bg: transparent; + --btn-border: transparent; + --btn-fg-hover: var(--color-primary); + --btn-bg-hover: var(--surface-inset); + --btn-border-hover: transparent; } -.btn-low { - background: linear-gradient( - 135deg, - var(--color-level-low) 0%, - color-mix(in srgb, var(--color-level-low) 85%, black) 100% - ); - color: var(--color-white); - border-color: var(--color-level-low); - font-weight: var(--font-weight-semibold); - text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); +.btn.btn-link { + --btn-fg: var(--color-primary); + min-height: auto; + padding: var(--spacing-1) 0; + --btn-bg-hover: transparent; } -.btn-low:hover, .btn-low:focus { - background: linear-gradient( - 135deg, - color-mix(in srgb, var(--color-level-low) 90%, white) 0%, - var(--color-level-low) 100% - ); - border-color: color-mix(in srgb, var(--color-level-low) 90%, white); - box-shadow: - 0 6px 16px rgba(var(--color-level-low-rgb), 0.4), - 0 0 20px rgba(var(--color-level-low-rgb), 0.2); - transform: translateY(-1px); +.btn.btn-link:hover { + text-decoration: underline; + text-underline-offset: 0.2em; } -.btn-light { - background: linear-gradient( - 135deg, - var(--color-offwhite) 0%, - color-mix(in srgb, var(--color-offwhite) 95%, var(--color-gray-200)) 100% - ); - color: var(--color-navy); - border-color: rgba(var(--color-navy-rgb), 0.2); - font-weight: var(--font-weight-semibold); - text-shadow: 0 1px 1px rgba(255, 255, 255, 0.5); +/* Status variants: outlined, tinted with the level colour */ +.btn.btn-success, +.btn.btn-low { + --tone: var(--color-level-low); + --tone-rgb: var(--color-level-low-rgb); } -.btn-light:hover, .btn-light:focus { - background: linear-gradient( - 135deg, - color-mix(in srgb, var(--color-offwhite) 95%, white) 0%, - var(--color-offwhite) 100% - ); - border-color: rgba(var(--color-navy-rgb), 0.3); - box-shadow: - 0 6px 16px rgba(var(--color-navy-rgb), 0.15), - 0 2px 8px rgba(0, 0, 0, 0.1); - transform: translateY(-1px); +.btn.btn-danger, +.btn.btn-critical { + --tone: var(--color-level-critical); + --tone-rgb: var(--color-level-critical-rgb); } -.btn-dark { - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.98) 0%, - rgba(var(--color-navy-rgb), 0.95) 100% - ); - color: var(--color-offwhite); - border: 1px solid rgba(var(--color-offwhite-rgb), 0.3); - font-weight: var(--font-weight-semibold); - backdrop-filter: blur(10px); +.btn.btn-warning, +.btn.btn-medium { + --tone: var(--color-level-medium); + --tone-rgb: var(--color-level-medium-rgb); } -.btn-dark:hover, .btn-dark:focus { - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 1) 0%, - rgba(var(--color-navy-rgb), 0.98) 100% - ); - border-color: rgba(var(--color-offwhite-rgb), 0.5); - color: var(--color-offwhite); - box-shadow: - 0 6px 16px rgba(0, 0, 0, 0.4), - 0 0 20px rgba(var(--color-offwhite-rgb), 0.1); - transform: translateY(-1px); +.btn.btn-high { + --tone: var(--color-level-high); + --tone-rgb: var(--color-level-high-rgb); } -.btn-link { - background-color: transparent; - color: var(--color-cyan); - border-color: transparent; - text-decoration: none; - padding-left: 0; - padding-right: 0; - font-weight: var(--font-weight-medium); - box-shadow: none; +.btn.btn-info { + --tone: var(--color-level-info); + --tone-rgb: var(--color-level-info-rgb); } -.btn-link:hover, .btn-link:focus { - color: color-mix(in srgb, var(--color-cyan) 85%, white); - text-decoration: underline; - text-shadow: 0 0 8px rgba(var(--color-cyan-rgb), 0.6); - box-shadow: none; - transform: none; +.btn.btn-success, +.btn.btn-low, +.btn.btn-danger, +.btn.btn-critical, +.btn.btn-warning, +.btn.btn-medium, +.btn.btn-high, +.btn.btn-info { + --btn-fg: var(--tone); + --btn-bg: rgba(var(--tone-rgb), 0.08); + --btn-border: rgba(var(--tone-rgb), 0.55); + --btn-bg-hover: rgba(var(--tone-rgb), 0.16); + --btn-border-hover: var(--tone); } -/* Button sizes with improved touch targets */ -.btn-sm { - padding: var(--spacing-2) var(--spacing-3); - font-size: var(--font-size-sm); - border-radius: calc(var(--border-radius) * 0.8); - min-height: 36px; +/* Neutral variants kept for compatibility, dark surfaces only */ +.btn.btn-light { + --btn-fg: var(--color-offwhite); + --btn-bg: transparent; + --btn-border: rgba(var(--color-offwhite-rgb), 0.4); + --btn-bg-hover: rgba(var(--color-offwhite-rgb), 0.08); + --btn-border-hover: rgba(var(--color-offwhite-rgb), 0.7); } -.btn-lg { - padding: var(--spacing-4) var(--spacing-6); - font-size: var(--font-size-lg); - border-radius: calc(var(--border-radius) * 1.2); - min-height: 52px; - font-weight: var(--font-weight-bold); +.btn.btn-dark { + --btn-fg: var(--color-offwhite); + --btn-bg: var(--surface-card-raised); + --btn-border: var(--surface-border); + --btn-bg-hover: var(--surface-card-raised); + --btn-border-hover: var(--surface-border-strong); } -/* Icon button with better proportions */ -.btn-icon { - padding: var(--spacing-2); +/* Icon slot */ +.btn-icon-left, +.btn-icon-right { display: inline-flex; align-items: center; - justify-content: center; - width: 44px; - height: 44px; - border-radius: var(--border-radius-circle); + font-size: 1.1em; } -.btn-icon.btn-sm { - width: 36px; - height: 36px; +/* Icon-only button: a square control, same radius as the rest */ +.btn.btn-icon { + width: var(--control-height); + min-width: var(--control-height); + padding: 0; } -.btn-icon.btn-lg { - width: 52px; - height: 52px; +.btn.btn-icon.btn-sm { + width: var(--control-height-sm); + min-width: var(--control-height-sm); } -/* Icon positioning with better spacing */ -.btn-icon-left { - margin-right: var(--spacing-2); - display: inline-flex; - align-items: center; +/* Focus */ +.btn.btn:focus-visible { + outline: none; + box-shadow: var(--ring-focus); } -.btn-icon-right { - margin-left: var(--spacing-2); - display: inline-flex; - align-items: center; +.btn.btn:active { + transform: none; + box-shadow: none; } -/* Disabled state with better contrast */ -.btn.disabled, -.btn:disabled, -a.btn[aria-disabled="true"] { - opacity: 0.5; +/* Disabled: dimmed, same shape */ +.btn.btn.disabled, +.btn.btn:disabled, +a.btn.btn[aria-disabled="true"] { + opacity: 0.45; pointer-events: none; box-shadow: none; - background: rgba(var(--color-gray-600-rgb, 108, 117, 125), 0.3) !important; - color: rgba(var(--color-gray-400-rgb, 206, 212, 218), 0.8) !important; - border-color: rgba(var(--color-gray-600-rgb, 108, 117, 125), 0.3) !important; -} - -/* Focus styles with better visibility */ -.btn:focus { - outline: 0; - box-shadow: - 0 0 0 3px rgba(var(--color-cyan-rgb), 0.4), - 0 4px 12px rgba(0, 0, 0, 0.2); -} - -/* Active state */ -.btn:active { - transform: translateY(1px); - box-shadow: - 0 2px 8px rgba(0, 0, 0, 0.3), - inset 0 1px 2px rgba(0, 0, 0, 0.2); -} - -/* Accessibility: Focus visible */ -.btn:focus-visible { - outline: 2px solid var(--color-cyan); - outline-offset: 2px; -} - -/* Enhanced Cyberpunk variant with improved readability */ -.btn-cyberpunk { - position: relative; - overflow: hidden; - transition: all 0.4s ease; - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.95) 0%, - rgba(var(--color-navy-rgb), 0.9) 50%, - rgba(var(--color-navy-rgb), 0.95) 100% - ); - border: 1px solid rgba(var(--color-cyan-rgb), 0.4); - color: var(--color-cyan); - font-weight: var(--font-weight-semibold); - backdrop-filter: blur(10px); - box-shadow: - 0 4px 15px rgba(0, 0, 0, 0.3), - 0 0 20px rgba(var(--color-cyan-rgb), 0.1), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.1); -} - -/* Subtle border glow effect */ -.btn-cyberpunk::before { - content: ''; - position: absolute; - inset: -1px; - background: linear-gradient( - 90deg, - transparent, - rgba(var(--color-cyan-rgb), 0.3), - transparent - ); - opacity: 0; - transition: opacity 0.4s ease, transform 0.6s ease; - transform: translateX(-100%); - z-index: 0; -} - -/* Inner highlight */ -.btn-cyberpunk::after { - content: ''; - position: absolute; - inset: 1px; - background: repeating-linear-gradient( - to bottom, - transparent, - transparent 49%, - rgba(var(--color-cyan-rgb), 0.03) 50%, - transparent 51% - ); - background-size: 100% 4px; - opacity: 0; - transition: opacity 0.4s ease; - animation: subtle-scan 8s linear infinite; - z-index: 0; -} - -/* Hover states */ -.btn-cyberpunk:hover { - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.98) 0%, - rgba(var(--color-navy-rgb), 0.95) 50%, - rgba(var(--color-navy-rgb), 0.98) 100% - ); - border-color: rgba(var(--color-cyan-rgb), 0.6); - color: color-mix(in srgb, var(--color-cyan) 90%, white); - box-shadow: - 0 6px 20px rgba(0, 0, 0, 0.4), - 0 0 30px rgba(var(--color-cyan-rgb), 0.2), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.15); - transform: translateY(-1px); } -.btn-cyberpunk:hover::before, -.btn-cyberpunk:hover::after { - opacity: 1; -} - -.btn-cyberpunk:hover::before { - transform: translateX(100%); - animation: subtle-highlight 3s ease infinite; -} - -/* Enhanced text glow on hover */ -.btn-cyberpunk:hover span { - text-shadow: 0 0 12px rgba(var(--color-cyan-rgb), 0.6); - transition: text-shadow 0.4s ease; - position: relative; - z-index: 1; -} - -/* Animations */ -@keyframes subtle-scan { - from { - background-position: 0 0; - } - to { - background-position: 0 100%; - } -} - -@keyframes subtle-highlight { - 0% { - opacity: 0; - transform: translateX(-100%); - } - 20% { - opacity: 0.6; - } - 50% { - opacity: 0.3; - } - 100% { - opacity: 0; - transform: translateX(100%); - } -} - -/* Accessibility - Reduced motion */ -@media (prefers-reduced-motion: reduce) { - .btn-cyberpunk::after, - .btn-cyberpunk:hover::before { - animation: none; - } - - .btn:hover, - .btn:focus { - transform: none; - } - - .btn:active { - transform: none; - } -} - -/* High contrast mode support */ -@media (prefers-contrast: high) { - .btn { +@media (prefers-contrast: more) { + .btn.btn { border-width: 2px; } - - .btn:focus { - outline: 3px solid; - outline-offset: 2px; - } -} \ No newline at end of file +} diff --git a/src/components/atoms/Button/Button.stories.tsx b/src/components/atoms/Button/Button.stories.tsx index 46c9cfd0..03bb2c98 100644 --- a/src/components/atoms/Button/Button.stories.tsx +++ b/src/components/atoms/Button/Button.stories.tsx @@ -1,5 +1,6 @@ -import type { ReactNode } from 'react'; +import type { CSSProperties, ReactNode } from 'react'; import type { Meta, StoryObj } from '@storybook/react-vite'; +import { expect } from 'storybook/test'; import Button from './Button'; const meta = { @@ -7,17 +8,17 @@ const meta = { component: Button, tags: ['autodocs'], parameters: { - componentSubtitle: 'Interactive button component with cyberpunk-inspired design', + componentSubtitle: 'One button system: primary, secondary and ghost, in two sizes', docs: { description: { - component: 'The Button component provides a versatile, accessible interface element with multiple variants, sizes, and states. It features cyberpunk-inspired styling, icon support, and security-themed variants. The component supports both button and anchor tag rendering, with full keyboard navigation and ARIA support.' + component: 'Three canonical variants (primary: solid cyan; secondary: outlined cyan; ghost: low emphasis), two heights (sm 2rem, md 2.5rem), one radius, JetBrains Mono type and a shared focus ring. Status variants (success, danger, warning, info, critical, high, medium, low) are outlined tints; link, cyberpunk, light and dark are kept as aliases. Renders a button, or an anchor when href is given.' } } }, argTypes: { variant: { control: 'select', - options: ['primary', 'secondary', 'success', 'danger', 'warning', 'info', 'light', 'dark', 'link', 'critical', 'high', 'medium', 'low', 'cyberpunk'], + options: ['primary', 'secondary', 'ghost', 'success', 'danger', 'warning', 'info', 'light', 'dark', 'link', 'critical', 'high', 'medium', 'low', 'cyberpunk'], description: 'Visual style variant of the button', table: { type: { summary: 'string' }, @@ -27,7 +28,7 @@ const meta = { size: { control: 'select', options: ['sm', 'md', 'lg'], - description: 'Size of the button', + description: 'Size of the button (lg is an alias of md)', table: { type: { summary: 'string' }, defaultValue: { summary: 'md' } @@ -93,210 +94,168 @@ const meta = { export default meta; type Story = StoryObj; -// Container for consistent display -const ButtonContainer = ({ children, background = 'var(--color-background)' }: { children: ReactNode; background?: string }) => ( -
+const Stack = ({ children, column = false }: { children: ReactNode; column?: boolean }) => ( +
{children}
); +const label: CSSProperties = { + margin: '0 0 0.5rem', + fontFamily: 'var(--font-family-jetbrains)', + fontSize: 'var(--font-size-xs)', + letterSpacing: 'var(--letter-spacing-technical)', + textTransform: 'uppercase', + color: 'var(--color-text-muted)', +}; + // Default button export const Default: Story = { args: { - children: 'Button', + children: 'View project', variant: 'primary', - size: 'md' + size: 'md', + icon: 'mdi:arrow-right', + iconPosition: 'right', }, - render: (args) => ( - - - - - - - - - - +
+ {(['md', 'sm'] as const).map((size) => ( +
+

{size === 'md' ? 'Default (2.5rem)' : 'Small (2rem)'}

+ + + + + + +
+ ))} +
+

Status (outlined tints)

+ + + + + + + + + + +
+
+

Aliases (map onto the set above)

+ + + + + +
- - ) +
+ ), +}; + +// States side by side. Hover and focus are forced with data-state styles via +// inline equivalents so they can be seen without interacting. +const hoverStyle = (variant: 'primary' | 'secondary' | 'ghost'): CSSProperties => { + if (variant === 'primary') return { background: 'var(--color-primary-light)', borderColor: 'var(--color-primary-light)' }; + if (variant === 'secondary') return { background: 'rgba(var(--color-primary-rgb), 0.1)', borderColor: 'var(--color-primary)' }; + return { background: 'var(--surface-inset)', color: 'var(--color-primary)' }; }; -// Security Variants -export const SecurityVariants: Story = { +export const States: Story = { render: () => ( - -
- - - - - -
-
- ) +
+ {(['primary', 'secondary', 'ghost'] as const).map((variant) => ( +
+

{variant}

+ + + + + + +
+ ))} +

+ Hover and Focus are drawn statically here; press Tab to see the real focus ring. +

+
+ ), }; -// Button Sizes +// Sizes export const Sizes: Story = { render: () => ( - -
- - - -
-
- ) + + + + + ), }; // Icons export const WithIcons: Story = { render: () => ( - -
- - -
-
- ) -}; - -// States -export const States: Story = { - render: () => ( - -
- - - - - -
-
- ) + + + + - - - -
- - ) + + + + + + + ), }; -// Form Buttons +// Form buttons export const FormButtons: Story = { render: () => ( - -
e.preventDefault()} style={{ display: 'flex', gap: '1rem' }}> - + e.preventDefault()}> + + - - -
- ) + + + + ), }; -// Loading States -export const LoadingStates: Story = { - render: () => ( - -
- - - -
-
- ) +// Keyboard focus: tab to the button to see the ring +export const KeyboardFocus: Story = { + render: () => , + play: async ({ canvasElement }) => { + const button = canvasElement.querySelector('button'); + button?.focus(); + await expect(button).toHaveFocus(); + }, }; -// Responsive Example -export const Responsive: Story = { +// Responsive: full-width stack on a narrow column +export const Narrow: Story = { render: () => ( -
-
-

Desktop View

- -
- - -
-
-
-
-

Mobile View

- -
- - -
-
-
+
+ +
- ) -}; - -// Accessibility Example -export const Accessibility: Story = { - render: () => ( - -
- - -
-
- ) + ), }; diff --git a/src/components/atoms/Button/Button.tsx b/src/components/atoms/Button/Button.tsx index cc915ac5..657ef36a 100644 --- a/src/components/atoms/Button/Button.tsx +++ b/src/components/atoms/Button/Button.tsx @@ -7,6 +7,7 @@ import './Button.css'; export type ButtonVariant = | 'primary' | 'secondary' + | 'ghost' | 'success' | 'danger' | 'warning' @@ -64,8 +65,8 @@ export interface ButtonProps * @param {Object} props - The component props * @param {ReactNode} props.children - The button content * @param {Function} [props.onClick] - Click handler function - * @param {string} [props.variant='primary'] - Button style variant (primary, secondary, success, danger, link) - * @param {string} [props.size='md'] - Button size (sm, md, lg) + * @param {string} [props.variant='primary'] - Button style variant (primary, secondary, ghost; status and legacy aliases map onto them) + * @param {string} [props.size='md'] - Button size (sm, md; lg is an alias of md) * @param {string} [props.className] - Additional CSS classes * @param {string} [props.href] - URL to navigate to (renders as anchor when provided) * @param {string} [props.icon] - Iconify icon name (e.g. 'mdi:home') @@ -114,13 +115,12 @@ const Button = ({ sizeClass, className, icon && !children ? 'btn-icon' : '', - disabled ? 'disabled' : '', - variant === 'cyberpunk' ? 'group' : '' + disabled ? 'disabled' : '' ].filter(Boolean).join(' '); - // Icon element with potential pulse animation for cyberpunk variant + // Icon slot const iconElement = icon && ( - + ); @@ -137,24 +137,6 @@ const Button = ({ transition: { duration: 0.1 } }; - // Cyberpunk-specific animations - if (variant === 'cyberpunk') { - return { - initial: { opacity: 0, scale: 0.9 }, - animate: { - opacity: 1, - scale: 1, - transition: { duration: 0.4 } - }, - whileHover: { - scale: 1.05, - boxShadow: "0 0 8px rgba(5, 213, 250, 0.5)", - transition: { duration: 0.2 } - }, - whileTap: tapAnimation - }; - } - // Standard animation variants switch (animationVariant) { case 'hover': @@ -174,20 +156,6 @@ const Button = ({ } }; - // Cyberpunk glint effect - const GlintEffect = variant === 'cyberpunk' && ( - - ); - // Common props const commonProps = { className: baseClasses, @@ -197,17 +165,7 @@ const Button = ({ ...rest }; - // Wrap children for cyberpunk variant - const wrappedChildren = variant === 'cyberpunk' ? ( - <> - - {iconPosition === 'left' && iconElement} - {children} - {iconPosition === 'right' && iconElement} - - {GlintEffect} - - ) : ( + const content = ( <> {iconPosition === 'left' && iconElement} {children} @@ -225,7 +183,7 @@ const Button = ({ tabIndex={disabled ? -1 : 0} {...commonProps} > - {wrappedChildren} + {content} ); } @@ -238,7 +196,7 @@ const Button = ({ disabled={disabled} {...commonProps} > - {wrappedChildren} + {content} ); }; diff --git a/src/components/atoms/Card/Card.css b/src/components/atoms/Card/Card.css index 7029ded2..c465ad1c 100644 --- a/src/components/atoms/Card/Card.css +++ b/src/components/atoms/Card/Card.css @@ -1,10 +1,9 @@ /** - * Card Component - * - * Styles for the Card component following atomic design principles. - * Uses design tokens for consistent styling across the application. - * Updated with improved readability, security-themed variants, and darker blue contained styling. - * Animations now handled by framer-motion. + * Card + * + * The shared card surface: --surface-card fill, 1px --surface-border, + * --radius-card, --shadow-card. Hoverable cards lift to --shadow-card-hover. + * Variants only change the header treatment, never the surface. */ .card { @@ -13,282 +12,115 @@ flex-direction: column; min-width: 0; word-wrap: break-word; - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.95) 0%, - rgba(var(--color-navy-rgb), 0.9) 50%, - rgba(var(--color-navy-rgb), 0.95) 100% - ); - backdrop-filter: blur(10px); - background-clip: border-box; - border-radius: var(--border-radius); + background: var(--surface-card); + border: 1px solid transparent; + border-radius: var(--radius-card); + box-shadow: var(--shadow-card); overflow: hidden; - transition: var(--transition-base); - border: 1px solid rgba(var(--color-cyan-rgb), 0.2); - box-shadow: - 0 4px 20px rgba(0, 0, 0, 0.3), - 0 0 15px rgba(var(--color-cyan-rgb), 0.08), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.08); + transition: box-shadow 0.2s ease, border-color 0.2s ease, translate 0.2s ease; } -/* Security-themed Card */ -.card-security { - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.98) 0%, - rgba(var(--color-navy-rgb), 0.95) 50%, - rgba(var(--color-navy-rgb), 0.98) 100% - ); - color: var(--color-offwhite); - border: 1px solid rgba(var(--color-cyan-rgb), 0.4); - border-left: 3px solid var(--color-cyan); - box-shadow: - 0 6px 25px rgba(0, 0, 0, 0.4), - 0 0 20px rgba(var(--color-cyan-rgb), 0.12), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.1); -} - -/* Card with border */ +/* Border is on by default through the bordered prop */ .card-bordered { - border: var(--border-width-thin) solid rgba(var(--color-cyan-rgb), 0.3); -} - -/* Security-themed bordered card */ -.card-security.card-bordered { - border: var(--border-width-thin) solid rgba(var(--color-cyan-rgb), 0.5); + border-color: var(--surface-border); } -/* Card with shadow */ +/* The shadow is part of the base surface; the prop is kept for compatibility */ .card-shadow { - box-shadow: - 0 8px 30px rgba(0, 0, 0, 0.4), - 0 0 20px rgba(var(--color-cyan-rgb), 0.1), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.08); + box-shadow: var(--shadow-card); } -/* Security-themed shadow card */ -.card-security.card-shadow { - box-shadow: - 0 10px 35px rgba(0, 0, 0, 0.5), - 0 0 25px rgba(var(--color-cyan-rgb), 0.15), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.12); +/* Hoverable: lift (translate is independent of motion's transform) */ +.card-hoverable:hover, +.card-hoverable:focus-within { + translate: 0 -2px; + border-color: var(--surface-border-strong); + box-shadow: var(--shadow-card-hover); } -/* Hoverable card - transition handled by framer-motion */ -.card-hoverable:hover { - transform: translateY(-5px); - border-color: rgba(var(--color-cyan-rgb), 0.4); - box-shadow: - 0 12px 40px rgba(0, 0, 0, 0.4), - 0 0 30px rgba(var(--color-cyan-rgb), 0.15), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.12); +.card:focus-visible { + outline: none; + box-shadow: var(--ring-focus), var(--shadow-card); } -/* Security-themed hoverable card */ -.card-security.card-hoverable:hover { - transform: translateY(-5px); - border-color: rgba(var(--color-cyan-rgb), 0.6); - border-left-color: var(--color-primary); - box-shadow: - 0 15px 45px rgba(0, 0, 0, 0.5), - 0 0 35px rgba(var(--color-cyan-rgb), 0.2), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.15); -} - -/* Card header */ +/* Header, body, footer */ .card-header { padding: var(--spacing-4) var(--spacing-4) var(--spacing-3); - margin-bottom: 0; - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.98) 0%, - rgba(var(--color-navy-rgb), 0.95) 100% - ); - border-bottom: 1px solid rgba(var(--color-cyan-rgb), 0.15); -} - -/* Security-themed card header */ -.card-security .card-header { - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 1) 0%, - rgba(var(--color-navy-rgb), 0.98) 100% - ); - border-bottom: 1px solid rgba(var(--color-cyan-rgb), 0.25); - font-family: var(--font-family-jetbrains); - letter-spacing: var(--letter-spacing-technical); + border-bottom: 1px solid var(--surface-divider); } -/* Card body */ .card-body { flex: 1 1 auto; padding: var(--spacing-4); - background: transparent; } -/* Security-themed card body */ -.card-security .card-body { - background: transparent; -} - -/* Card footer */ .card-footer { - padding: var(--spacing-3) var(--spacing-4) var(--spacing-4); - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.95) 0%, - rgba(var(--color-navy-rgb), 0.92) 100% - ); - border-top: 1px solid rgba(var(--color-cyan-rgb), 0.15); -} - -/* Security-themed card footer */ -.card-security .card-footer { - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.98) 0%, - rgba(var(--color-navy-rgb), 0.95) 100% - ); - border-top: 1px solid rgba(var(--color-cyan-rgb), 0.25); + padding: var(--spacing-3) var(--spacing-4); + border-top: 1px solid var(--surface-divider); + background: var(--surface-inset); } -/* Card title - improved readability */ .card-title { - margin-top: 0; - margin-bottom: var(--spacing-3); + margin: 0; + font-family: var(--font-family-base); font-size: var(--font-size-lg); - font-weight: var(--font-weight-bold); - color: var(--color-offwhite); + font-weight: var(--font-weight-semibold); + color: var(--color-text); line-height: var(--line-height-tight); - text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3); } -/* Security-themed card title */ -.card-security .card-title { - color: var(--color-cyan); - font-family: var(--font-family-jetbrains); - letter-spacing: var(--letter-spacing-technical); - text-shadow: 0 0 8px rgba(var(--color-cyan-rgb), 0.4); -} - -/* Card subtitle - improved readability */ .card-subtitle { - margin-top: calc(-1 * var(--spacing-1)); - margin-bottom: var(--spacing-3); - font-size: var(--font-size-base); - color: rgba(var(--color-offwhite-rgb), 0.8); + margin-top: var(--spacing-1); + font-size: var(--font-size-sm); + color: var(--color-text-muted); line-height: var(--line-height-md); - font-weight: var(--font-weight-medium); } -/* Security-themed card subtitle */ -.card-security .card-subtitle { - color: rgba(var(--color-offwhite-rgb), 0.85); - opacity: 1; -} - -/* Media in cards */ -.card img { - width: 100%; - height: auto; - object-fit: cover; -} - -/* Card link styling - improved contrast */ -/* A legacy global .btn-primary rule sets white text, which is unreadable on - the cyan button background. */ -.card a.btn-primary { - color: var(--color-navy); -} - -/* Buttons rendered as links keep their own colours */ -.card a:not(.btn) { - color: var(--color-cyan); - text-decoration: none; - font-weight: var(--font-weight-medium); - transition: all 0.2s ease; -} - -.card a:not(.btn):hover { - color: color-mix(in srgb, var(--color-cyan) 85%, white); - text-decoration: underline; - text-shadow: 0 0 5px rgba(var(--color-cyan-rgb), 0.5); -} - -/* Security-themed card links */ -.card-security a { - color: var(--color-cyan); - text-decoration: none; - font-weight: var(--font-weight-medium); +/* Security variant: cyan accent edge and a mono kicker-style title */ +.card-security { + border-left: 3px solid var(--color-primary); } -.card-security a:hover { - color: color-mix(in srgb, var(--color-cyan) 85%, white); - text-decoration: underline; - text-shadow: 0 0 8px rgba(var(--color-cyan-rgb), 0.6); +.card-security .card-title { + font-family: var(--font-family-jetbrains); + font-size: var(--font-size-base); + letter-spacing: var(--letter-spacing-technical); + color: var(--color-primary); } -/* Terminal-style security card */ +/* Terminal variant: mono text, inset header strip */ .card-terminal { - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.98) 0%, - rgba(var(--color-navy-rgb), 0.95) 50%, - rgba(var(--color-navy-rgb), 0.98) 100% - ); - color: var(--color-offwhite); font-family: var(--font-family-jetbrains); letter-spacing: var(--letter-spacing-technical); - border: 1px solid rgba(var(--color-cyan-rgb), 0.4); - border-radius: 6px; - box-shadow: - 0 6px 25px rgba(0, 0, 0, 0.4), - 0 0 20px rgba(var(--color-cyan-rgb), 0.1), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.1); } .card-terminal .card-header { - background: rgba(var(--color-cyan-rgb), 0.1); - color: var(--color-cyan); - border-bottom: 1px solid rgba(var(--color-cyan-rgb), 0.3); - padding: var(--spacing-3) var(--spacing-4); - font-weight: var(--font-weight-bold); + background: var(--surface-inset); + color: var(--color-primary); font-size: var(--font-size-sm); } -.card-terminal .card-body { - background: transparent; - padding: var(--spacing-4); - color: rgba(var(--color-offwhite-rgb), 0.95); -} - -.card-terminal .card-footer { - background: rgba(var(--color-navy-rgb), 0.95); - border-top: 1px solid rgba(var(--color-cyan-rgb), 0.25); +.card-terminal .card-title { font-family: var(--font-family-jetbrains); + font-size: var(--font-size-sm); + color: var(--color-primary); } -/* Accessibility: Focus outline */ -.card:focus-within { - outline: 2px solid var(--color-cyan); - outline-offset: 2px; -} - -/* Security-themed focus outline */ -.card-security:focus-within { - outline: 2px solid var(--color-cyan); - outline-offset: 2px; +/* Content */ +.card img { + width: 100%; + height: auto; + object-fit: cover; } -/* Text content styling for better readability */ .card p { + margin: 0 0 var(--spacing-3); color: rgba(var(--color-offwhite-rgb), 0.9); line-height: var(--line-height-base); - margin-bottom: var(--spacing-3); } -.card-security p { - color: rgba(var(--color-offwhite-rgb), 0.95); +.card p:last-child { + margin-bottom: 0; } .card ul, @@ -297,17 +129,30 @@ line-height: var(--line-height-base); } -.card-security ul, -.card-security ol { - color: rgba(var(--color-offwhite-rgb), 0.95); -} - -/* Small text improvements */ .card small { - color: rgba(var(--color-offwhite-rgb), 0.75); + color: var(--color-text-muted); font-size: var(--font-size-sm); } -.card-security small { - color: rgba(var(--color-offwhite-rgb), 0.8); -} \ No newline at end of file +/* Plain links inside a card; buttons keep their own colours */ +.card a:not(.btn) { + color: var(--color-primary); + text-decoration: none; + font-weight: var(--font-weight-medium); +} + +.card a:not(.btn):hover { + text-decoration: underline; + text-underline-offset: 0.2em; +} + +@media (prefers-reduced-motion: reduce) { + .card { + transition: none; + } + + .card-hoverable:hover, + .card-hoverable:focus-within { + translate: none; + } +} diff --git a/src/components/atoms/Card/Card.stories.tsx b/src/components/atoms/Card/Card.stories.tsx index 19960165..6f717a8b 100644 --- a/src/components/atoms/Card/Card.stories.tsx +++ b/src/components/atoms/Card/Card.stories.tsx @@ -8,10 +8,10 @@ const meta = { component: Card, tags: ['autodocs'], parameters: { - componentSubtitle: 'Versatile container component with cyberpunk-inspired themes', + componentSubtitle: 'The shared card surface', docs: { description: { - component: 'The Card component provides a flexible container for content with cyberpunk and security-themed styling options. It supports headers, footers, hover effects, shadows, and animations. The component is fully accessible and responsive, with support for custom content, interactive elements, and decorative variants.' + component: 'The card surface used across the site: --surface-card fill, 1px --surface-border, --radius-card and --shadow-card. Hoverable cards lift to --shadow-card-hover. The security and terminal variants only change the header treatment.' } } }, @@ -104,13 +104,8 @@ export default meta; type Story = StoryObj; // Container for consistent display -const CardContainer = ({ children, background = 'var(--color-background)' }: { children: ReactNode; background?: string }) => ( -
+const CardContainer = ({ children }: { children: ReactNode }) => ( +
{children}
); @@ -118,17 +113,17 @@ const CardContainer = ({ children, background = 'var(--color-background)' }: { c // Default card export const Default: Story = { args: { - title: 'Card Title', - subtitle: 'Card Subtitle', + title: 'Cluster status', + subtitle: 'ChelonianLabs homelab', bordered: true, shadow: false, - hoverable: false + hoverable: true }, render: (args) => (
-

This is the content of the card. You can add any elements or components here.

+

Three Talos control-plane nodes and four workers, reconciled from Git by Flux.

@@ -150,11 +145,11 @@ export const Variants: Story = {

Security

-

Security-themed card with enhanced visual effects.

+

Security variant: same surface with a cyan accent edge.

@@ -297,14 +292,14 @@ export const Layouts: Story = { gridTemplateColumns: 'repeat(auto-fit, minmax(250px, 1fr))', gap: '1rem' }}> - -

Grid item 1

+ +

Alerting that routes to the right person.

- -

Grid item 2

+ +

Runbooks that are tested, not just written.

- -

Grid item 3

+ +

Backups restored on a schedule.

diff --git a/src/components/atoms/CodeSnippet/CodeSnippet.css b/src/components/atoms/CodeSnippet/CodeSnippet.css index 03f0636f..0b78748b 100644 --- a/src/components/atoms/CodeSnippet/CodeSnippet.css +++ b/src/components/atoms/CodeSnippet/CodeSnippet.css @@ -1,21 +1,16 @@ -/** - * CodeSnippet Component Styles - * Styling for the CodeSnippet component with syntax highlighting and cyberpunk effects - * Note: Animations are now managed by framer-motion through the AnimationContext - */ - -/* Base styles */ +/* CodeSnippet: code panel with simple token colours on the shared card surface */ .code-snippet { font-family: var(--font-family-jetbrains); - border-radius: var(--border-radius-md); + border-radius: var(--radius-card); overflow: hidden; margin: 0; position: relative; - box-shadow: var(--box-shadow-sm); + box-shadow: var(--shadow-card); width: 100%; max-width: 100%; - border: 1px solid var(--color-border); - /* Transition removed - now handled by framer-motion */ + background: var(--surface-card); + border: 1px solid var(--surface-border); + color: var(--color-text); } .code-snippet pre { @@ -24,14 +19,11 @@ overflow: auto; max-height: 400px; scrollbar-width: thin; - scrollbar-color: var(--color-border) transparent; + scrollbar-color: var(--surface-border) transparent; text-align: left; white-space: pre-wrap; word-break: break-word; - word-wrap: break-word; line-height: var(--line-height-code); - position: relative; - z-index: 2; } .code-snippet code { @@ -39,97 +31,35 @@ font-family: var(--font-family-jetbrains); letter-spacing: var(--letter-spacing-technical); tab-size: 2; - position: relative; -} - -/* Theme variations */ -.code-snippet-dark { - background-color: rgba(var(--color-navy-rgb), 0.85); - color: var(--color-text); - backdrop-filter: blur(2px); } +/* Themes: both stay dark; "light" is the raised navy */ .code-snippet-light { - background-color: var(--color-background-alt); - color: var(--color-text); + background: var(--surface-card-raised); } -/* Visual variants with enhanced cyberpunk styling */ +/* Variants */ .code-snippet-security { - border-color: var(--color-primary); - box-shadow: 0 0 15px rgba(var(--color-primary-rgb), 0.2); - border-width: 1.5px; - background: linear-gradient( - rgba(var(--color-navy-rgb), 0.9), - rgba(var(--color-navy-rgb), 0.85) - ); -} - -.code-snippet-security::before { - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: - repeating-linear-gradient( - to bottom, - transparent, - transparent 2px, - rgba(var(--color-primary-rgb), 0.03) 2px, - rgba(var(--color-primary-rgb), 0.03) 4px - ); - pointer-events: none; - z-index: 1; - opacity: 0.5; + border-color: var(--surface-border-strong); } .code-snippet-terminal { - border-color: var(--color-info); - box-shadow: 0 0 15px rgba(var(--color-info-rgb), 0.2); - border-width: 1.5px; - background: linear-gradient( - rgba(0, 20, 40, 0.95), - rgba(0, 20, 40, 0.9) - ); + background: var(--surface-inset); + border-color: var(--surface-border); } -.code-snippet-terminal::before { - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: - repeating-linear-gradient( - to bottom, - transparent, - transparent 2px, - rgba(var(--color-info-rgb), 0.03) 2px, - rgba(var(--color-info-rgb), 0.03) 4px - ); - pointer-events: none; - z-index: 1; - opacity: 0.5; +.code-snippet-terminal code { + color: var(--color-success); } -/* Syntax highlighting tokens with enhanced cyberpunk colors */ +/* Tokens */ .code-snippet .token-keyword { color: var(--color-primary); font-weight: var(--font-weight-medium); - text-shadow: 0 0 4px rgba(var(--color-primary-rgb), 0.6); -} - -.code-snippet-terminal .token-keyword { - color: var(--color-info); - text-shadow: 0 0 4px rgba(var(--color-info-rgb), 0.6); } .code-snippet .token-string { color: var(--color-success); - text-shadow: 0 0 4px rgba(var(--color-success-rgb), 0.4); } .code-snippet .token-comment { @@ -139,50 +69,16 @@ .code-snippet .token-function { color: var(--color-warning); - text-shadow: 0 0 4px rgba(var(--color-warning-rgb), 0.4); -} - -/* Glitch effect for certain elements - Static styling only, animation now handled by framer-motion */ -.code-snippet .token-keyword, -.code-snippet .token-function { - position: relative; - display: inline-block; } -/* - * Removed CSS animation for token glitching - * Now implemented using framer-motion in the component - */ -.code-snippet .token-keyword::after, -.code-snippet .token-function::after { - content: attr(data-content, ''); - position: absolute; - left: 0; - top: 0; - color: inherit; - background: transparent; - overflow: hidden; - clip: rect(0, 900px, 0, 0); - /* animation removed - now handled by framer-motion */ - opacity: 0.3; - text-shadow: none; -} - -/* - * Keyframes removed - now implemented with framer-motion variants - * @keyframes noise-anim {...} - */ - -/* Decorative code snippets used as background elements */ +/* Decorative snippets used as background elements */ .code-snippet[aria-hidden="true"] { opacity: 0.5; max-width: 200px; - /* Hover transitions now handled by framer-motion */ } .code-snippet[aria-hidden="true"]:hover { opacity: 0.8; - /* Transition handled by framer-motion */ } .code-snippet[aria-hidden="true"] pre { @@ -194,22 +90,6 @@ font-size: var(--font-size-xs); } -.code-snippet[aria-hidden="true"]::after { - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - height: 3px; - background: linear-gradient(90deg, - var(--color-info), - var(--color-primary), - var(--color-danger) - ); - box-shadow: 0 0 10px rgba(var(--color-primary-rgb), 0.7); - /* Matrix scan animation removed - now handled by framer-motion */ -} - @media (max-width: 768px) { .code-snippet pre { padding: var(--spacing-3); @@ -222,12 +102,8 @@ } .code-snippet:focus-visible { - outline: 2px solid var(--color-primary); - outline-offset: 2px; -} - -.code-snippet-terminal:focus-visible { - outline-color: var(--color-info); + box-shadow: var(--ring-focus); + outline: none; } .sr-only { @@ -241,21 +117,3 @@ white-space: nowrap; border-width: 0; } - -/* Respect user preferences for reduced motion */ -@media (prefers-reduced-motion: reduce) { - .code-snippet { - /* No transitions needed as framer-motion handles reduced motion preferences through AnimationContext */ - } - - .code-snippet[aria-hidden="true"]::after, - .code-snippet .token-keyword::after, - .code-snippet .token-function::after { - /* Animations removed - now controlled by AnimationContext with reduced motion detection */ - } - - .code-snippet[aria-hidden="true"], - .code-snippet[aria-hidden="true"]:hover { - /* Transitions removed - now handled by framer-motion */ - } -} diff --git a/src/components/atoms/CodeSnippet/CodeSnippet.stories.tsx b/src/components/atoms/CodeSnippet/CodeSnippet.stories.tsx index bd9c3402..351080b8 100644 --- a/src/components/atoms/CodeSnippet/CodeSnippet.stories.tsx +++ b/src/components/atoms/CodeSnippet/CodeSnippet.stories.tsx @@ -95,7 +95,7 @@ const SnippetContainer = ({ children, background = 'var(--color-background)' }:
@@ -106,7 +106,12 @@ const SnippetContainer = ({ children, background = 'var(--color-background)' }: // Default code snippet export const Default: Story = { args: { - code: 'const greeting = "Hello, World!";\nconsole.log(greeting);', + code: `// Gate a deploy on the scan result +async function gateRelease(scan) { + const open = scan.findings.filter((f) => f.severity === 'critical'); + if (open.length > 0) throw new Error('Blocked: ' + open.length + ' critical'); + return { approved: true, owner: "Derek Mackley" }; +}`, language: 'javascript', theme: 'dark' }, @@ -214,8 +219,8 @@ export default darkTheme;`}
-

Light Theme

- +

Raised Theme

+ { + it('classifies keywords, strings, comments and function names', () => { + const tokens = tokenize('const a = "hi"; // note\nfunction run() {}'); + const types = (t: string) => tokens.filter((x) => x.type === t).map((x) => x.text); + expect(types('keyword')).toEqual(['const', 'function']); + expect(types('string')).toEqual(['"hi"']); + expect(types('comment')).toEqual(['// note']); + expect(types('function')).toEqual(['run']); + }); + + it('round-trips the source text exactly', () => { + const code = 'class A {\n x = `t ${1}`;\n}'; + expect(tokenize(code).map((t) => t.text).join('')).toBe(code); + }); +}); + +describe('CodeSnippet', () => { + it('renders highlighted tokens without leaking markup as text', () => { + render(); + const code = screen.getByTestId('code-snippet').querySelector('code') as HTMLElement; + expect(code.textContent).toBe('const greeting = "Hello";'); + expect(code.querySelector('.token-keyword')?.textContent).toBe('const'); + expect(code.querySelector('.token-string')?.textContent).toBe('"Hello"'); + }); + + it('never turns supplied code into HTML elements', () => { + const evil = ''; + render(); + const code = screen.getByTestId('code-snippet').querySelector('code') as HTMLElement; + expect(code.querySelector('img, script')).toBeNull(); + expect(code.textContent).toBe(evil); + }); +}); diff --git a/src/components/atoms/CodeSnippet/CodeSnippet.tsx b/src/components/atoms/CodeSnippet/CodeSnippet.tsx index 3d8ea2ed..8ef91c94 100644 --- a/src/components/atoms/CodeSnippet/CodeSnippet.tsx +++ b/src/components/atoms/CodeSnippet/CodeSnippet.tsx @@ -1,6 +1,7 @@ -import React, { memo, useEffect, useRef } from 'react'; +import { memo, useMemo } from 'react'; import { motion, useReducedMotion, HTMLMotionProps, MotionStyle, Variants } from 'framer-motion'; import { useMotionEnabled } from '@utils/motion'; +import { tokenize } from './highlight'; import './CodeSnippet.css'; export interface CodeSnippetProps extends Omit, 'children'> { @@ -52,7 +53,6 @@ const CodeSnippet = ({ animated = true, ...rest }: CodeSnippetProps) => { - const codeRef = useRef(null); const motionOn = useMotionEnabled(animated); const reducedMotion = useReducedMotion(); @@ -85,38 +85,14 @@ const CodeSnippet = ({ } }; - // Apply basic syntax highlighting - useEffect(() => { - if (!codeRef.current || !language) return; - - // Very simple syntax highlighting for JavaScript/TypeScript - if (language === 'javascript' || language === 'typescript') { - let content = code; - - // Highlight keywords - const keywords = ['function', 'const', 'let', 'var', 'return', 'if', 'else', 'for', 'while', 'class', 'new', 'import', 'export', 'from', 'true', 'false', 'null', 'undefined']; - keywords.forEach(keyword => { - // Use word boundary to match whole words only - const regex = new RegExp(`\\b${keyword}\\b`, 'g'); - content = content.replace(regex, `${keyword}`); - }); - - // Highlight strings - content = content.replace(/(["'])(.*?)\1/g, '$&'); - - // Highlight comments (line and block) - content = content.replace(/\/\/.*$/gm, '$&'); - content = content.replace(/\/\*[\s\S]*?\*\//g, '$&'); - - // Highlight function names - content = content.replace(/function\s+([a-zA-Z_$][a-zA-Z0-9_$]*)/g, 'function $1'); - - // Set the highlighted content - codeRef.current.innerHTML = content; - } else { - // For other languages, just use the original content - codeRef.current.textContent = code; - } + // Highlight as React text nodes; code is never parsed as HTML + const highlighted = useMemo(() => { + if (language !== 'javascript' && language !== 'typescript') return code; + return tokenize(code).map((token, i) => + token.type === 'plain' ? token.text : ( + {token.text} + ), + ); }, [code, language]); // Determine class names based on props @@ -142,7 +118,7 @@ const CodeSnippet = ({ data-testid="code-snippet" initial={motionOn ? "hidden" : "visible"} animate="visible" - variants={snippetVariants} + variants={{ ...snippetVariants, ...glitchVariants }} whileHover={motionOn && !isDecorative ? "glitch" : "idle"} {...a11yProps} {...rest} @@ -150,10 +126,8 @@ const CodeSnippet = ({
         
-          {/* Content will be set by useEffect for syntax highlighting */}
-          {code}
+          {highlighted}
         
       
diff --git a/src/components/atoms/CodeSnippet/highlight.ts b/src/components/atoms/CodeSnippet/highlight.ts new file mode 100644 index 00000000..15a03a0d --- /dev/null +++ b/src/components/atoms/CodeSnippet/highlight.ts @@ -0,0 +1,56 @@ +export type TokenType = 'keyword' | 'string' | 'comment' | 'function' | 'plain'; + +export interface Token { + type: TokenType; + text: string; +} + +const KEYWORDS = new Set([ + 'function', 'const', 'let', 'var', 'return', 'if', 'else', 'for', 'while', 'class', 'new', + 'import', 'export', 'from', 'true', 'false', 'null', 'undefined', 'default', 'async', 'await', + 'interface', 'type', 'extends', 'public', 'private', 'try', 'catch', 'throw', +]); + +// One pass over the source: comments, strings (incl. template), then words. +const TOKEN_PATTERN = /(\/\/[^\n]*|\/\*[\s\S]*?\*\/)|("(?:\\.|[^"\\\n])*"|'(?:\\.|[^'\\\n])*'|`(?:\\.|[^`\\])*`)|([A-Za-z_$][\w$]*)/g; + +/** + * Split code into typed tokens. Pure text in, text out: the caller renders + * each token as a React text node, so nothing is ever parsed as HTML. + */ +export function tokenize(code: string): Token[] { + const tokens: Token[] = []; + let last = 0; + let afterFunctionKeyword = false; + + const push = (type: TokenType, text: string) => { + if (!text) return; + const prev = tokens[tokens.length - 1]; + if (prev && prev.type === type && type === 'plain') prev.text += text; + else tokens.push({ type, text }); + }; + + for (const match of code.matchAll(TOKEN_PATTERN)) { + const index = match.index ?? 0; + const between = code.slice(last, index); + push('plain', between); + if (between.trim()) afterFunctionKeyword = false; + const [text, comment, string, word] = match; + + if (comment) push('comment', text); + else if (string) push('string', text); + else if (word) { + if (KEYWORDS.has(word)) { + push('keyword', word); + afterFunctionKeyword = word === 'function'; + last = index + text.length; + continue; + } + push(afterFunctionKeyword ? 'function' : 'plain', word); + } + afterFunctionKeyword = false; + last = index + text.length; + } + push('plain', code.slice(last)); + return tokens; +} diff --git a/src/components/atoms/CodeSnippet/index.ts b/src/components/atoms/CodeSnippet/index.ts new file mode 100644 index 00000000..53809472 --- /dev/null +++ b/src/components/atoms/CodeSnippet/index.ts @@ -0,0 +1,2 @@ +export { default } from './CodeSnippet'; +export type { CodeSnippetProps } from './CodeSnippet'; diff --git a/src/components/atoms/ConnectionHeader/ConnectionHeader.css b/src/components/atoms/ConnectionHeader/ConnectionHeader.css index 51dd1cfb..13548f0d 100644 --- a/src/components/atoms/ConnectionHeader/ConnectionHeader.css +++ b/src/components/atoms/ConnectionHeader/ConnectionHeader.css @@ -1,21 +1,23 @@ -/* ConnectionHeader component styles - * Animations are now handled by framer-motion through the AnimationContext - */ +/* ConnectionHeader: a status strip on the shared card surface. + * Default is cyan (secure = good news); terminal is success green; + * cyberpunk is warning amber. Animations are driven by framer-motion. */ .secure-connection-start { + --status-color: var(--color-primary); display: flex; flex-direction: column; - margin-bottom: 1rem; - font-family: monospace; + margin-bottom: var(--spacing-4); + font-family: var(--font-family-jetbrains); } .secure-connection-status { display: flex; align-items: center; - background: var(--color-background-dark, #121212); - border: 1px solid var(--color-accent, #05d5fa); - border-radius: 4px; - padding: 0.5rem 1rem; + background: var(--surface-card); + border: 1px solid var(--surface-border); + border-radius: var(--radius-card); + box-shadow: var(--shadow-card); + padding: var(--spacing-2) var(--spacing-4); position: relative; overflow: hidden; } @@ -23,19 +25,18 @@ .connection-pulse { width: 8px; height: 8px; - background-color: var(--color-accent, #05d5fa); + background-color: var(--status-color); border-radius: 50%; - margin-right: 15px; + margin-right: var(--spacing-4); position: relative; - box-shadow: 0 0 8px var(--color-accent, #05d5fa); - /* Animation removed - now handled by framer-motion */ + flex-shrink: 0; } .secure-label { - font-size: 0.9rem; - font-weight: bold; - color: var(--color-accent, #05d5fa); - letter-spacing: 1px; + font-size: var(--font-size-sm); + font-weight: var(--font-weight-bold); + color: var(--status-color); + letter-spacing: var(--letter-spacing-technical); position: relative; } @@ -43,17 +44,17 @@ position: absolute; width: 100%; height: 2px; - background: rgba(5, 213, 250, 0.5); + background: rgba(var(--color-primary-rgb), 0.5); top: 50%; left: 0; transform: translateY(-50%); opacity: 0; - /* Animation removed - now handled by framer-motion */ } .status-code { - font-size: 0.8rem; - opacity: 0.8; + font-size: var(--font-size-xs); + font-weight: var(--font-weight-normal); + color: var(--color-text-muted); margin-top: 0.25rem; } @@ -64,50 +65,20 @@ } .shield-icon { - color: var(--color-accent, #05d5fa); + color: var(--status-color); display: flex; align-items: center; justify-content: center; } -/* Security variant specific styles */ .secure-connection-start--security .secure-connection-status { - border-color: var(--color-accent, #05d5fa); + border-color: var(--surface-border-strong); } -.secure-connection-start--security .connection-pulse { - background-color: var(--color-accent, #05d5fa); - box-shadow: 0 0 8px var(--color-accent, #05d5fa); +.secure-connection-start--terminal { + --status-color: var(--color-success); } -/* Terminal variant specific styles */ -.secure-connection-start--terminal .secure-connection-status { - border-color: var(--color-success, #00ff00); +.secure-connection-start--cyberpunk { + --status-color: var(--color-warning); } - -.secure-connection-start--terminal .connection-pulse { - background-color: var(--color-success, #00ff00); - box-shadow: 0 0 8px var(--color-success, #00ff00); -} - -.secure-connection-start--terminal .secure-label, -.secure-connection-start--terminal .shield-icon { - color: var(--color-success, #00ff00); -} - -/* Cyberpunk variant specific styles */ -.secure-connection-start--cyberpunk .secure-connection-status { - border-color: var(--color-warning, #ffcc00); -} - -.secure-connection-start--cyberpunk .connection-pulse { - background-color: var(--color-warning, #ffcc00); - box-shadow: 0 0 8px var(--color-warning, #ffcc00); -} - -.secure-connection-start--cyberpunk .secure-label, -.secure-connection-start--cyberpunk .shield-icon { - color: var(--color-warning, #ffcc00); -} - -/* Animation keyframes removed - now handled by framer-motion */ \ No newline at end of file diff --git a/src/components/atoms/ConnectionHeader/ConnectionHeader.stories.tsx b/src/components/atoms/ConnectionHeader/ConnectionHeader.stories.tsx index 3329c674..a05e4871 100644 --- a/src/components/atoms/ConnectionHeader/ConnectionHeader.stories.tsx +++ b/src/components/atoms/ConnectionHeader/ConnectionHeader.stories.tsx @@ -42,7 +42,7 @@ import ConnectionHeader from './ConnectionHeader'; * ## Styling * * The component uses theme colors that can be customized via CSS variables: - * - Security variant: Uses `--color-accent` (default: blue) + * - Security variant: Uses `--color-primary` (cyan) * - Terminal variant: Uses `--color-success` (default: green) * - Cyberpunk variant: Uses `--color-warning` (default: yellow) */ diff --git a/src/components/atoms/ConsoleHeader/ConsoleHeader.css b/src/components/atoms/ConsoleHeader/ConsoleHeader.css index cf057f74..a91eca84 100644 --- a/src/components/atoms/ConsoleHeader/ConsoleHeader.css +++ b/src/components/atoms/ConsoleHeader/ConsoleHeader.css @@ -1,88 +1,64 @@ -/** - * ConsoleHeader Component Styles - * Styling for the ConsoleHeader component with terminal aesthetics - * Note: Animations are now managed by framer-motion through the AnimationContext +/* + * ConsoleHeader: a terminal window on the shared card surface. + * Title bar uses the raised surface, the input row the card surface. + * Variants only change the accent (security: cyan, terminal: green). */ -/* Base styles */ .console-header { + --console-accent: var(--color-primary); width: 100%; - border-radius: var(--border-radius-md); + background: var(--surface-card); + border: 1px solid var(--surface-border); + border-radius: var(--radius-card); + box-shadow: var(--shadow-card); overflow: hidden; margin-bottom: var(--spacing-5); - transition: var(--transition-base); + transition: box-shadow var(--transition-base), border-color var(--transition-base); position: relative; } -/* Subtle breathing animation to draw attention */ -.console-header::before { - content: ''; - position: absolute; - top: -2px; - left: -2px; - right: -2px; - bottom: -2px; - background: linear-gradient(45deg, transparent, rgba(var(--color-cyan-rgb), 0.1), transparent); - border-radius: var(--border-radius-md); - z-index: -1; - opacity: 0; - transition: opacity var(--transition-slow); +.console-header-security { + border-color: var(--surface-border-strong); } -/* Interactive console styles - FIXED: Removed transform that causes disappearing */ -.console-header-interactive { - cursor: text; +.console-header-terminal { + --console-accent: var(--color-success); } -.console-header-interactive:hover { - /* REMOVED: transform: translateY(-1px); - This was causing the disappearing issue */ - box-shadow: 0 8px 25px rgba(var(--color-cyan-rgb), 0.15); -} - -.console-header-interactive:hover::before { - opacity: 1; -} - -.console-header-interactive .console-content { +.console-header-interactive { cursor: text; } -/* Hint animation for first-time users */ -.console-header-interactive .console-content { - animation: subtle-pulse 3s ease-in-out infinite; - animation-delay: 2s; -} - -.console-header-interactive:hover .console-content, -.console-header-interactive .console-content:focus-within { - animation: none; -} - -@keyframes subtle-pulse { - 0%, 100% { background-color: var(--color-navy); } - 50% { background-color: rgba(var(--color-cyan-rgb), 0.05); } +.console-header-interactive:hover { + box-shadow: var(--shadow-card-hover); } -/* Terminal header/title bar */ +/* Title bar */ .console-header-top { display: flex; justify-content: space-between; align-items: center; padding: var(--spacing-2) var(--spacing-4); - background-color: var(--color-background-alt); - border-bottom: 1px solid var(--color-border); + background-color: var(--surface-card-raised); + border-bottom: 1px solid var(--surface-divider); } .console-title { - font-size: var(--font-size-sm); + font-size: var(--font-size-xs); color: var(--color-text-muted); - font-family: var(--font-family-base); + font-family: var(--font-family-jetbrains); + letter-spacing: var(--letter-spacing-technical); text-align: center; flex-grow: 1; margin-right: var(--spacing-4); user-select: none; } +.console-header-security .console-title { + color: var(--color-primary); +} + +/* Input / command row */ .console-content { display: flex; align-items: center; @@ -90,48 +66,26 @@ font-family: var(--font-family-jetbrains); line-height: var(--line-height-code); letter-spacing: var(--letter-spacing-technical); - background-color: var(--color-navy); - border-bottom: 1px solid var(--color-border); + background-color: transparent; white-space: nowrap; overflow-x: auto; overflow-y: hidden; - transition: var(--transition-base); position: relative; } -.console-content::after { - content: ''; - position: absolute; - bottom: 0; - left: 0; - right: 0; - height: 2px; - background: linear-gradient(90deg, transparent, var(--color-cyan), transparent); - opacity: 0; - transition: opacity var(--transition-base); -} - -.console-header-interactive .console-content:hover::after, -.console-header-interactive .console-content:focus-within::after { - opacity: 0.6; -} - -/* Prompt styles */ .console-prompt { - color: var(--color-level-low); + color: var(--console-accent); margin-right: var(--spacing-2); font-weight: var(--font-weight-medium); user-select: none; flex-shrink: 0; } -/* Command styles */ .console-command { color: var(--color-text); font-weight: var(--font-weight-normal); } -/* Interactive input container */ .console-input-container { position: relative; display: flex; @@ -139,7 +93,6 @@ flex-grow: 1; } -/* Interactive input styles */ .console-input { background: transparent; border: none; @@ -154,41 +107,29 @@ min-width: 0; padding: 0; margin: 0; - transition: var(--transition-fast); } .console-input::placeholder { color: var(--color-text-muted); - opacity: 0.5; - transition: var(--transition-fast); -} - -.console-input:hover::placeholder { - opacity: 0.7; - color: var(--color-cyan); + opacity: 0.6; } +.console-input:hover::placeholder, .console-input:focus::placeholder { - opacity: 0.3; - color: var(--color-cyan); -} - -.console-input:focus { - text-shadow: 0 0 2px rgba(var(--color-cyan-rgb), 0.3); + color: var(--console-accent); + opacity: 0.5; } -/* ENHANCED CURSOR STYLES - Now more visible and refined */ +/* Block cursor */ .console-cursor { display: inline-block; - width: 10px; /* Slightly wider for better visibility */ - height: 18px; /* Slightly taller for better visibility */ - background-color: var(--color-info); + width: 10px; + height: 18px; + background-color: var(--console-accent); vertical-align: middle; margin-left: var(--spacing-1); flex-shrink: 0; - transition: var(--transition-fast); - box-shadow: 0 0 6px rgba(var(--color-info-rgb), 0.6); /* Enhanced glow */ - border-radius: 1px; /* Slight rounding for elegance */ + border-radius: 1px; } .console-cursor-input { @@ -196,208 +137,38 @@ margin-right: 2px; } -/* Enhanced cursor visibility on focus */ -.console-header-interactive .console-content:focus-within .console-cursor { - background-color: var(--color-cyan); - box-shadow: 0 0 10px rgba(var(--color-cyan-rgb), 0.8); - width: 12px; /* Wider when focused */ - height: 20px; /* Taller when focused */ -} - -/* Visual variants */ -.console-header-security .console-header-top { - background-color: var(--color-navy-dark, #0c1e2f); - border-color: var(--color-primary); -} - -.console-header-security .console-title { - color: var(--color-primary); - font-weight: var(--font-weight-semibold); - letter-spacing: 0.5px; -} - -.console-header-security .console-content { - background-color: var(--color-navy, #162b3d); - border-color: var(--color-cyan); - box-shadow: inset 0 0 10px rgba(var(--color-cyan-rgb), 0.1); - backdrop-filter: blur(10px); -} - -.console-header-security:hover .console-content { - background-color: rgba(var(--color-navy-rgb), 0.9); - box-shadow: - inset 0 0 15px rgba(var(--color-cyan-rgb), 0.15), - 0 0 20px rgba(var(--color-cyan-rgb), 0.1); -} - -.console-header-security .console-content:focus-within { - background-color: rgba(var(--color-navy-rgb), 0.85); - border-color: var(--color-cyan); - box-shadow: - inset 0 0 20px rgba(var(--color-cyan-rgb), 0.2), - 0 0 25px rgba(var(--color-cyan-rgb), 0.15); -} - -.console-header-security .console-prompt { - color: var(--color-cyan); - text-shadow: 0 0 5px rgba(var(--color-cyan-rgb), 0.5); - transition: var(--transition-fast); -} - -.console-header-security:hover .console-prompt { - text-shadow: 0 0 8px rgba(var(--color-cyan-rgb), 0.7); -} - -.console-header-security .console-content:focus-within .console-prompt { - text-shadow: 0 0 10px rgba(var(--color-cyan-rgb), 0.9); -} - -.console-header-security .console-command, -.console-header-security .console-input { - color: var(--color-text); - text-shadow: 0 0 2px rgba(var(--color-text-rgb), 0.3); -} - -.console-header-security .console-input::placeholder { - color: var(--color-text-muted); - text-shadow: none; - opacity: 0.5; - transition: var(--transition-fast); -} - -.console-header-security .console-input:hover::placeholder { - color: var(--color-cyan); - opacity: 0.7; - text-shadow: 0 0 3px rgba(var(--color-cyan-rgb), 0.3); -} - -.console-header-security .console-input:focus::placeholder { - color: var(--color-cyan); - opacity: 0.3; - text-shadow: 0 0 5px rgba(var(--color-cyan-rgb), 0.5); -} - -.console-header-security .console-cursor { - background-color: var(--color-cyan); - box-shadow: 0 0 8px var(--color-cyan); -} - -.console-header-terminal .console-header-top { - background-color: var(--color-dark, #1e1e1e); - border-color: var(--color-info); -} - -.console-header-terminal .console-title { - color: var(--color-text); -} - -.console-header-terminal .console-content { - background-color: var(--color-black, #000); - border-color: var(--color-info); -} - -.console-header-terminal:hover .console-content { - background-color: rgba(var(--color-info-rgb), 0.02); - box-shadow: 0 0 15px rgba(var(--color-info-rgb), 0.1); -} - -.console-header-terminal .console-content:focus-within { - background-color: rgba(var(--color-info-rgb), 0.05); - border-color: var(--color-info); - box-shadow: 0 0 20px rgba(var(--color-info-rgb), 0.15); -} - -.console-header-terminal .console-prompt { - color: var(--color-info); - transition: var(--transition-fast); -} - -.console-header-terminal:hover .console-prompt { - text-shadow: 0 0 5px rgba(var(--color-info-rgb), 0.5); -} - -.console-header-terminal .console-content:focus-within .console-prompt { - text-shadow: 0 0 8px rgba(var(--color-info-rgb), 0.7); -} - -.console-header-terminal .console-input { - color: var(--color-text); -} - -.console-header-terminal .console-input::placeholder { - color: var(--color-text-muted); - opacity: 0.5; - transition: var(--transition-fast); -} - -.console-header-terminal .console-input:hover::placeholder { - color: var(--color-info); - opacity: 0.7; -} - -.console-header-terminal .console-input:focus::placeholder { - color: var(--color-info); - opacity: 0.3; -} - -.console-header-terminal .console-cursor { - background-color: var(--color-info); -} - -/* Responsive styles */ -@media (max-width: 768px) { - .console-content { - padding: var(--spacing-2) var(--spacing-3); - font-size: var(--font-size-sm); - } - - .console-cursor { - height: 16px; - width: 8px; - } - - .console-header-interactive .console-content:focus-within .console-cursor { - height: 18px; - width: 10px; - } -} - -/* Interactive hint for users */ +/* Hint chip that appears on hover */ .console-header-interactive[data-hint]::after { content: attr(data-hint); position: absolute; - top: -8px; + top: var(--spacing-1); right: var(--spacing-4); font-size: var(--font-size-xs); - color: var(--color-cyan); - background: var(--color-navy); + color: var(--color-primary); + background: var(--surface-card-raised); padding: var(--spacing-1) var(--spacing-2); - border-radius: var(--border-radius-sm); + border-radius: var(--radius-chip); + border: 1px solid var(--surface-border); opacity: 0; - transform: translateY(10px); - transition: all var(--transition-slow); + transform: translateY(4px); + transition: opacity var(--transition-base), transform var(--transition-base); pointer-events: none; font-family: var(--font-family-jetbrains); - letter-spacing: var(--letter-spacing-wide); + letter-spacing: var(--letter-spacing-technical); z-index: 10; - border: 1px solid rgba(var(--color-cyan-rgb), 0.3); - box-shadow: 0 2px 8px rgba(var(--color-cyan-rgb), 0.1); } .console-header-interactive:hover::after { - opacity: 0.8; + opacity: 0.9; transform: translateY(0); } -.console-header-interactive .console-content:focus-within + * ~ *::after, .console-header-interactive.console-header-active::after { opacity: 0; - transform: translateY(-10px); } -/* Loading state indicator */ +/* Loading state: a soft sweep across the input row */ .console-header-loading .console-content { - position: relative; overflow: hidden; } @@ -408,7 +179,7 @@ left: -100%; width: 100%; height: 100%; - background: linear-gradient(90deg, transparent, rgba(var(--color-cyan-rgb), 0.1), transparent); + background: linear-gradient(90deg, transparent, var(--surface-inset), transparent); animation: loading-sweep 2s infinite; } @@ -417,33 +188,32 @@ 100% { left: 100%; } } -/* Enhanced accessibility for focus states */ .console-header:focus-within { - outline: 2px solid var(--color-cyan); - outline-offset: 2px; + box-shadow: var(--ring-focus); } -/* Reduced motion preferences - No longer needed as handled by AnimationContext */ -@media (prefers-reduced-motion: reduce) { +@media (max-width: 768px) { + .console-content { + padding: var(--spacing-2) var(--spacing-3); + font-size: var(--font-size-sm); + } + .console-cursor { - /* No CSS animations to disable - framer-motion handles reduced motion preferences */ + height: 16px; + width: 8px; } - - .console-header-interactive .console-content { +} + +@media (prefers-reduced-motion: reduce) { + .console-header-loading .console-content::before { animation: none; } - - .console-header::before, - .console-header-interactive::after { + + .console-header-interactive[data-hint]::after { transition: none; } - - .console-header-loading .console-content::before { - animation: none; - } } -/* Screen reader only class */ .sr-only { position: absolute; width: 1px; @@ -454,4 +224,4 @@ clip: rect(0, 0, 0, 0); white-space: nowrap; border-width: 0; -} \ No newline at end of file +} diff --git a/src/components/atoms/ContactButton/ContactButton.css b/src/components/atoms/ContactButton/ContactButton.css index 11966702..1fbd3b13 100644 --- a/src/components/atoms/ContactButton/ContactButton.css +++ b/src/components/atoms/ContactButton/ContactButton.css @@ -1,46 +1,6 @@ -/* ContactButton Component Styles */ - -.contact-button { - display: inline-flex; - align-items: center; - background: linear-gradient(90deg, var(--color-cyan) 0%, var(--color-primary) 100%); - color: var(--color-navy); - padding: var(--spacing-2) var(--spacing-5); - border-radius: var(--border-radius-pill); - font-weight: var(--font-weight-bold); - font-size: var(--font-size-sm); - text-transform: uppercase; - letter-spacing: var(--letter-spacing-wide); - box-shadow: 0 4px 10px rgba(var(--color-cyan-rgb), 0.3); - text-decoration: none; - cursor: pointer; -} - -.contact-button:hover { - box-shadow: 0 6px 15px rgba(var(--color-cyan-rgb), 0.4); - color: var(--color-navy); -} - -.contact-button:active { - box-shadow: 0 3px 8px rgba(var(--color-cyan-rgb), 0.4); -} - -.contact-button__text { - margin-right: var(--spacing-2); -} +/* ContactButton: look comes from the shared Button styles (.btn .btn-primary). */ .contact-button__icon { - font-size: var(--font-size-md); + font-size: 1.1em; + flex-shrink: 0; } - -/* Responsive adjustments */ -@media (max-width: 480px) { - .contact-button { - font-size: var(--font-size-xs); - padding: var(--spacing-2) var(--spacing-4); - } - - .contact-button__icon { - font-size: var(--font-size-sm); - } -} \ No newline at end of file diff --git a/src/components/atoms/ContactButton/ContactButton.stories.tsx b/src/components/atoms/ContactButton/ContactButton.stories.tsx index 9f39ac47..4b902726 100644 --- a/src/components/atoms/ContactButton/ContactButton.stories.tsx +++ b/src/components/atoms/ContactButton/ContactButton.stories.tsx @@ -9,7 +9,7 @@ const meta = { parameters: { docs: { description: { - component: 'Contact button component for email links with customizable icon and text.', + component: 'An email link drawn with the shared primary Button styles (solid cyan, navy text, --radius-control, shared focus ring), with a customizable icon and text.', }, }, componentSubtitle: 'A contact component for email communication', @@ -23,7 +23,7 @@ const meta = { }, // Shared wrapper for every story render: (args) => ( -
+
), @@ -37,7 +37,7 @@ type Story = StoryObj; */ export const Default: Story = { args: { - email: 'contact@example.com', + email: 'contact@chelonianlabs.com', text: 'Contact Me', animate: true, }, @@ -48,7 +48,7 @@ export const Default: Story = { */ export const WithEnvelopeIcon: Story = { args: { - email: 'contact@example.com', + email: 'contact@chelonianlabs.com', text: 'Send Email', icon: FaEnvelope, animate: true, @@ -60,7 +60,7 @@ export const WithEnvelopeIcon: Story = { */ export const WithPaperPlaneIcon: Story = { args: { - email: 'contact@example.com', + email: 'contact@chelonianlabs.com', text: 'Message Me', icon: FaPaperPlane, animate: true, @@ -72,7 +72,7 @@ export const WithPaperPlaneIcon: Story = { */ export const CustomText: Story = { args: { - email: 'security@example.com', + email: 'contact@chelonianlabs.com', text: 'Report Security Issue', animate: true, }, @@ -83,7 +83,7 @@ export const CustomText: Story = { */ export const NoAnimation: Story = { args: { - email: 'contact@example.com', + email: 'contact@chelonianlabs.com', text: 'Contact Me', animate: false, }, diff --git a/src/components/atoms/ContactButton/ContactButton.tsx b/src/components/atoms/ContactButton/ContactButton.tsx index e5f014e7..bb081ba0 100644 --- a/src/components/atoms/ContactButton/ContactButton.tsx +++ b/src/components/atoms/ContactButton/ContactButton.tsx @@ -1,6 +1,7 @@ import React from 'react'; import { FaRocket } from 'react-icons/fa'; import { motion, Variants } from 'framer-motion'; +import '../Button/Button.css'; import './ContactButton.css'; export interface ContactButtonProps { @@ -19,7 +20,7 @@ export interface ContactButtonProps { } /** - * ContactButton component for email contact links with rocket icon. + * ContactButton: an email link rendered with the shared primary Button styles. * * @component * @param {Object} props - Component props @@ -42,10 +43,9 @@ const ContactButton = ({ return ( {text} diff --git a/src/components/atoms/CyberpunkEffects/CyberpunkEffects.css b/src/components/atoms/CyberpunkEffects/CyberpunkEffects.css index dc127734..1820827e 100644 --- a/src/components/atoms/CyberpunkEffects/CyberpunkEffects.css +++ b/src/components/atoms/CyberpunkEffects/CyberpunkEffects.css @@ -140,8 +140,8 @@ .cyberpunk-effects--secure .cyberpunk-effects__glow { background: radial-gradient( circle at center, - rgba(34, 197, 94, 0.4), - rgba(34, 197, 94, 0.2), + rgba(var(--color-success-rgb), 0.4), + rgba(var(--color-success-rgb), 0.2), transparent 70% ); } @@ -150,25 +150,25 @@ background: linear-gradient( 90deg, transparent, - rgba(34, 197, 94, 0.8), + rgba(var(--color-success-rgb), 0.8), transparent ); } .cyberpunk-effects--secure .cyberpunk-effects__scan-lines:before { - background: rgba(34, 197, 94, 1); - box-shadow: 0 0 10px rgba(34, 197, 94, 0.8); + background: rgba(var(--color-success-rgb), 1); + box-shadow: 0 0 10px rgba(var(--color-success-rgb), 0.8); } .cyberpunk-effects--secure .cyberpunk-effects__corner { - border-color: rgba(34, 197, 94, 0.6); + border-color: rgba(var(--color-success-rgb), 0.6); } .cyberpunk-effects--secure .cyberpunk-effects__data-particle { background: linear-gradient( to bottom, transparent, - rgba(34, 197, 94, 0.8), + rgba(var(--color-success-rgb), 0.8), transparent ); } @@ -176,8 +176,8 @@ .cyberpunk-effects--breach .cyberpunk-effects__glow { background: radial-gradient( circle at center, - rgba(248, 113, 113, 0.4), - rgba(248, 113, 113, 0.2), + rgba(var(--color-danger-rgb), 0.4), + rgba(var(--color-danger-rgb), 0.2), transparent 70% ); } @@ -186,25 +186,25 @@ background: linear-gradient( 90deg, transparent, - rgba(248, 113, 113, 0.8), + rgba(var(--color-danger-rgb), 0.8), transparent ); } .cyberpunk-effects--breach .cyberpunk-effects__scan-lines:before { - background: rgba(248, 113, 113, 1); - box-shadow: 0 0 10px rgba(248, 113, 113, 0.8); + background: rgba(var(--color-danger-rgb), 1); + box-shadow: 0 0 10px rgba(var(--color-danger-rgb), 0.8); } .cyberpunk-effects--breach .cyberpunk-effects__corner { - border-color: rgba(248, 113, 113, 0.6); + border-color: rgba(var(--color-danger-rgb), 0.6); } .cyberpunk-effects--breach .cyberpunk-effects__data-particle { background: linear-gradient( to bottom, transparent, - rgba(248, 113, 113, 0.8), + rgba(var(--color-danger-rgb), 0.8), transparent ); } @@ -212,8 +212,8 @@ .cyberpunk-effects--critical .cyberpunk-effects__glow { background: radial-gradient( circle at center, - rgba(251, 191, 36, 0.4), - rgba(251, 191, 36, 0.2), + rgba(var(--color-warning-rgb), 0.4), + rgba(var(--color-warning-rgb), 0.2), transparent 70% ); } @@ -222,25 +222,25 @@ background: linear-gradient( 90deg, transparent, - rgba(251, 191, 36, 0.8), + rgba(var(--color-warning-rgb), 0.8), transparent ); } .cyberpunk-effects--critical .cyberpunk-effects__scan-lines:before { - background: rgba(251, 191, 36, 1); - box-shadow: 0 0 10px rgba(251, 191, 36, 0.8); + background: rgba(var(--color-warning-rgb), 1); + box-shadow: 0 0 10px rgba(var(--color-warning-rgb), 0.8); } .cyberpunk-effects--critical .cyberpunk-effects__corner { - border-color: rgba(251, 191, 36, 0.6); + border-color: rgba(var(--color-warning-rgb), 0.6); } .cyberpunk-effects--critical .cyberpunk-effects__data-particle { background: linear-gradient( to bottom, transparent, - rgba(251, 191, 36, 0.8), + rgba(var(--color-warning-rgb), 0.8), transparent ); } diff --git a/src/components/atoms/DataStream/DataStream.css b/src/components/atoms/DataStream/DataStream.css index a5f2297b..1b3b1d1f 100644 --- a/src/components/atoms/DataStream/DataStream.css +++ b/src/components/atoms/DataStream/DataStream.css @@ -1,13 +1,13 @@ /* DataStream Component Styles */ -@import url('../../../assets/css/design-system/index.css'); - .data-stream-container { position: relative; - height: 2px; + height: 4px; width: 100%; overflow: hidden; - border-radius: var(--border-radius-pill); - background: rgba(var(--color-cyan-rgb), 0.1); + border-radius: var(--radius-chip); + background: var(--surface-inset); + border: 1px solid var(--surface-divider); + box-sizing: content-box; } .data-stream { @@ -20,35 +20,29 @@ var(--stream-color, var(--color-cyan)), transparent ); - border-radius: var(--border-radius-pill); - box-shadow: 0 0 4px var(--stream-color, var(--color-cyan)); + border-radius: var(--radius-chip); } .data-stream--secondary { height: 50%; top: 25%; opacity: 0.6; - box-shadow: 0 0 2px var(--stream-color, var(--color-cyan)); } .data-stream--tertiary { height: 25%; top: 37.5%; opacity: 0.4; - box-shadow: 0 0 1px var(--stream-color, var(--color-cyan)); } /* Intensity variations */ .data-stream--low { - box-shadow: 0 0 2px var(--stream-color, var(--color-cyan)); } .data-stream--medium { - box-shadow: 0 0 4px var(--stream-color, var(--color-cyan)); } .data-stream--high { - box-shadow: 0 0 6px var(--stream-color, var(--color-cyan)); } /* Security variant styles */ @@ -58,7 +52,6 @@ var(--color-level-low), transparent ); - box-shadow: 0 0 4px var(--color-level-low); } .data-stream-container:has(.data-stream--secure) { @@ -71,7 +64,6 @@ var(--color-level-medium), transparent ); - box-shadow: 0 0 4px var(--color-level-medium); } .data-stream-container:has(.data-stream--breach) { @@ -84,33 +76,10 @@ var(--color-level-critical), transparent ); - box-shadow: 0 0 4px var(--color-level-critical); - animation: critical-pulse 1s ease-in-out infinite alternate; } .data-stream-container:has(.data-stream--critical) { background: rgba(var(--color-level-critical-rgb), 0.1); } -/* Critical pulse animation */ -@keyframes critical-pulse { - 0% { - box-shadow: 0 0 4px var(--color-level-critical); - } - 100% { - box-shadow: 0 0 8px var(--color-level-critical); - } -} - /* Responsive adjustments */ -@media (max-width: 768px) { - .data-stream-container { - height: 1.5px; - } -} - -@media (max-width: 480px) { - .data-stream-container { - height: 1px; - } -} \ No newline at end of file diff --git a/src/components/atoms/DataStream/DataStream.stories.tsx b/src/components/atoms/DataStream/DataStream.stories.tsx index dc1d5e57..26d695a0 100644 --- a/src/components/atoms/DataStream/DataStream.stories.tsx +++ b/src/components/atoms/DataStream/DataStream.stories.tsx @@ -1,4 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react-vite'; +import type { ComponentProps } from 'react'; import DataStream from './DataStream'; const meta = { @@ -49,12 +50,39 @@ const meta = { export default meta; type Story = StoryObj; +const StreamPanel = (args: ComponentProps) => ( +
+
+ ingress / chelonianlabs.com + live +
+ +
+); + export const Default: Story = { + render: (args) => , args: { variant: 'default', delay: 0, duration: 2.5, - intensity: 'medium', + intensity: 'high', }, }; diff --git a/src/components/atoms/DateBubble/DateBubble.css b/src/components/atoms/DateBubble/DateBubble.css index f757998f..bba3a980 100644 --- a/src/components/atoms/DateBubble/DateBubble.css +++ b/src/components/atoms/DateBubble/DateBubble.css @@ -1,339 +1,74 @@ /** - * DateBubble Component Styles - Completely reimagined - * Futuristic date display with holographic elements and data visualization - * Animations are now handled by framer-motion through the AnimationContext + * DateBubble: a date in the shared mono metadata style. + * Plain text by default; the 'security' and 'terminal' variants add the + * inset chip surface. */ -:root { - /* Size variants with precise dimensions */ - --date-bubble-size-sm: 75px; - --date-bubble-size-md: 90px; - --date-bubble-size-lg: 110px; - - /* Main colors for holographic effect */ - --hologram-primary: rgba(100, 255, 218, 0.9); - --hologram-secondary: rgba(88, 166, 255, 0.9); - --hologram-warning: rgba(255, 157, 0, 0.9); - --hologram-critical: rgba(255, 94, 120, 0.9); - - /* Custom colors for timeline entries */ - --color-entry1: #64ffda; /* Teal - Primary */ - --color-entry2: #ff9d00; /* Orange */ - --color-entry3: #ff5e78; /* Pink */ - --color-entry4: #a78bfa; /* Purple */ - --color-entry5: #2dd4bf; /* Turquoise */ - - /* Glow effects */ - --glow-strong: 0 0 25px; - --glow-medium: 0 0 15px; - --glow-soft: 0 0 8px; -} - -/* Base styles - holographic data chip */ .date-bubble { - position: relative; - display: flex; - flex-direction: column; + display: inline-flex; align-items: center; - justify-content: center; - background-color: rgba(10, 25, 50, 0.85); - border-radius: 4px; - color: #FFFFFF; - font-family: var(--font-family-jetbrains, 'JetBrains Mono', monospace); - font-weight: 600; + font-family: var(--font-family-jetbrains); + font-size: var(--font-size-xs); + font-weight: var(--font-weight-medium); + letter-spacing: var(--letter-spacing-technical); + color: var(--color-text-muted); user-select: none; - overflow: visible; - padding: 8px; - border: 2px solid transparent; - /* Transition removed - now handled by framer-motion */ - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5); -} - -/* Hexagonal cutout corners - cyberpunk detail */ -.date-bubble::before { - content: ''; - position: absolute; - top: -4px; - right: -4px; - width: 10px; - height: 10px; - background-color: transparent; - border-top: 2px solid var(--hologram-primary); - border-right: 2px solid var(--hologram-primary); - opacity: 0.8; -} - -.date-bubble::after { - content: ''; - position: absolute; - bottom: -4px; - left: -4px; - width: 10px; - height: 10px; - background-color: transparent; - border-bottom: 2px solid var(--hologram-primary); - border-left: 2px solid var(--hologram-primary); - opacity: 0.8; -} - -/* Size variants with proper scaling */ -.date-bubble-sm { - width: var(--date-bubble-size-sm); - height: 55px; - font-size: 1.1rem; -} - -.date-bubble-md { - width: var(--date-bubble-size-md); - height: 65px; - font-size: 1.3rem; } -.date-bubble-lg { - width: var(--date-bubble-size-lg); - height: 80px; - font-size: 1.6rem; -} - -/* Variant styles - distinctive color schemes */ -.date-bubble { - border-color: var(--hologram-primary); - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(100, 255, 218, 0.2); +.date-bubble-text { + white-space: nowrap; } -.date-bubble-security { - border-color: var(--hologram-primary); - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(100, 255, 218, 0.2); -} +/* Sizes */ +.date-bubble-sm { font-size: 0.6875rem; } +.date-bubble-md { font-size: var(--font-size-xs); } +.date-bubble-lg { font-size: var(--font-size-sm); } +/* Chip surface */ +.date-bubble-security, .date-bubble-terminal { - border-color: var(--hologram-secondary); - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(88, 166, 255, 0.2); -} - -/* Security level variations with clear visual differentiation */ -.date-bubble-level-low { - border-color: var(--hologram-primary); - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(100, 255, 218, 0.3); -} - -.date-bubble-level-low::before, -.date-bubble-level-low::after { - border-color: var(--hologram-primary); + padding: var(--spacing-1) var(--spacing-3); + background: var(--surface-inset); + border: 1px solid var(--surface-border); + border-radius: var(--radius-chip); } -.date-bubble-level-medium { - border-color: var(--hologram-secondary); - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(88, 166, 255, 0.3); -} - -.date-bubble-level-medium::before, -.date-bubble-level-medium::after { - border-color: var(--hologram-secondary); -} - -.date-bubble-level-high { - border-color: var(--hologram-warning); - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 157, 0, 0.3); -} - -.date-bubble-level-high::before, -.date-bubble-level-high::after { - border-color: var(--hologram-warning); +.date-bubble-terminal { + text-transform: uppercase; } +/* Only a critical date is a warning */ .date-bubble-level-critical { - border-color: var(--hologram-critical); - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 94, 120, 0.3); -} - -.date-bubble-level-critical::before, -.date-bubble-level-critical::after { - border-color: var(--hologram-critical); -} - -/* Timeline-specific entry-indexed styles with enhanced holographic effects */ -.timeline-entry:nth-child(5n+1) .date-bubble { - border-color: var(--color-entry1); - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(100, 255, 218, 0.3); - color: var(--color-entry1); -} - -.timeline-entry:nth-child(5n+1) .date-bubble::before, -.timeline-entry:nth-child(5n+1) .date-bubble::after { - border-color: var(--color-entry1); -} - -.timeline-entry:nth-child(5n+2) .date-bubble { - border-color: var(--color-entry2); - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 157, 0, 0.3); - color: var(--color-entry2); -} - -.timeline-entry:nth-child(5n+2) .date-bubble::before, -.timeline-entry:nth-child(5n+2) .date-bubble::after { - border-color: var(--color-entry2); -} - -.timeline-entry:nth-child(5n+3) .date-bubble { - border-color: var(--color-entry3); - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(255, 94, 120, 0.3); - color: var(--color-entry3); + color: var(--color-danger); } -.timeline-entry:nth-child(5n+3) .date-bubble::before, -.timeline-entry:nth-child(5n+3) .date-bubble::after { - border-color: var(--color-entry3); +.date-bubble-level-critical.date-bubble-security, +.date-bubble-level-critical.date-bubble-terminal { + border-color: rgba(var(--color-danger-rgb), 0.4); } -.timeline-entry:nth-child(5n+4) .date-bubble { - border-color: var(--color-entry4); - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(167, 139, 250, 0.3); - color: var(--color-entry4); -} - -.timeline-entry:nth-child(5n+4) .date-bubble::before, -.timeline-entry:nth-child(5n+4) .date-bubble::after { - border-color: var(--color-entry4); -} - -.timeline-entry:nth-child(5n+5) .date-bubble { - border-color: var(--color-entry5); - box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5), 0 0 20px rgba(45, 212, 191, 0.3); - color: var(--color-entry5); -} - -.timeline-entry:nth-child(5n+5) .date-bubble::before, -.timeline-entry:nth-child(5n+5) .date-bubble::after { - border-color: var(--color-entry5); -} - -/* Enhanced hover and animation effects - now handled by framer-motion */ -.timeline-entry .date-bubble { - /* Transition removed - now handled by framer-motion */ -} - -.timeline-entry:hover .date-bubble { - /* Transform removed - now handled by framer-motion */ - box-shadow: 0 8px 25px rgba(0, 0, 0, 0.6), 0 0 30px rgba(var(--color-primary-rgb), 0.35); -} - -/* Clickable state with improved interaction feedback - now handled by framer-motion */ +/* Clickable */ .date-bubble-clickable { cursor: pointer; + padding: var(--spacing-1) var(--spacing-3); + background: var(--surface-inset); + border: 1px solid var(--surface-border); + border-radius: var(--radius-chip); + transition: border-color 0.2s ease, color 0.2s ease; } .date-bubble-clickable:hover { - /* Transform removed - now handled by framer-motion */ + color: var(--color-text); + border-color: var(--surface-border-strong); } -.date-bubble-clickable:active { - /* Transform removed - now handled by framer-motion */ -} - -/* Inner text container with improved layout */ -.date-bubble-text { - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - text-align: center; - width: 100%; - height: 100%; - position: relative; - z-index: 2; -} - -/* Year display with futuristic styling */ -.date-bubble-year { - font-family: var(--font-family-jetbrains, 'JetBrains Mono', monospace); - font-weight: 600; - letter-spacing: 1px; - position: relative; - text-shadow: 0 0 10px currentColor; - color: #FFFFFF; -} - -/* Indicator light for cyberpunk effect */ -.date-bubble-indicator { - position: relative; - width: 50%; - height: 2px; - background-color: currentColor; - margin-top: 6px; - opacity: 0.7; - overflow: hidden; -} - -/* Scanning effect inside indicator - now handled by framer-motion */ -.date-bubble-indicator::after { - /* Content removed - now handled by framer-motion */ -} - -/* Animation keyframes removed - now handled by framer-motion */ - -/* Scanner effect - horizontal scan line - now handled by framer-motion */ -.date-bubble-scanner { - position: absolute; - top: 0; - left: 0; - right: 0; - height: 1px; - background-color: currentColor; - opacity: 0.5; - /* Animation removed - now handled by framer-motion */ - z-index: 3; -} - -/* Animation keyframes removed - now handled by framer-motion */ - -/* Data chip decoration - retro computer chip aesthetic */ -.date-chip { - position: absolute; - top: 8px; - right: 8px; - width: 8px; - height: 8px; - background-color: transparent; - border: 1px solid currentColor; - opacity: 0.6; -} - -/* Focus styles for keyboard navigation with better visibility */ -.date-bubble:focus-visible { +.date-bubble-clickable:focus-visible { + box-shadow: var(--ring-focus); outline: none; - box-shadow: 0 0 0 3px currentColor, 0 5px 15px rgba(0, 0, 0, 0.5); } -/* Responsive styles for mobile devices */ -@media (max-width: 768px) { - .date-bubble-sm { - width: calc(var(--date-bubble-size-sm) * 0.9); - height: 50px; - font-size: 1rem; - } - - .date-bubble-md { - width: calc(var(--date-bubble-size-md) * 0.9); - height: 55px; - font-size: 1.15rem; - } - - .date-bubble-lg { - width: calc(var(--date-bubble-size-lg) * 0.9); - height: 65px; - font-size: 1.3rem; - } - - /* Ensure corners are still visible on mobile */ - .date-bubble::before, - .date-bubble::after { - width: 8px; - height: 8px; - } -} - -/* Reduced motion preferences - now handled by AnimationContext */ @media (prefers-reduced-motion: reduce) { - /* All animations are now controlled by AnimationContext which respects user preferences */ + .date-bubble-clickable { + transition: none; + } } diff --git a/src/components/atoms/DateBubble/DateBubble.stories.tsx b/src/components/atoms/DateBubble/DateBubble.stories.tsx index c491b53d..c58b0be2 100644 --- a/src/components/atoms/DateBubble/DateBubble.stories.tsx +++ b/src/components/atoms/DateBubble/DateBubble.stories.tsx @@ -1,312 +1,81 @@ -import type { ReactNode } from 'react'; import type { Meta, StoryObj } from '@storybook/react-vite'; +import { expect, fn, userEvent, within } from 'storybook/test'; import DateBubble from './DateBubble'; +import { educationInfo } from '@/portfolio'; const meta = { title: 'Atoms/DateBubble', component: DateBubble, tags: ['autodocs'], parameters: { - componentSubtitle: 'Futuristic date display with holographic effects and security levels', docs: { description: { - component: 'The DateBubble component presents dates in a cyberpunk-inspired, interactive format. It features holographic effects, scanning animations, and security level indicators. Perfect for timelines, security dashboards, and futuristic interfaces, it includes accessibility features, responsive design, and respects reduced motion preferences. The component supports various sizes, security levels, and visual variants with distinctive hover effects and keyboard navigation.' - } - } + component: 'A date in the shared mono metadata style: small, muted, technical letter spacing, no glow. The security and terminal variants add the inset chip surface; a click handler makes it a keyboard-operable button.', + }, + }, }, argTypes: { - animated: { - control: 'boolean', - description: 'Whether the bubble fades in, scans and reacts to hover', - }, - date: { - control: 'text', - description: 'Date text to display', - table: { - type: { summary: 'string' }, - defaultValue: { summary: 'undefined' }, - } - }, + animated: { control: 'boolean', description: 'Whether the date fades in' }, + date: { control: 'text', description: 'Date text to display' }, level: { control: 'select', options: ['', 'low', 'medium', 'high', 'critical'], - description: 'Security level affecting the visual appearance', - table: { - type: { summary: 'string' }, - defaultValue: { summary: '""' }, - } + description: "Emphasis level. Only 'critical' changes colour, as a warning", }, variant: { control: 'select', options: ['', 'security', 'terminal'], - description: 'Visual style variant', - table: { - type: { summary: 'string' }, - defaultValue: { summary: '""' }, - } - }, - size: { - control: 'select', - options: ['sm', 'md', 'lg'], - description: 'Size of the bubble component', - table: { - type: { summary: 'string' }, - defaultValue: { summary: '"md"' }, - } - }, - animation: { - description: 'Framer Motion animation props', - table: { - type: { summary: 'object' }, - defaultValue: { summary: 'null' }, - } + description: 'Plain text, or an inset chip', }, - className: { - control: 'text', - description: 'Additional CSS classes', - table: { - type: { summary: 'string' }, - defaultValue: { summary: '""' }, - } - }, - onClick: { - action: 'clicked', - description: 'Click handler function', - table: { - type: { summary: 'function' }, - defaultValue: { summary: 'undefined' }, - } - }, - id: { - control: 'text', - description: 'Unique ID for ARIA relationships', - table: { - type: { summary: 'string' }, - defaultValue: { summary: 'undefined' }, - } - }, - ariaLabel: { - control: 'text', - description: 'Custom ARIA label', - table: { - type: { summary: 'string' }, - defaultValue: { summary: 'undefined' }, - } - } - } + size: { control: 'select', options: ['sm', 'md', 'lg'], description: 'Size of the date text' }, + className: { control: 'text', description: 'Additional CSS classes' }, + }, } satisfies Meta; - export default meta; -type Story = StoryObj; -// Showcase stories render fixed examples and take no args. -type ShowcaseStory = StoryObj; -// Container component for consistent display -const BubbleContainer = ({ children, background = 'var(--color-background)' }: { children: ReactNode; background?: string }) => ( -
- {children} -
-); +type Story = StoryObj; -// Default date bubble +/** The graduation date from the real site data */ export const Default: Story = { - args: { - date: '2024', - size: 'md' - }, - render: (args) => ( - - - - ) -}; - -// Size variations -export const Sizes: ShowcaseStory = { - render: () => ( - -
-
-

Small

- -
-
-

Medium

- -
-
-

Large

- -
-
-
- ) + args: { date: educationInfo[0].duration, size: 'md' }, }; -// Security level variations -export const SecurityLevels: ShowcaseStory = { - render: () => ( - -
-
-

Low Security

- -
-
-

Medium Security

- -
-
-

High Security

- -
-
-

Critical Security

- -
-
-
- ) +export const Sizes: Story = { + args: { date: 'Jan 2024' }, + render: (args) => ( +
+ + + +
+ ), }; -// Visual variants -export const Variants: ShowcaseStory = { - render: () => ( - -
-
-

Default

- -
-
-

Security

- -
-
-

Terminal

- -
-
-
- ) +export const Chip: Story = { + args: { date: 'Apr 2022', variant: 'security' }, }; -// Interactive examples -export const Interactive: ShowcaseStory = { - render: () => ( - -
-
-

Clickable

- alert('DateBubble clicked!')} - ariaLabel="Click to view details for year 2024" - /> -
-
-

With Animation

- -
-
-
- ) +export const Terminal: Story = { + args: { date: 'Apr 2022', variant: 'terminal' }, }; -// Timeline example -export const InTimeline: ShowcaseStory = { - render: () => ( - -
-
-
- - System Security Breach -
-
- - Security Audit -
-
- - System Implementation -
-
- - ) +/** A critical date is a warning, so it turns red */ +export const Critical: Story = { + args: { date: 'Expires Dec 2026', level: 'critical', variant: 'security' }, }; -// Responsive example -export const Responsive: ShowcaseStory = { - render: () => ( -
-
-

Desktop View

- - - -
-
-

Mobile View

- -
- -
-
-
-
- ) +export const Clickable: Story = { + args: { date: 'Oct 2016', onClick: fn() }, + play: async ({ canvasElement, args }) => { + const button = within(canvasElement).getByRole('button', { name: 'Date: Oct 2016' }); + await userEvent.click(button); + await expect(args.onClick).toHaveBeenCalledTimes(1); + button.focus(); + await userEvent.keyboard('{Enter}'); + await expect(args.onClick).toHaveBeenCalledTimes(2); + }, }; -// Accessibility example -export const Accessibility: ShowcaseStory = { - render: () => ( - -
-
-

With Custom ARIA Label

- -
-
-

With ID for Relationships

- -
-
-
- ) +export const ReducedMotion: Story = { + args: { date: 'Jan 2015', animated: false }, }; diff --git a/src/components/atoms/DateBubble/DateBubble.tsx b/src/components/atoms/DateBubble/DateBubble.tsx index bbd2c8de..482de456 100644 --- a/src/components/atoms/DateBubble/DateBubble.tsx +++ b/src/components/atoms/DateBubble/DateBubble.tsx @@ -1,16 +1,16 @@ import React, { memo } from 'react'; -import { motion, HTMLMotionProps, MotionStyle, Variants } from 'framer-motion'; +import { motion, HTMLMotionProps, MotionStyle } from 'framer-motion'; import { useMotionEnabled, fadeInVariants } from '@utils/motion'; import './DateBubble.css'; export interface DateBubbleProps extends Omit, 'children'> { /** Date text to display */ date: string; - /** Security level */ + /** Emphasis level. Only 'critical' changes colour, as a warning */ level?: '' | 'low' | 'medium' | 'high' | 'critical'; - /** Visual variant */ + /** Visual variant: 'security' and 'terminal' add the inset chip surface */ variant?: '' | 'security' | 'terminal'; - /** Size of the bubble */ + /** Size of the date text */ size?: 'sm' | 'md' | 'lg'; /** Framer Motion animation props (deprecated, unused) */ animation?: Record | null; @@ -29,25 +29,13 @@ export interface DateBubbleProps extends Omit, 'children' } /** - * DateBubble atom component for displaying dates in timelines - * Enhanced with framer-motion animations controlled by the `animated` prop - * + * DateBubble: a date in the shared mono metadata style (small, muted, + * technical letter spacing). Variants add the inset chip surface; a click + * handler makes it a keyboard-operable button. + * * @component - * @param {Object} props - Component props - * @param {string} props.date - Date text to display - * @param {string} [props.level=''] - Security level ('low', 'medium', 'high', 'critical') - * @param {string} [props.variant=''] - Visual variant ('', 'security', 'terminal') - * @param {string} [props.size='md'] - Size of the bubble ('sm', 'md', 'lg') - * @param {Object} [props.animation=null] - Framer Motion animation props (deprecated, unused) - * @param {string} [props.className=''] - Additional CSS classes - * @param {Object} [props.style={}] - Additional inline styles - * @param {Function} [props.onClick=undefined] - Click handler function - * @param {string} [props.id] - Unique ID for ARIA relationships - * @param {string} [props.ariaLabel] - ARIA label override - * @param {boolean} [props.animated=true] - Whether to animate the component - * @returns {React.ReactElement} DateBubble component */ -const DateBubble = ({ +const DateBubble = ({ date, level = '', variant = '', @@ -62,8 +50,8 @@ const DateBubble = ({ ...rest }: DateBubbleProps) => { const animationEnabled = useMotionEnabled(animated); - - // Determine class names based on props + void animation; + const classes = [ 'date-bubble', `date-bubble-${size}`, @@ -73,14 +61,14 @@ const DateBubble = ({ className ].filter(Boolean).join(' '); - // Set ARIA attributes + // A label only where it adds something: the text already reads as the date const a11yProps = { - 'aria-label': ariaLabel || `Date: ${date}`, id, + ...(ariaLabel || onClick ? { 'aria-label': ariaLabel || `Date: ${date}` } : {}), ...(onClick ? { role: 'button', tabIndex: 0, - onKeyPress: (e: React.KeyboardEvent) => { + onKeyDown: (e: React.KeyboardEvent) => { if (e.key === 'Enter' || e.key === ' ') { e.preventDefault(); // The click handler is reused for keyboard activation @@ -89,83 +77,20 @@ const DateBubble = ({ } } : {}) }; - - // Animation variants for scanner effect - const scannerVariants: Variants = { - hidden: { top: "5%", opacity: 0 }, - visible: { - top: ["5%", "95%", "5%"], - opacity: [0, 0.8, 0], - transition: { - duration: 3, - repeat: Infinity, - ease: "easeInOut", - times: [0, 0.5, 1] - } - } - }; - - // Animation variants for indicator scan effect - const indicatorScanVariants: Variants = { - hidden: { left: "-100%" }, - visible: { - left: "100%", - transition: { - duration: 2, - repeat: Infinity, - ease: "linear" - } - } - }; - - // Hover animation for clickable bubbles - const hoverVariants: Variants = onClick ? { - initial: { y: 0, scale: 1 }, - hover: { y: -5, scale: 1.05 }, - tap: { y: -2, scale: 0.98 } - } : {}; - // Content to render inside the DateBubble with hacker-themed elements return ( - - - - {date} - - - - -
+ {date}
); }; diff --git a/src/components/atoms/DateBubble/index.ts b/src/components/atoms/DateBubble/index.ts new file mode 100644 index 00000000..b5867e23 --- /dev/null +++ b/src/components/atoms/DateBubble/index.ts @@ -0,0 +1,2 @@ +export { default } from './DateBubble'; +export type { DateBubbleProps } from './DateBubble'; diff --git a/src/components/atoms/DateChip/DateChip.css b/src/components/atoms/DateChip/DateChip.css index 2be70c80..71e6af65 100644 --- a/src/components/atoms/DateChip/DateChip.css +++ b/src/components/atoms/DateChip/DateChip.css @@ -1,326 +1,61 @@ /** - * DateChip Component Styles - Cybersecurity Theme - * - * Professional cybersecurity-themed styling with: - * - Dark navy backgrounds with cyan accents - * - Technical typography using JetBrains Mono - * - Subtle grid patterns and tech-inspired effects - * - Enhanced readability and contrast - * - Professional appearance with hover animations - * - * Note: Animations and transitions are managed by framer-motion - * through the AnimationContext. + * DateChip + * + * Chip family: --radius-chip, --surface-inset fill, --surface-border, + * JetBrains Mono xs text, no glow. Breach is amber, critical is red. */ .date-chip { + --tone: var(--color-primary); + --tone-rgb: var(--color-primary-rgb); + display: inline-block; margin-bottom: var(--spacing-3); - position: relative; - z-index: 1; - filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3)); } .date-chip-inner { - /* Cybersecurity navy background with subtle gradient */ - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.95) 0%, - rgba(var(--color-navy-rgb), 0.9) 50%, - rgba(var(--color-navy-rgb), 0.95) 100% - ); - backdrop-filter: blur(15px); - border-radius: var(--border-radius-pill); - padding: var(--spacing-2) var(--spacing-4); - position: relative; - overflow: hidden; - display: flex; + display: inline-flex; align-items: center; - justify-content: center; - min-height: 36px; - - /* Professional cybersecurity border with cyan accent */ - border: 1px solid rgba(var(--color-cyan-rgb), 0.3); - - /* Enhanced shadow with cyan glow */ - box-shadow: - 0 4px 15px rgba(0, 0, 0, 0.3), - 0 0 20px rgba(var(--color-cyan-rgb), 0.1), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.1); -} - -/* Subtle tech grid pattern overlay */ -.date-chip-inner::before { - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - bottom: 0; - background: - repeating-linear-gradient( - 0deg, - transparent, - transparent 1px, - rgba(var(--color-cyan-rgb), 0.02) 1px, - rgba(var(--color-cyan-rgb), 0.02) 2px - ), - repeating-linear-gradient( - 90deg, - transparent, - transparent 1px, - rgba(var(--color-cyan-rgb), 0.02) 1px, - rgba(var(--color-cyan-rgb), 0.02) 2px - ); - opacity: 0.6; - pointer-events: none; - z-index: 1; -} - -/* Animated scan line effect */ -.date-chip-inner::after { - content: ''; - position: absolute; - top: 0; - left: -100%; - width: 100%; - height: 100%; - background: linear-gradient( - 90deg, - transparent, - rgba(var(--color-cyan-rgb), 0.1), - transparent - ); - transition: left 0.6s ease; - pointer-events: none; - z-index: 2; + box-sizing: border-box; + min-height: 1.75rem; + padding: 0 var(--spacing-3); + background: var(--surface-inset); + border: 1px solid var(--surface-border); + border-radius: var(--radius-chip); + transition: border-color 0.2s ease; } .date-chip-text { - /* Professional cybersecurity text styling */ - color: var(--color-cyan); - font-size: var(--font-size-sm); - font-weight: var(--font-weight-bold); + color: var(--tone); font-family: var(--font-family-jetbrains); + font-size: var(--font-size-xs); + font-weight: var(--font-weight-medium); + letter-spacing: var(--letter-spacing-technical); text-transform: uppercase; - letter-spacing: 0.8px; - position: relative; - z-index: 3; - text-shadow: 0 0 10px rgba(var(--color-cyan-rgb), 0.5); - - /* Subtle background for better readability */ - background: rgba(var(--color-navy-rgb), 0.7); - padding: 4px 12px; - border-radius: 4px; - border: 1px solid rgba(var(--color-cyan-rgb), 0.2); - backdrop-filter: blur(10px); -} - -/* Cybersecurity glow effect */ -.date-chip-glow { - position: absolute; - top: -50%; - left: -50%; - width: 200%; - height: 200%; - background: radial-gradient( - ellipse at center, - rgba(var(--color-cyan-rgb), 0.15) 0%, - rgba(var(--color-cyan-rgb), 0.05) 40%, - transparent 70% - ); - pointer-events: none; - z-index: 1; - opacity: 0; - transition: opacity 0.3s ease; + white-space: nowrap; } -/* Hover effects for enhanced interactivity */ .date-chip:hover .date-chip-inner { - border-color: rgba(var(--color-cyan-rgb), 0.6); - box-shadow: - 0 8px 25px rgba(0, 0, 0, 0.4), - 0 0 30px rgba(var(--color-cyan-rgb), 0.2), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.2); -} - -.date-chip:hover .date-chip-inner::before { - background: - repeating-linear-gradient( - 0deg, - transparent, - transparent 1px, - rgba(var(--color-cyan-rgb), 0.06) 1px, - rgba(var(--color-cyan-rgb), 0.06) 2px - ), - repeating-linear-gradient( - 90deg, - transparent, - transparent 1px, - rgba(var(--color-cyan-rgb), 0.06) 1px, - rgba(var(--color-cyan-rgb), 0.06) 2px - ); -} - -.date-chip:hover .date-chip-inner::after { - left: 100%; -} - -.date-chip:hover .date-chip-text { - border-color: rgba(var(--color-cyan-rgb), 0.4); - text-shadow: 0 0 15px rgba(var(--color-cyan-rgb), 0.8); - background: rgba(var(--color-navy-rgb), 0.8); -} - -.date-chip:hover .date-chip-glow { - opacity: 0.8; -} - -/* Focus styles for accessibility */ -.date-chip:focus-within .date-chip-inner { - outline: none; - border-color: rgba(var(--color-cyan-rgb), 0.8); - box-shadow: - 0 0 0 2px rgba(var(--color-cyan-rgb), 0.3), - 0 8px 25px rgba(0, 0, 0, 0.4), - 0 0 30px rgba(var(--color-cyan-rgb), 0.2); -} - -/* Security variant - enhanced styling */ -.date-chip--secure .date-chip-inner { - border: 2px solid rgba(var(--color-cyan-rgb), 0.5); - box-shadow: - 0 6px 20px rgba(0, 0, 0, 0.4), - 0 0 25px rgba(var(--color-cyan-rgb), 0.15), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.15); -} - -.date-chip--secure .date-chip-text { - color: var(--color-cyan); - text-shadow: 0 0 15px rgba(var(--color-cyan-rgb), 0.8); - animation: secure-pulse 2s ease-in-out infinite alternate; + border-color: var(--surface-border-strong); } -@keyframes secure-pulse { - 0% { text-shadow: 0 0 15px rgba(var(--color-cyan-rgb), 0.8); } - 100% { text-shadow: 0 0 20px rgba(var(--color-cyan-rgb), 1); } +.date-chip--secure { + --tone: var(--color-level-low); + --tone-rgb: var(--color-level-low-rgb); } -/* Breach variant - warning styling */ -.date-chip--breach .date-chip-inner { - background: linear-gradient( - 135deg, - rgba(var(--color-level-medium-rgb), 0.1) 0%, - rgba(var(--color-navy-rgb), 0.9) 50%, - rgba(var(--color-level-medium-rgb), 0.1) 100% - ); - border: 2px solid rgba(var(--color-level-medium-rgb), 0.4); - box-shadow: - 0 6px 20px rgba(0, 0, 0, 0.4), - 0 0 25px rgba(var(--color-level-medium-rgb), 0.15); +.date-chip--breach { + --tone: var(--color-level-medium); + --tone-rgb: var(--color-level-medium-rgb); } -.date-chip--breach .date-chip-text { - color: var(--color-level-medium); - text-shadow: 0 0 10px rgba(var(--color-level-medium-rgb), 0.6); +.date-chip--critical { + --tone: var(--color-level-critical); + --tone-rgb: var(--color-level-critical-rgb); } -/* Critical variant - critical styling */ +.date-chip--secure .date-chip-inner, +.date-chip--breach .date-chip-inner, .date-chip--critical .date-chip-inner { - background: linear-gradient( - 135deg, - rgba(var(--color-level-critical-rgb), 0.1) 0%, - rgba(var(--color-navy-rgb), 0.9) 50%, - rgba(var(--color-level-critical-rgb), 0.1) 100% - ); - border: 2px solid rgba(var(--color-level-critical-rgb), 0.5); - box-shadow: - 0 6px 20px rgba(0, 0, 0, 0.4), - 0 0 25px rgba(var(--color-level-critical-rgb), 0.2); -} - -.date-chip--critical .date-chip-text { - color: var(--color-level-critical); - text-shadow: 0 0 15px rgba(var(--color-level-critical-rgb), 0.8); - animation: critical-blink 1.5s ease-in-out infinite alternate; -} - -@keyframes critical-blink { - 0% { - text-shadow: 0 0 15px rgba(var(--color-level-critical-rgb), 0.8); - opacity: 1; - } - 100% { - text-shadow: 0 0 25px rgba(var(--color-level-critical-rgb), 1); - opacity: 0.8; - } -} - -/* Responsive adjustments */ -@media (max-width: 768px) { - .date-chip-inner { - padding: var(--spacing-1) var(--spacing-3); - min-height: 28px; - } - - .date-chip-text { - font-size: var(--font-size-xs); - padding: 2px 8px; - letter-spacing: 0.5px; - } -} - -@media (max-width: 480px) { - .date-chip-inner { - padding: var(--spacing-1) var(--spacing-2); - min-height: 24px; - } - - .date-chip-text { - font-size: var(--font-size-xs); - padding: 2px 6px; - letter-spacing: 0.3px; - } -} - -/* Reduced motion preferences */ -@media (prefers-reduced-motion: reduce) { - .date-chip-inner::after { - display: none; - } - - .date-chip--secure .date-chip-text { - animation: none; - text-shadow: 0 0 15px rgba(var(--color-cyan-rgb), 0.8); - } - - .date-chip--critical .date-chip-text { - animation: none; - text-shadow: 0 0 15px rgba(var(--color-level-critical-rgb), 0.8); - } - - .date-chip-glow { - opacity: 0.5; - } - - .date-chip:hover .date-chip-glow { - opacity: 0.8; - } + border-color: rgba(var(--tone-rgb), 0.45); } - -/* High contrast mode support */ -@media (prefers-contrast: high) { - .date-chip-inner { - border-width: 2px; - border-color: var(--color-cyan); - } - - .date-chip-text { - border-width: 2px; - border-color: var(--color-cyan); - background: var(--color-navy); - } - - .date-chip-inner::before { - display: none; - } -} \ No newline at end of file diff --git a/src/components/atoms/DateChip/DateChip.stories.tsx b/src/components/atoms/DateChip/DateChip.stories.tsx index 558895c9..639aa253 100644 --- a/src/components/atoms/DateChip/DateChip.stories.tsx +++ b/src/components/atoms/DateChip/DateChip.stories.tsx @@ -1,4 +1,3 @@ -import type { ReactNode } from 'react'; import type { Meta, StoryObj } from '@storybook/react-vite'; import DateChip from './DateChip'; @@ -7,53 +6,25 @@ const meta = { component: DateChip, tags: ['autodocs'], parameters: { - componentSubtitle: 'Cybersecurity-themed date and duration display with professional styling', + componentSubtitle: 'A date or duration chip', docs: { description: { - component: 'The DateChip component presents dates and durations in a professional cybersecurity-themed format. It features dark navy backgrounds with cyan accents, technical typography using JetBrains Mono, subtle grid patterns, and enhanced readability. The component includes multiple security variants (default, secure, breach, critical) with appropriate visual styling and animations. Perfect for timelines, experience sections, and security dashboards.' - } + component: + 'A chip-family pill for dates and durations: --radius-chip, --surface-inset fill, 1px border, JetBrains Mono xs text. Variants only change the tone: default cyan, secure green, breach amber, critical red.', + }, }, layout: 'centered', - backgrounds: { - default: 'dark', - values: [ - { name: 'dark', value: '#0a192f' }, - { name: 'navy', value: '#0f172a' }, - { name: 'black', value: '#000000' } - ] - } }, argTypes: { - animated: { - control: 'boolean', - description: 'Whether the chip lifts and glows on hover', - }, - date: { - control: 'text', - description: 'The date or duration text to display', - table: { - type: { summary: 'string' }, - defaultValue: { summary: 'undefined' }, - } - }, + animated: { control: 'boolean', description: 'Whether the chip fades in on mount' }, + date: { control: 'text', description: 'The date or duration text to display' }, variant: { control: { type: 'select' }, options: ['default', 'secure', 'breach', 'critical'], - description: 'Visual variant for different security contexts', - table: { - type: { summary: 'string' }, - defaultValue: { summary: 'default' }, - } + description: 'Tone of the chip', }, - className: { - control: 'text', - description: 'Additional CSS classes for custom styling', - table: { - type: { summary: 'string' }, - defaultValue: { summary: '""' }, - } - } - } + className: { control: 'text', description: 'Additional CSS classes' }, + }, } satisfies Meta; export default meta; @@ -61,330 +32,32 @@ type Story = StoryObj; // Showcase stories render fixed examples and take no args. type ShowcaseStory = StoryObj; -// Container component for consistent display with cybersecurity theme -const ChipContainer = ({ children, background = '#0a192f', title }: { children: ReactNode; background?: string; title?: string }) => ( -
- {title && ( -

- {title} -

- )} - {children} -
-); - -// Default cybersecurity date chip export const Default: Story = { - args: { - date: '2020 - 2024', - variant: 'default' - }, - render: (args) => ( - - - - ) + args: { date: '2020 - 2024', variant: 'default' }, }; -// Security Variants Showcase -export const SecurityVariants: ShowcaseStory = { +export const Variants: ShowcaseStory = { render: () => ( -
- - - - - - - - - - - - +
+ + + +
- ) + ), }; -// Date Format Examples -export const DateFormats: ShowcaseStory = { +export const Formats: ShowcaseStory = { render: () => ( - -
-
-

- Year Range -

- -
-
-

- Single Year -

- -
-
-

- Present Date -

- -
-
-

- Month Range -

- -
-
-
- ) -}; - -// Duration Format Examples -export const DurationFormats: ShowcaseStory = { - render: () => ( - -
-
-

- Years -

- -
-
-

- Months -

- -
-
-

- Combined Duration -

- -
-
-
- ) -}; - -// Security Timeline Example -export const SecurityTimeline: ShowcaseStory = { - render: () => ( - -
- {/* Timeline line */} -
- -
- - - Security Certification Achieved - -
- -
- - - Security Incident Response - -
- -
- - - Security Training Completed - -
-
- - ) -}; - -// Interactive Playground -export const Playground: Story = { - args: { - date: '2020 - Present', - variant: 'default' - }, - render: (args) => ( - -
- -

- Hover to see cybersecurity effects • Try different variants above -

-
-
- ) -}; - -// Responsive Example -export const Responsive: ShowcaseStory = { - render: () => ( -
- - - - - -
- -
-
+
+ + + +
- ) + ), }; -// Security Dashboard Grid -export const SecurityDashboard: ShowcaseStory = { - render: () => ( - -
-
- -

- System Secure -

-
- -
- -

- Warning Level -

-
- -
- -

- Immediate Action -

-
- -
- -

- Scheduled -

-
-
-
- ) -}; \ No newline at end of file +export const WithoutAnimation: Story = { + args: { date: '2022 - Present', animated: false }, +}; diff --git a/src/components/atoms/DateChip/DateChip.tsx b/src/components/atoms/DateChip/DateChip.tsx index 6e07a9b2..96a81e6a 100644 --- a/src/components/atoms/DateChip/DateChip.tsx +++ b/src/components/atoms/DateChip/DateChip.tsx @@ -10,19 +10,19 @@ export interface DateChipProps { variant?: 'default' | 'secure' | 'breach' | 'critical'; /** Additional CSS classes */ className?: string; - /** Whether hover motion is enabled */ + /** Whether the entrance fade is enabled */ animated?: boolean; } /** - * A stylized date/duration display component with cybersecurity theming. + * A date or duration chip from the shared chip family. * * @component * @param {Object} props - Component props * @param {string} props.date - The date or duration text to display * @param {string} [props.variant] - Visual variant: 'default', 'secure', 'breach', 'critical' * @param {string} [props.className] - Additional CSS classes - * @param {boolean} [props.animated=true] - Whether hover motion is enabled + * @param {boolean} [props.animated=true] - Whether the entrance fade is enabled * @returns {React.ReactElement} DateChip component */ const DateChip = ({ date, variant = 'default', className = "", animated = true }: DateChipProps) => { @@ -46,38 +46,6 @@ const DateChip = ({ date, variant = 'default', className = "", animated = true } } }; - const chipVariants: Variants = { - initial: { - y: 0, - scale: 1, - boxShadow: "0 4px 15px rgba(0, 0, 0, 0.3), 0 0 20px rgba(100, 255, 218, 0.1)" - }, - hover: { - y: shouldAnimate ? -3 : 0, - scale: shouldAnimate ? 1.02 : 1, - boxShadow: "0 8px 25px rgba(0, 0, 0, 0.4), 0 0 30px rgba(100, 255, 218, 0.2)", - transition: { - duration: 0.3, - ease: "easeOut" - } - } - }; - - const glowVariants: Variants = { - initial: { - opacity: 0, - rotate: 0 - }, - hover: { - opacity: 0.8, - rotate: shouldAnimate ? 360 : 0, - transition: { - opacity: { duration: 0.3, ease: "easeOut" }, - rotate: { duration: 2, ease: "linear", repeat: Infinity } - } - } - }; - // Build className with variant support const chipClasses = [ 'date-chip', @@ -89,24 +57,12 @@ const DateChip = ({ date, variant = 'default', className = "", animated = true } - +
{date} - - +
); }; diff --git a/src/components/atoms/DegreeInfo/DegreeInfo.css b/src/components/atoms/DegreeInfo/DegreeInfo.css index a141423c..2efbee5b 100644 --- a/src/components/atoms/DegreeInfo/DegreeInfo.css +++ b/src/components/atoms/DegreeInfo/DegreeInfo.css @@ -1,33 +1,29 @@ /** - * Degree Information Component Styles + * Degree Info: mono label over an Inter semibold value. */ .degree-info { - margin-bottom: var(--spacing-3); + display: flex; + flex-direction: column; + gap: var(--spacing-1); + min-width: 0; } .degree-label { - display: block; + font-family: var(--font-family-jetbrains); font-size: var(--font-size-xs); + font-weight: var(--font-weight-medium); text-transform: uppercase; - letter-spacing: 1px; + letter-spacing: var(--letter-spacing-technical); color: var(--color-text-muted); - margin-bottom: var(--spacing-1); - font-weight: var(--font-weight-medium); } .degree-value { - font-size: var(--font-size-lg); - font-weight: var(--font-weight-bold); - color: var(--color-text); margin: 0; - padding-left: var(--spacing-2); - border-left: 3px solid var(--color-primary); -} - -/* Responsive adaptations */ -@media (max-width: 768px) { - .degree-value { - font-size: var(--font-size-md); - } + font-family: var(--font-family-base); + font-size: var(--font-size-base); + font-weight: var(--font-weight-semibold); + line-height: 1.4; + color: var(--color-text); + overflow-wrap: anywhere; } diff --git a/src/components/atoms/DegreeInfo/DegreeInfo.stories.tsx b/src/components/atoms/DegreeInfo/DegreeInfo.stories.tsx index 72592adb..174c9655 100644 --- a/src/components/atoms/DegreeInfo/DegreeInfo.stories.tsx +++ b/src/components/atoms/DegreeInfo/DegreeInfo.stories.tsx @@ -1,157 +1,42 @@ -import type { ReactNode } from 'react'; import type { Meta, StoryObj } from '@storybook/react-vite'; import DegreeInfo from './DegreeInfo'; +import { educationInfo } from '@/portfolio'; const meta = { title: 'Atoms/DegreeInfo', component: DegreeInfo, tags: ['autodocs'], parameters: { - componentSubtitle: 'Display academic degree information with visual emphasis', docs: { description: { - component: 'The DegreeInfo component presents academic degree information in a visually appealing format. It features a labeled structure with hover effects and responsive design, making it perfect for academic portfolios and educational sections. The component includes a subtle left border accent and smooth transitions for interactive feedback.' - } - } + component: 'A DEGREE label (mono, uppercase) over the degree title in Inter semibold. The same label style is used for MAJOR and MINOR.', + }, + }, }, argTypes: { - degree: { - control: 'text', - description: 'The full title of the academic degree', - table: { - type: { summary: 'string' }, - defaultValue: { summary: 'undefined' }, - } - }, - className: { - control: 'text', - description: 'Additional CSS classes for custom styling', - table: { - type: { summary: 'string' }, - defaultValue: { summary: '""' }, - } - } - } + degree: { control: 'text', description: 'Degree title' }, + className: { control: 'text', description: 'Additional CSS classes' }, + animated: { control: 'boolean', description: 'Whether the block slides in' }, + }, } satisfies Meta; - export default meta; -type Story = StoryObj; -// Showcase stories render fixed examples and take no args. -type ShowcaseStory = StoryObj; -// Container component for consistent spacing and background -const DegreeContainer = ({ children, background = 'var(--color-background)' }: { children: ReactNode; background?: string }) => ( -
- {children} -
-); +type Story = StoryObj; -// Default degree info +/** The degree from the real site data */ export const Default: Story = { - args: { - degree: 'Bachelor of Science in Computer Science' - }, - render: (args) => ( - - - - ) -}; - -// Academic Levels -export const AcademicLevels: ShowcaseStory = { - render: () => ( - - -
- -
- - - ) -}; - -// Degree Formats -export const DegreeFormats: ShowcaseStory = { - render: () => ( - - -
- -
- - - ) -}; - -// Specializations -export const WithSpecializations: ShowcaseStory = { - render: () => ( - - -
- - - ) + args: { degree: educationInfo[0].degree }, }; -// Custom Styling -export const CustomStyling: ShowcaseStory = { - render: () => ( -
- - - - - - -
- ) +export const Example: Story = { + args: { degree: 'Bachelor of Science' }, }; -// Responsive Example -export const Responsive: ShowcaseStory = { - render: () => ( -
-
-

Desktop View

- - - -
-
-

Mobile View

- -
- -
-
-
-
- ) +export const LongTitle: Story = { + args: { degree: 'Master of Science in Cybersecurity Operations and Applied Cryptography' }, + decorators: [(Story) =>
], }; -// International Degrees -export const InternationalDegrees: ShowcaseStory = { - render: () => ( - - -
- -
- - - ) +export const ReducedMotion: Story = { + args: { degree: 'Bachelor of Science', animated: false }, }; diff --git a/src/components/atoms/DegreeInfo/DegreeInfo.tsx b/src/components/atoms/DegreeInfo/DegreeInfo.tsx index 3c076d19..761fa65d 100644 --- a/src/components/atoms/DegreeInfo/DegreeInfo.tsx +++ b/src/components/atoms/DegreeInfo/DegreeInfo.tsx @@ -13,38 +13,23 @@ export interface DegreeInfoProps { } /** - * Component for displaying degree information - * + * A DEGREE label (mono, uppercase) over the degree title. + * * @component - * @param {Object} props - Component props - * @param {string} props.degree - Degree title (e.g., Bachelor of Science) - * @param {string} [props.className] - Additional CSS classes - * @param {boolean} [props.animated=true] - Whether to animate the component - * @returns {React.ReactElement} DegreeInfo component */ const DegreeInfo = ({ degree, className = "", animated = true }: DegreeInfoProps) => { // Animate only when the prop is on and reduced motion is not requested const shouldAnimate = useMotionEnabled(animated); return ( - Degree - - {degree} - +

{degree}

); }; diff --git a/src/components/atoms/EducationIcon/EducationIcon.css b/src/components/atoms/EducationIcon/EducationIcon.css index 62d3544b..cf13a03e 100644 --- a/src/components/atoms/EducationIcon/EducationIcon.css +++ b/src/components/atoms/EducationIcon/EducationIcon.css @@ -1,66 +1,20 @@ /** - * Education Icon Component Styles - * Enhanced with sizing options and improved visual styling + * Education Icon: a glyph on the inset surface, with the shared border. */ .education-icon-container { display: flex; align-items: center; justify-content: center; - width: 3rem; - height: 3rem; - border-radius: 50%; - background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary)); - box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); - position: relative; - overflow: hidden; -} - -.education-icon-container::before { - content: ''; - position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: radial-gradient(circle at center, rgba(255, 255, 255, 0.2), transparent 70%); - pointer-events: none; + flex-shrink: 0; + width: 2.75rem; + height: 2.75rem; + background: var(--surface-inset); + border: 1px solid var(--surface-border); + border-radius: var(--radius-control); } .education-icon { - color: white; - font-size: 1.5rem; - filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2)); -} - -/* Large icon variant */ -.education-icon-large { - font-size: 2rem !important; -} - -.education-icon-container.education-icon-large { - width: 4rem; - height: 4rem; - background: linear-gradient(135deg, var(--color-primary-light), var(--color-primary), var(--color-primary-dark)); -} - -/* Responsive styles */ -@media (max-width: 768px) { - .education-icon-container { - width: 2.5rem; - height: 2.5rem; - } - - .education-icon { - font-size: 1.2rem; - } - - .education-icon-large { - font-size: 1.6rem !important; - } - - .education-icon-container.education-icon-large { - width: 3.2rem; - height: 3.2rem; - } + font-size: 1.25rem; + color: var(--color-primary); } diff --git a/src/components/atoms/EducationIcon/EducationIcon.stories.tsx b/src/components/atoms/EducationIcon/EducationIcon.stories.tsx index 26442ca1..e41a5e35 100644 --- a/src/components/atoms/EducationIcon/EducationIcon.stories.tsx +++ b/src/components/atoms/EducationIcon/EducationIcon.stories.tsx @@ -1,5 +1,5 @@ -import type { CSSProperties, ReactNode } from 'react'; -import type { Meta, StoryFn } from '@storybook/react-vite'; +import type { Meta, StoryObj } from '@storybook/react-vite'; +import { FaCertificate, FaUniversity } from 'react-icons/fa'; import EducationIcon from './EducationIcon'; const meta = { @@ -7,92 +7,34 @@ const meta = { component: EducationIcon, tags: ['autodocs'], parameters: { - componentSubtitle: 'Graduation cap icon with interactive animations and size variants', docs: { description: { - component: 'A visually appealing education icon component featuring gradient backgrounds, hover effects, and responsive sizing. Perfect for education-related sections and academic achievements.' - } - } + component: 'An education glyph in an inset tile with the shared border. Defaults to the graduation cap in brand cyan; pass `icon` and `color` for the card variants.', + }, + }, }, argTypes: { - className: { - control: 'text', - description: 'Additional CSS classes for customization', - table: { - type: { summary: 'string' }, - defaultValue: { summary: '""' } - } - }, - animated: { - control: 'boolean', - description: 'Whether to animate the component', - table: { - type: { summary: 'boolean' }, - defaultValue: { summary: 'true' } - } - } - } + className: { control: 'text', description: 'Additional CSS classes' }, + animated: { control: 'boolean', description: 'Whether the tile scales in' }, + color: { control: 'text', description: 'Glyph colour' }, + }, } satisfies Meta; - export default meta; -// Container for consistent display -const IconContainer = ({ children, style = {} }: { children: ReactNode; style?: CSSProperties }) => ( -
- {children} -
-); +type Story = StoryObj; -// Default icon -export const Default: StoryFn = () => ( - - - -); +export const Default: Story = {}; -// Size variants -export const Sizes: StoryFn = () => ( - -
-
-

Default Size

- -
- -
-

Large Size

- -
+export const Variants: Story = { + render: (args) => ( +
+ + +
- -); + ), +}; -// With labels -export const WithLabels: StoryFn = () => ( - -
-
- -
-
Bachelor of Science
-
- Computer Science -
-
-
-
-
-); \ No newline at end of file +export const ReducedMotion: Story = { + args: { animated: false }, +}; diff --git a/src/components/atoms/EducationIcon/EducationIcon.tsx b/src/components/atoms/EducationIcon/EducationIcon.tsx index 67cf42c4..06080dc4 100644 --- a/src/components/atoms/EducationIcon/EducationIcon.tsx +++ b/src/components/atoms/EducationIcon/EducationIcon.tsx @@ -1,10 +1,15 @@ import React from "react"; import { motion } from 'framer-motion'; import { FaGraduationCap } from 'react-icons/fa'; +import type { IconType } from 'react-icons'; import { useMotionEnabled, scaleVariants } from '@utils/motion'; import './EducationIcon.css'; export interface EducationIconProps { + /** Glyph to show; defaults to the graduation cap */ + icon?: IconType; + /** Glyph colour; defaults to the brand cyan */ + color?: string; /** Additional CSS classes */ className?: string; /** Whether to animate the component */ @@ -12,32 +17,22 @@ export interface EducationIconProps { } /** - * A component displaying an education icon with styling. - * + * An education glyph in an inset tile (the same surface as the other chips). + * * @component - * @param {Object} props - Component props - * @param {string} [props.className] - Additional CSS classes - * @param {boolean} [props.animated=true] - Whether to animate the component - * @returns {React.ReactElement} EducationIcon component */ -const EducationIcon = ({ className = "", animated = true }: EducationIconProps) => { +const EducationIcon = ({ icon: Icon = FaGraduationCap, color, className = "", animated = true }: EducationIconProps) => { // Animate only when the prop is on and reduced motion is not requested const shouldAnimate = useMotionEnabled(animated); return ( - - ); }; diff --git a/src/components/atoms/FieldsOfStudy/FieldsOfStudy.css b/src/components/atoms/FieldsOfStudy/FieldsOfStudy.css index 18ebcf84..4137a81c 100644 --- a/src/components/atoms/FieldsOfStudy/FieldsOfStudy.css +++ b/src/components/atoms/FieldsOfStudy/FieldsOfStudy.css @@ -1,55 +1,36 @@ /** - * Fields of Study Component Styles + * Fields of Study: MAJOR and MINOR, side by side when there is room. */ .fields-of-study { - margin-bottom: var(--spacing-3); + display: flex; + flex-wrap: wrap; + gap: var(--spacing-3) var(--spacing-5); + min-width: 0; +} + +.fields-of-study__field { display: flex; flex-direction: column; - gap: var(--spacing-3); + gap: var(--spacing-1); + flex: 1 1 10rem; + min-width: 0; } .field-label { - display: block; + font-family: var(--font-family-jetbrains); font-size: var(--font-size-xs); + font-weight: var(--font-weight-medium); text-transform: uppercase; - letter-spacing: 1px; + letter-spacing: var(--letter-spacing-technical); color: var(--color-text-muted); - margin-bottom: var(--spacing-1); - font-weight: var(--font-weight-medium); -} - -.major-container, -.minor-container { - position: relative; } -.major-value, -.minor-value { - font-size: var(--font-size-md); +.field-value { + font-family: var(--font-family-base); + font-size: var(--font-size-base); font-weight: var(--font-weight-semibold); - padding-left: var(--spacing-2); -} - -.major-value { + line-height: 1.4; color: var(--color-text); - border-left: 3px solid var(--color-primary-light); -} - -.minor-value { - color: var(--color-primary); - border-left: 3px solid var(--color-primary-dark); -} - -/* Responsive adaptations */ -@media (min-width: 768px) { - .fields-of-study { - flex-direction: row; - gap: var(--spacing-4); - } - - .major-container, - .minor-container { - flex: 1; - } + overflow-wrap: anywhere; } diff --git a/src/components/atoms/FieldsOfStudy/FieldsOfStudy.stories.tsx b/src/components/atoms/FieldsOfStudy/FieldsOfStudy.stories.tsx index ed3cb62b..9bfbe838 100644 --- a/src/components/atoms/FieldsOfStudy/FieldsOfStudy.stories.tsx +++ b/src/components/atoms/FieldsOfStudy/FieldsOfStudy.stories.tsx @@ -1,213 +1,47 @@ -import type { CSSProperties, ReactNode } from 'react'; -import type { Meta, StoryFn } from '@storybook/react-vite'; +import type { Meta, StoryObj } from '@storybook/react-vite'; import FieldsOfStudy from './FieldsOfStudy'; +import { educationInfo } from '@/portfolio'; const meta = { title: 'Atoms/FieldsOfStudy', component: FieldsOfStudy, tags: ['autodocs'], parameters: { - componentSubtitle: 'Display major and minor fields of study with visual hierarchy', docs: { description: { - component: 'A component for displaying academic fields of study, featuring a clear visual distinction between major and minor fields. Supports responsive layouts and themed styling.' - } - } + component: 'MAJOR and MINOR fields of study, each a mono label over an Inter semibold value. Side by side when there is room, stacked when not. A leading "Minor in " is dropped; an empty field is left out.', + }, + }, }, argTypes: { - major: { - control: 'text', - description: 'Major field of study', - table: { - type: { summary: 'string' }, - defaultValue: { summary: 'undefined' } - } - }, - minor: { - control: 'text', - description: 'Minor field of study (optional)', - table: { - type: { summary: 'string' }, - defaultValue: { summary: 'undefined' } - } - }, - className: { - control: 'text', - description: 'Additional CSS classes', - table: { - type: { summary: 'string' }, - defaultValue: { summary: '""' } - } - } - } + major: { control: 'text', description: 'Major field of study' }, + minor: { control: 'text', description: 'Minor field of study (optional)' }, + className: { control: 'text', description: 'Additional CSS classes' }, + animated: { control: 'boolean', description: 'Whether the block slides in' }, + }, } satisfies Meta; - export default meta; -// Container for consistent display -const StudyContainer = ({ children, style = {} }: { children: ReactNode; style?: CSSProperties }) => ( -
- {children} -
-); - -// Default example with both major and minor -export const Default: StoryFn = () => ( - - - -); - -// Major only -export const MajorOnly: StoryFn = () => ( - - - -); +type Story = StoryObj; -// Long field names -export const LongFieldNames: StoryFn = () => ( - - - -); +/** Major and minor from the real site data */ +export const Default: Story = { + args: { major: educationInfo[0].major, minor: educationInfo[0].minor }, +}; -// Multiple examples -export const MultipleExamples: StoryFn = () => ( - -
-
-

Technical Fields

- -
- -
-

Business Fields

- -
- -
-

Arts Fields

- -
-
-
-); +export const MajorOnly: Story = { + args: { major: 'Computer Science' }, +}; -// With custom styling -export const CustomStyling: StoryFn = () => ( - -
-
- -
- -
- -
-
-
-); +export const MinorPrefixDropped: Story = { + args: { major: 'Computer Science', minor: 'Minor in Mathematics' }, +}; -// Responsive behavior -export const Responsive: StoryFn = () => ( -
-
-

Desktop View

- - - -
- -
-

Mobile View

- - - -
-
-); +export const Narrow: Story = { + args: { major: 'Computer Information Systems', minor: 'Information Security' }, + decorators: [(Story) =>
], +}; -// With academic context -export const AcademicContext: StoryFn = () => ( - -
-
-

Stanford University

-

Class of 2023

-
- - - -
-

Specialized in Machine Learning and Neural Networks

-

GPA: 3.92/4.0

-
-
-
-); \ No newline at end of file +export const ReducedMotion: Story = { + args: { major: 'Computer Science', minor: 'Mathematics', animated: false }, +}; diff --git a/src/components/atoms/FieldsOfStudy/FieldsOfStudy.tsx b/src/components/atoms/FieldsOfStudy/FieldsOfStudy.tsx index 82c88cd4..a201e388 100644 --- a/src/components/atoms/FieldsOfStudy/FieldsOfStudy.tsx +++ b/src/components/atoms/FieldsOfStudy/FieldsOfStudy.tsx @@ -1,11 +1,11 @@ import React from "react"; -import { motion, Variants } from 'framer-motion'; +import { motion } from 'framer-motion'; import { useMotionEnabled, slideUpVariants } from '@utils/motion'; import './FieldsOfStudy.css'; export interface FieldsOfStudyProps { /** Major field of study */ - major: string; + major?: string; /** Minor field of study */ minor?: string; /** Additional CSS classes */ @@ -15,84 +15,34 @@ export interface FieldsOfStudyProps { } /** - * Component for displaying major and minor fields of study - * + * MAJOR and MINOR fields of study, each a mono label over an Inter + * semibold value. Either is left out when empty. + * * @component - * @param {Object} props - Component props - * @param {string} props.major - Major field of study - * @param {string} [props.minor] - Minor field of study (optional) - * @param {string} [props.className] - Additional CSS classes - * @param {boolean} [props.animated=true] - Whether to animate the component - * @returns {React.ReactElement} FieldsOfStudy component */ const FieldsOfStudy = ({ major, minor, className = "", animated = true }: FieldsOfStudyProps) => { // Animate only when the prop is on and reduced motion is not requested const shouldAnimate = useMotionEnabled(animated); - - // Item variants for staggered children - const itemVariants: Variants = { - hidden: { opacity: 0, x: -10 }, - visible: { - opacity: 1, - x: 0, - transition: { duration: 0.3 } - } - }; - - // Container variants with staggered children - const containerVariants: Variants = { - hidden: { opacity: 0 }, - visible: { - opacity: 1, - transition: { - staggerChildren: 0.2 - } - } - }; return ( - - - - Major - - - {major} - - - + {major && ( +
+ Major +
{major}
+
+ )} + {minor && ( - - - Minor - - - {minor.replace("Minor in ", "")} - - +
+ Minor +
{minor.replace("Minor in ", "")}
+
)}
); diff --git a/src/components/atoms/GridBackground/GridBackground.stories.tsx b/src/components/atoms/GridBackground/GridBackground.stories.tsx index a4040eca..72471c9a 100644 --- a/src/components/atoms/GridBackground/GridBackground.stories.tsx +++ b/src/components/atoms/GridBackground/GridBackground.stories.tsx @@ -59,8 +59,8 @@ type Story = StoryObj; export const Default: Story = { args: { gridSize: 30, - gridColor: 'rgba(255, 255, 255, 0.1)', - backgroundColor: 'rgba(0, 0, 0, 0.95)' + gridColor: 'rgba(100, 255, 218, 0.08)', + backgroundColor: 'rgba(10, 25, 47, 0.95)' } }; diff --git a/src/components/atoms/GridBackground/GridBackground.tsx b/src/components/atoms/GridBackground/GridBackground.tsx index 5babbc10..af41d932 100644 --- a/src/components/atoms/GridBackground/GridBackground.tsx +++ b/src/components/atoms/GridBackground/GridBackground.tsx @@ -27,8 +27,8 @@ const GridBackground = (props: GridBackgroundProps) => { const { className = '', gridSize = 30, - gridColor = 'rgba(255, 255, 255, 0.1)', - backgroundColor = 'rgba(0, 0, 0, 0.95)', + gridColor = 'rgba(100, 255, 218, 0.08)', + backgroundColor = 'rgba(10, 25, 47, 0.95)', animated = true, ...rest } = props; diff --git a/src/components/atoms/HeaderName/HeaderName.css b/src/components/atoms/HeaderName/HeaderName.css index 1f821745..25d1b4d2 100644 --- a/src/components/atoms/HeaderName/HeaderName.css +++ b/src/components/atoms/HeaderName/HeaderName.css @@ -33,10 +33,9 @@ display: inline-block; width: 10px; height: 1.25em; - background: #05D5FA; + background: var(--color-primary); margin-left: 6px; animation: terminalBlink 1.2s step-end infinite; - box-shadow: 0 0 8px rgba(5, 213, 250, 0.8); position: relative; top: 3px; border-radius: 1px; @@ -69,8 +68,7 @@ noscript ~ * .cursor { .cyber-text-animation h2 { position: relative; - color: #05D5FA; - text-shadow: 0 0 10px rgba(5, 213, 250, 0.5); + color: var(--color-primary); z-index: 1; overflow: visible; /* Allow text to be fully visible */ } @@ -86,7 +84,7 @@ noscript ~ * .cursor { 0deg, transparent, transparent 2px, - rgba(64, 255, 180, 0.3) 3px, + rgba(var(--color-primary-rgb), 0.3) 3px, transparent 4px ); opacity: 0; @@ -116,15 +114,37 @@ noscript ~ * .cursor { left: 0; width: 100%; height: 1px; - background: #05D5FA; + background: var(--color-primary); opacity: 0; transform: scaleX(0); transform-origin: left; transition: all 0.3s ease; - box-shadow: 0 0 10px rgba(5, 213, 250, 0.8); } .cyber-text-animation:hover .glow-line { opacity: 0.5; transform: scaleX(1); } + +/* Brand mark before the name */ +.header-name__logo { + flex: none; + width: 2.25rem; + height: 2.25rem; + border-radius: 50%; + border: 1px solid var(--surface-border-strong); + object-fit: cover; +} + +@media (min-width: 1024px) { + .header-name__logo { + width: 2.75rem; + height: 2.75rem; + } +} + +.cyber-text-animation h2:focus-visible, +.cyber-text-animation:focus-visible { + box-shadow: var(--ring-focus); + outline: none; +} diff --git a/src/components/atoms/HeaderName/HeaderName.stories.tsx b/src/components/atoms/HeaderName/HeaderName.stories.tsx index 25c09d73..9dc9c9e4 100644 --- a/src/components/atoms/HeaderName/HeaderName.stories.tsx +++ b/src/components/atoms/HeaderName/HeaderName.stories.tsx @@ -39,20 +39,36 @@ type Story = StoryObj; export const Default: Story = { args: { - name: 'John Doe', + name: 'Derek Mackley', + logoSrc: '/turtle.png', + }, + decorators: [ + (Story) => ( +
+ +
+ ), + ], +}; + +/** The turtle brand mark before the name, as the nav shows it. */ +export const WithLogo: Story = { + args: { + name: 'Derek Mackley', + logoSrc: '/turtle.png', }, }; export const LongName: Story = { args: { - name: 'Dr. Jonathan Doe-Smith III', + name: 'Dr. Alexandria Montgomery-Whitfield III', }, }; export const CustomStyle: Story = { args: { name: 'Custom Style', - className: 'text-2xl text-purple-400', + className: 'text-2xl', }, }; @@ -64,7 +80,7 @@ export const WithBackground: Story = { backgrounds: { default: 'dark', values: [ - { name: 'dark', value: '#1a1a1a' }, + { name: 'dark', value: '#0a192f' }, ], }, }, diff --git a/src/components/atoms/HeaderName/HeaderName.test.tsx b/src/components/atoms/HeaderName/HeaderName.test.tsx index fb725ece..473ca409 100644 --- a/src/components/atoms/HeaderName/HeaderName.test.tsx +++ b/src/components/atoms/HeaderName/HeaderName.test.tsx @@ -10,7 +10,7 @@ vi.mock('./HeaderName.css', () => ({ })); describe('HeaderName Component', () => { - const defaultName = 'John Doe'; + const defaultName = 'Derek Mackley'; beforeEach(() => { // Reset any mocks before each test @@ -62,4 +62,13 @@ describe('HeaderName Component', () => { // Since we're mocking the CSS, we'll check for the class instead expect(element).toHaveClass('cyber-text-animation'); }); + + it('shows a decorative logo only when logoSrc is given', () => { + const { container, rerender } = render(); + expect(container.querySelector('img')).toBeNull(); + rerender(); + const img = container.querySelector('img'); + expect(img).toHaveAttribute('src', '/apple-touch-icon.png'); + expect(img).toHaveAttribute('alt', ''); + }); }); diff --git a/src/components/atoms/HeaderName/HeaderName.tsx b/src/components/atoms/HeaderName/HeaderName.tsx index 6b478287..45449eb0 100644 --- a/src/components/atoms/HeaderName/HeaderName.tsx +++ b/src/components/atoms/HeaderName/HeaderName.tsx @@ -9,7 +9,7 @@ import './HeaderName.css'; * @component * @example * ```tsx - * + * * ``` */ export interface HeaderNameProps { @@ -19,12 +19,15 @@ export interface HeaderNameProps { className?: string; /** Whether hovering starts the animation (default: true) */ animated?: boolean; + /** Small image shown before the name, such as a logo; decorative */ + logoSrc?: string; } const HeaderName: React.FC = ({ name, className = '', - animated = true + animated = true, + logoSrc }: HeaderNameProps) => { const controls = useAnimation(); const motionOn = useMotionEnabled(animated); @@ -38,10 +41,13 @@ const HeaderName: React.FC = ({ onHoverEnd={() => controls.start('initial')} >

+ {logoSrc && ( + + )} {name}

diff --git a/src/components/atoms/LazyImage/LazyImage.css b/src/components/atoms/LazyImage/LazyImage.css index 931b36d7..ea0cb3fb 100644 --- a/src/components/atoms/LazyImage/LazyImage.css +++ b/src/components/atoms/LazyImage/LazyImage.css @@ -14,20 +14,20 @@ width: 100%; height: 100%; overflow: hidden; - background-color: var(--color-gray-200); + background-color: var(--surface-inset); + border-radius: var(--radius-card); /* transition property removed - now handled by framer-motion */ } /* Security-themed container */ .lazy-image-container.lazy-image-security { - background-color: rgba(var(--color-navy-rgb), 0.1); - border: 1px solid rgba(var(--color-cyan-rgb), 0.2); + border: 1px solid var(--surface-border); } /* Terminal-themed container */ .lazy-image-container.lazy-image-terminal { - background-color: var(--color-navy); - border: 1px solid var(--color-cyan); + background-color: var(--surface-card); + border: 1px solid var(--surface-border-strong); padding: 4px; } @@ -40,9 +40,9 @@ height: 100%; background: linear-gradient( 90deg, - var(--color-gray-200) 25%, - var(--color-gray-300) 37%, - var(--color-gray-200) 63% + var(--surface-inset) 25%, + rgba(var(--color-primary-rgb), 0.1) 37%, + var(--surface-inset) 63% ); background-size: 400% 100%; /* animation property removed - now handled by framer-motion */ @@ -52,24 +52,22 @@ .lazy-image-security .lazy-image-skeleton { background: linear-gradient( 90deg, - rgba(var(--color-navy-rgb), 0.3) 25%, - rgba(var(--color-cyan-rgb), 0.1) 37%, - rgba(var(--color-navy-rgb), 0.3) 63% + var(--surface-inset) 25%, + rgba(var(--color-primary-rgb), 0.1) 37%, + var(--surface-inset) 63% ); background-size: 400% 100%; - border: 1px solid rgba(var(--color-cyan-rgb), 0.2); } /* Terminal-themed skeleton */ .lazy-image-terminal .lazy-image-skeleton { background: linear-gradient( 90deg, - var(--color-navy) 25%, - rgba(var(--color-cyan-rgb), 0.2) 37%, - var(--color-navy) 63% + var(--surface-inset) 25%, + rgba(var(--color-primary-rgb), 0.1) 37%, + var(--surface-inset) 63% ); background-size: 400% 100%; - border-radius: 0; } /* Low resolution placeholder */ @@ -95,7 +93,6 @@ .lazy-image-terminal .lazy-image-low-res { filter: blur(8px) brightness(0.5) saturate(0.2); opacity: 0.5; - border: 1px solid rgba(var(--color-cyan-rgb), 0.3); } /* Actual image */ @@ -117,12 +114,12 @@ /* Security-themed loaded image */ .lazy-image-security .lazy-image { - box-shadow: 0 0 15px rgba(var(--color-cyan-rgb), 0.2); + box-shadow: var(--shadow-card); } /* Terminal-themed loaded image */ .lazy-image-terminal .lazy-image { - border: 1px solid var(--color-cyan); + border: 1px solid var(--surface-border); } /* Error state */ @@ -135,24 +132,24 @@ display: flex; justify-content: center; align-items: center; - background-color: var(--color-gray-200); + background-color: var(--surface-card); color: var(--color-danger); font-size: 0.875rem; } /* Security-themed error */ .lazy-image-security .lazy-image-error { - background-color: rgba(var(--color-navy-rgb), 0.9); - color: var(--color-level-critical); - border: 1px solid var(--color-level-critical); + background-color: var(--surface-card); + color: var(--color-danger); + border: 1px solid var(--color-danger); font-family: var(--font-family-jetbrains); } /* Terminal-themed error */ .lazy-image-terminal .lazy-image-error { - background-color: var(--color-navy); - color: var(--color-level-critical); - border: 1px solid var(--color-level-critical); + background-color: var(--surface-card); + color: var(--color-danger); + border: 1px solid var(--color-danger); font-family: var(--font-family-jetbrains); letter-spacing: var(--letter-spacing-technical); } diff --git a/src/components/atoms/Loading/Loading.css b/src/components/atoms/Loading/Loading.css index c009093c..2ed0c748 100644 --- a/src/components/atoms/Loading/Loading.css +++ b/src/components/atoms/Loading/Loading.css @@ -17,17 +17,19 @@ /* Animation is now handled by framer-motion */ } -/* Security-themed container */ +/* Security-themed container: the shared card surface */ .loading-security { - background-color: rgba(var(--color-navy-rgb), 0.05); - border-radius: 4px; + background: var(--surface-card); + border: 1px solid var(--surface-border); + border-radius: var(--radius-card); + box-shadow: var(--shadow-card); } -/* Terminal-themed container */ +/* Terminal-themed container: inset block, mono text */ .loading-terminal { - background-color: rgba(var(--color-navy-rgb), 0.1); - border: 1px dashed rgba(var(--color-cyan-rgb), 0.3); - border-radius: 2px; + background: var(--surface-inset); + border: 1px solid var(--surface-border); + border-radius: var(--radius-card); font-family: var(--font-family-jetbrains); } @@ -48,15 +50,14 @@ /* Security-themed spinner */ .loading-security .loading-spinner { - border: 3px solid rgba(var(--color-cyan-rgb), 0.1); - border-top-color: var(--color-cyan); - box-shadow: 0 0 10px rgba(var(--color-cyan-rgb), 0.2); + border: 3px solid var(--surface-border); + border-top-color: var(--color-primary); } /* Terminal-themed spinner */ .loading-terminal .loading-spinner { - border: 2px dashed rgba(var(--color-cyan-rgb), 0.3); - border-top: 2px solid var(--color-cyan); + border: 2px solid var(--surface-border); + border-top: 2px solid var(--color-primary); width: 40px; height: 40px; } @@ -75,13 +76,12 @@ /* Security-themed pulse */ .loading-security .loading-pulse { - background-color: var(--color-cyan); - box-shadow: 0 0 15px rgba(var(--color-cyan-rgb), 0.5); + background-color: var(--color-primary); } /* Terminal-themed pulse */ .loading-terminal .loading-pulse { - background-color: var(--color-cyan); + background-color: var(--color-primary); border-radius: 2px; width: 30px; height: 30px; @@ -106,13 +106,12 @@ /* Security-themed dots */ .loading-security .loading-dot { - background-color: var(--color-cyan); - box-shadow: 0 0 5px rgba(var(--color-cyan-rgb), 0.5); + background-color: var(--color-primary); } /* Terminal-themed dots */ .loading-terminal .loading-dot { - background-color: var(--color-cyan); + background-color: var(--color-primary); border-radius: 1px; width: 6px; height: 6px; diff --git a/src/components/atoms/Loading/Loading.stories.tsx b/src/components/atoms/Loading/Loading.stories.tsx index 141bd78a..13d218d5 100644 --- a/src/components/atoms/Loading/Loading.stories.tsx +++ b/src/components/atoms/Loading/Loading.stories.tsx @@ -33,9 +33,16 @@ type Story = StoryObj; export const Default: Story = { args: { size: 'md', - variant: '', + variant: 'security', type: 'spinner', }, + decorators: [ + (Story) => ( +
+ +
+ ), + ], play: async ({ canvasElement, step }) => { const canvas = within(canvasElement); @@ -99,7 +106,7 @@ ConstrainedContainer.parameters = { // Loading as an overlay - demonstrates how to use the spinner as an overlay on content export const ContentOverlay: StoryFn = () => ( -
+

This content is being updated...

= () => ( left: 0, right: 0, bottom: 0, - backgroundColor: 'rgba(255, 255, 255, 0.8)', + backgroundColor: 'rgba(var(--color-navy-rgb), 0.85)', display: 'flex', alignItems: 'center', justifyContent: 'center' @@ -129,13 +136,15 @@ export const InCard: StoryFn = () => (

Loading Data

-

+

Please wait while we fetch your data...

diff --git a/src/components/atoms/LocationInfo/LocationInfo.css b/src/components/atoms/LocationInfo/LocationInfo.css index 3df27826..c40333d1 100644 --- a/src/components/atoms/LocationInfo/LocationInfo.css +++ b/src/components/atoms/LocationInfo/LocationInfo.css @@ -1,69 +1,27 @@ -/* LocationInfo Component Styles */ +/* LocationInfo: a location card on the opaque raised surface (it sits over + * the map). Status variants change only the accent colour. */ @import url('../../../assets/css/design-system/index.css'); .location-info { - background: rgba(var(--color-navy-rgb), 0.95); - border: 1px solid rgba(var(--color-cyan-rgb), 0.3); - border-radius: var(--border-radius-lg); + --location-accent: var(--color-primary); + background: var(--surface-card-raised); + border: 1px solid var(--surface-border); + border-radius: var(--radius-card); + box-shadow: var(--shadow-card); padding: var(--spacing-4); margin-bottom: var(--spacing-4); - backdrop-filter: blur(12px); position: relative; overflow: hidden; } -.location-info--secure { - border-color: rgba(var(--color-level-low-rgb), 0.4); - background: rgba(var(--color-level-low-rgb), 0.05); -} - -.location-info--breach { - border-color: rgba(var(--color-level-medium-rgb), 0.4); - background: rgba(var(--color-level-medium-rgb), 0.05); -} +.location-info--secure { --location-accent: var(--color-success); } +.location-info--breach { --location-accent: var(--color-warning); } +.location-info--critical { --location-accent: var(--color-danger); } +.location-info--secure, +.location-info--breach, .location-info--critical { - border-color: rgba(var(--color-level-critical-rgb), 0.4); - background: rgba(var(--color-level-critical-rgb), 0.05); -} - -.location-info::before { - content: ''; - position: absolute; - top: 0; - left: 0; - right: 0; - height: 2px; - background: linear-gradient(90deg, - transparent, - var(--color-cyan), - transparent - ); - animation: scan-line 3s ease-in-out infinite; -} - -.location-info--secure::before { - background: linear-gradient(90deg, - transparent, - var(--color-level-low), - transparent - ); -} - -.location-info--breach::before { - background: linear-gradient(90deg, - transparent, - var(--color-level-medium), - transparent - ); -} - -.location-info--critical::before { - background: linear-gradient(90deg, - transparent, - var(--color-level-critical), - transparent - ); + border-color: var(--location-accent); } .location-info__header { @@ -80,27 +38,14 @@ } .location-info__icon { - color: var(--color-cyan); + color: var(--location-accent); font-size: var(--font-size-lg); } -.location-info--secure .location-info__icon { - color: var(--color-level-low); -} - -.location-info--breach .location-info__icon { - color: var(--color-level-medium); -} - -.location-info--critical .location-info__icon { - color: var(--color-level-critical); -} - .location-info__name { font-size: var(--font-size-lg); font-weight: var(--font-weight-semibold); - color: var(--color-white); - text-shadow: 0 0 8px rgba(var(--color-cyan-rgb), 0.3); + color: var(--color-text); } .location-info__badge { @@ -108,22 +53,22 @@ align-items: center; gap: var(--spacing-1); padding: var(--spacing-1) var(--spacing-2); - background: rgba(var(--color-cyan-rgb), 0.1); - border: 1px solid rgba(var(--color-cyan-rgb), 0.3); - border-radius: var(--border-radius-pill); + background: var(--surface-inset); + border: 1px solid var(--surface-border); + border-radius: var(--radius-chip); + font-family: var(--font-family-jetbrains); font-size: var(--font-size-xs); font-weight: var(--font-weight-medium); - color: var(--color-cyan); + color: var(--location-accent); text-transform: uppercase; - letter-spacing: 0.5px; + letter-spacing: var(--letter-spacing-technical); } .location-info__status-dot { width: 6px; height: 6px; border-radius: 50%; - background: var(--color-level-low); - box-shadow: 0 0 6px rgba(var(--color-level-low-rgb), 0.6); + background: var(--location-accent); } .location-info__status-text { @@ -131,26 +76,15 @@ } .location-info__coordinates { - font-family: var(--font-family-mono); + font-family: var(--font-family-jetbrains); font-size: var(--font-size-sm); - color: var(--color-gray-300); + letter-spacing: var(--letter-spacing-technical); + color: var(--color-text-muted); margin-bottom: var(--spacing-4); - padding: var(--spacing-2); - background: rgba(var(--color-black), 0.3); - border-radius: var(--border-radius-sm); - border-left: 3px solid var(--color-cyan); -} - -.location-info--secure .location-info__coordinates { - border-left-color: var(--color-level-low); -} - -.location-info--breach .location-info__coordinates { - border-left-color: var(--color-level-medium); -} - -.location-info--critical .location-info__coordinates { - border-left-color: var(--color-level-critical); + padding: var(--spacing-2) var(--spacing-3); + background: var(--surface-inset); + border: 1px solid var(--surface-divider); + border-radius: var(--radius-control); } .location-info__metrics { @@ -167,11 +101,11 @@ } .location-info__metric-label { + font-family: var(--font-family-jetbrains); font-size: var(--font-size-xs); - color: var(--color-gray-400); + color: var(--color-text-muted); text-transform: uppercase; - letter-spacing: 0.5px; - font-weight: var(--font-weight-medium); + letter-spacing: var(--letter-spacing-technical); } .location-info__metric-value { @@ -180,24 +114,13 @@ gap: var(--spacing-1); font-size: var(--font-size-sm); font-weight: var(--font-weight-semibold); - color: var(--color-white); -} - -.location-info__metric-value--default { - color: var(--color-cyan); -} - -.location-info__metric-value--secure { - color: var(--color-level-low); + color: var(--color-text); } -.location-info__metric-value--breach { - color: var(--color-level-medium); -} - -.location-info__metric-value--critical { - color: var(--color-level-critical); -} +.location-info__metric-value--default { color: var(--color-primary); } +.location-info__metric-value--secure { color: var(--color-success); } +.location-info__metric-value--breach { color: var(--color-warning); } +.location-info__metric-value--critical { color: var(--color-danger); } .location-info__metric-icon { font-size: var(--font-size-xs); @@ -212,22 +135,6 @@ height: 20px; } -/* Animations */ -@keyframes scan-line { - 0% { - transform: translateX(-100%); - opacity: 0; - } - 50% { - opacity: 1; - } - 100% { - transform: translateX(100%); - opacity: 0; - } -} - -/* Responsive Design */ @media (max-width: 768px) { .location-info { padding: var(--spacing-3); @@ -257,4 +164,4 @@ .location-info__coordinates { font-size: var(--font-size-xs); } -} \ No newline at end of file +} diff --git a/src/components/atoms/MapControls/MapControls.css b/src/components/atoms/MapControls/MapControls.css index 02167b07..30e884b4 100644 --- a/src/components/atoms/MapControls/MapControls.css +++ b/src/components/atoms/MapControls/MapControls.css @@ -1,63 +1,50 @@ -/* MapControls Component Styles */ +/* MapControls: toolbar over the map, on the opaque raised surface. + * Status variants (secure / breach / critical) change only the accent. */ @import url('../../../assets/css/design-system/index.css'); .map-controls { + --map-accent: var(--color-primary); display: flex; align-items: center; justify-content: space-between; padding: var(--spacing-3) var(--spacing-4); - background: rgba(var(--color-navy-rgb), 0.9); - border: 1px solid rgba(var(--color-cyan-rgb), 0.2); - border-radius: var(--border-radius-md); - backdrop-filter: blur(8px); + background: var(--surface-card-raised); + border: 1px solid var(--surface-border); + border-radius: var(--radius-card); + box-shadow: var(--shadow-card); margin-bottom: var(--spacing-4); position: relative; z-index: 10; } -.map-controls--secure { - border-color: rgba(var(--color-level-low-rgb), 0.4); - background: rgba(var(--color-level-low-rgb), 0.1); -} - -.map-controls--breach { - border-color: rgba(var(--color-level-medium-rgb), 0.4); - background: rgba(var(--color-level-medium-rgb), 0.1); -} +.map-controls--secure { --map-accent: var(--color-success); } +.map-controls--breach { --map-accent: var(--color-warning); } +.map-controls--critical { --map-accent: var(--color-danger); } +.map-controls--secure, +.map-controls--breach, .map-controls--critical { - border-color: rgba(var(--color-level-critical-rgb), 0.4); - background: rgba(var(--color-level-critical-rgb), 0.1); + border-color: var(--map-accent); } .map-controls__label { display: flex; align-items: center; gap: var(--spacing-2); - font-size: var(--font-size-sm); + font-family: var(--font-family-jetbrains); + font-size: var(--font-size-xs); font-weight: var(--font-weight-medium); - color: var(--color-cyan); + color: var(--map-accent); text-transform: uppercase; - letter-spacing: 0.5px; + letter-spacing: var(--letter-spacing-technical); } .map-controls__status-dot { width: 8px; height: 8px; border-radius: 50%; - background: var(--color-level-low); + background: var(--map-accent); animation: pulse-dot 2s ease-in-out infinite; - box-shadow: 0 0 8px rgba(var(--color-level-low-rgb), 0.6); -} - -.map-controls--breach .map-controls__status-dot { - background: var(--color-level-medium); - box-shadow: 0 0 8px rgba(var(--color-level-medium-rgb), 0.6); -} - -.map-controls--critical .map-controls__status-dot { - background: var(--color-level-critical); - box-shadow: 0 0 8px rgba(var(--color-level-critical-rgb), 0.6); } .map-controls__actions { @@ -69,99 +56,45 @@ display: flex; align-items: center; justify-content: center; - width: 36px; - height: 36px; - background: transparent; - border: 1px solid rgba(var(--color-cyan-rgb), 0.3); - border-radius: var(--border-radius-sm); - color: var(--color-cyan); + width: var(--control-height); + height: var(--control-height); + background: var(--surface-inset); + border: 1px solid var(--surface-border); + border-radius: var(--radius-control); + color: var(--map-accent); cursor: pointer; - transition: all var(--transition-fast); - position: relative; - overflow: hidden; -} - -.map-controls__button:before { - content: ''; - position: absolute; - top: 0; - left: -100%; - width: 100%; - height: 100%; - background: linear-gradient(90deg, transparent, rgba(var(--color-cyan-rgb), 0.1), transparent); - transition: left 0.2s ease-in-out; -} - -.map-controls__button:hover:before { - left: 100%; + transition: border-color var(--transition-fast), background-color var(--transition-fast); } .map-controls__button:hover { - border-color: rgba(var(--color-cyan-rgb), 0.6); - box-shadow: 0 0 12px rgba(var(--color-cyan-rgb), 0.3); - transform: translateY(-1px); + border-color: var(--surface-border-strong); } .map-controls__button--active { - background: rgba(var(--color-cyan-rgb), 0.1); - border-color: var(--color-cyan); - box-shadow: 0 0 8px rgba(var(--color-cyan-rgb), 0.4); + background: var(--surface-card); + border-color: var(--map-accent); } -.map-controls__button:active { - transform: translateY(0); - box-shadow: 0 0 8px rgba(var(--color-cyan-rgb), 0.2); +.map-controls__button:focus-visible { + box-shadow: var(--ring-focus); + outline: none; } .map-controls__icon { font-size: 14px; - z-index: 1; -} - -/* Security variant button styles */ -.map-controls--secure .map-controls__button { - border-color: rgba(var(--color-level-low-rgb), 0.3); - color: var(--color-level-low); } -.map-controls--secure .map-controls__button:hover { - border-color: rgba(var(--color-level-low-rgb), 0.6); - box-shadow: 0 0 12px rgba(var(--color-level-low-rgb), 0.3); -} - -.map-controls--breach .map-controls__button { - border-color: rgba(var(--color-level-medium-rgb), 0.3); - color: var(--color-level-medium); -} - -.map-controls--breach .map-controls__button:hover { - border-color: rgba(var(--color-level-medium-rgb), 0.6); - box-shadow: 0 0 12px rgba(var(--color-level-medium-rgb), 0.3); -} - -.map-controls--critical .map-controls__button { - border-color: rgba(var(--color-level-critical-rgb), 0.3); - color: var(--color-level-critical); -} - -.map-controls--critical .map-controls__button:hover { - border-color: rgba(var(--color-level-critical-rgb), 0.6); - box-shadow: 0 0 12px rgba(var(--color-level-critical-rgb), 0.3); +@keyframes pulse-dot { + 0%, 100% { opacity: 1; transform: scale(1); } + 50% { opacity: 0.6; transform: scale(1.2); } } -/* Animations */ -@keyframes pulse-dot { - 0%, 100% { - opacity: 1; - transform: scale(1); - } - 50% { - opacity: 0.6; - transform: scale(1.2); +@media (prefers-reduced-motion: reduce) { + .map-controls__status-dot { + animation: none; } } -/* Responsive Design */ @media (max-width: 768px) { .map-controls { padding: var(--spacing-2) var(--spacing-3); @@ -169,13 +102,9 @@ gap: var(--spacing-2); } - .map-controls__label { - font-size: var(--font-size-xs); - } - .map-controls__button { - width: 32px; - height: 32px; + width: var(--control-height-sm); + height: var(--control-height-sm); } .map-controls__icon { @@ -187,4 +116,4 @@ .map-controls { padding: var(--spacing-2); } -} \ No newline at end of file +} diff --git a/src/components/atoms/Modal/Modal.css b/src/components/atoms/Modal/Modal.css index 59c0ae41..0b039f46 100644 --- a/src/components/atoms/Modal/Modal.css +++ b/src/components/atoms/Modal/Modal.css @@ -45,19 +45,10 @@ max-height: 90vh; max-width: 95vw; overflow-y: auto; - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.98) 0%, - rgba(var(--color-navy-rgb), 0.95) 50%, - rgba(var(--color-navy-rgb), 0.98) 100% - ); - border: 2px solid var(--color-cyan); - border-radius: var(--border-radius-lg); - box-shadow: - 0 0 40px rgba(var(--color-cyan-rgb), 0.6), - 0 15px 50px rgba(0, 0, 0, 0.7), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.2); - backdrop-filter: blur(20px); + background: var(--surface-card-raised); + border: 1px solid var(--surface-border-strong); + border-radius: var(--radius-card); + box-shadow: var(--shadow-card); /* Ensure proper positioning */ margin: 0 !important; box-sizing: border-box; @@ -94,7 +85,7 @@ right: var(--spacing-4); background: none; border: none; - color: var(--color-gray-300); + color: var(--color-text-muted); font-size: var(--font-size-xl); cursor: pointer; padding: var(--spacing-1); @@ -103,20 +94,19 @@ display: flex; align-items: center; justify-content: center; - border-radius: 50%; - transition: all 0.2s ease; + border-radius: var(--radius-control); + transition: color 0.2s ease, background-color 0.2s ease; z-index: 10003; } .modal-close-button:hover { - color: var(--color-cyan); - background-color: rgba(var(--color-cyan-rgb), 0.15); - transform: scale(1.1); + color: var(--color-primary); + background-color: var(--surface-inset); } .modal-close-button:focus-visible { - outline: 2px solid var(--color-cyan); - outline-offset: 2px; + box-shadow: var(--ring-focus); + outline: none; } /* Inner content wrapper */ @@ -162,7 +152,7 @@ .modal-content { max-height: 98vh; max-width: 100vw; - border-radius: var(--border-radius-md); + border-radius: var(--radius-card); } .modal-content--sm, @@ -192,12 +182,12 @@ } .modal-content { - border-width: 3px; - background: rgba(var(--color-navy-rgb), 1); + border-width: 2px; + background: var(--surface-card-raised); } .modal-close-button { - border: 1px solid var(--color-gray-300); + border: 1px solid var(--color-text-muted); } } @@ -211,9 +201,6 @@ transition: none; } - .modal-close-button:hover { - transform: none; - } } /* Scrollbar styling for modal content */ @@ -222,15 +209,15 @@ } .modal-content::-webkit-scrollbar-track { - background: rgba(var(--color-navy-rgb), 0.5); + background: var(--surface-inset); border-radius: 4px; } .modal-content::-webkit-scrollbar-thumb { - background: rgba(var(--color-cyan-rgb), 0.3); + background: var(--surface-border); border-radius: 4px; } .modal-content::-webkit-scrollbar-thumb:hover { - background: rgba(var(--color-cyan-rgb), 0.5); + background: var(--surface-border-strong); } \ No newline at end of file diff --git a/src/components/atoms/NetworkBackground/NetworkBackground.stories.tsx b/src/components/atoms/NetworkBackground/NetworkBackground.stories.tsx index a89704f9..ea982cf7 100644 --- a/src/components/atoms/NetworkBackground/NetworkBackground.stories.tsx +++ b/src/components/atoms/NetworkBackground/NetworkBackground.stories.tsx @@ -59,7 +59,7 @@ type Story = StoryObj; export const Default: Story = { args: { gridSize: 30, - nodeColor: '#00f5d4', + nodeColor: '#64ffda', networkIntensity: 0.5 } }; @@ -92,7 +92,7 @@ export const Professional: Story = { export const ActiveNetwork: Story = { args: { gridSize: 25, - nodeColor: '#00f5d4', + nodeColor: '#64ffda', networkIntensity: 0.8 } }; diff --git a/src/components/atoms/NetworkBackground/NetworkBackground.tsx b/src/components/atoms/NetworkBackground/NetworkBackground.tsx index 9e4ebc9b..cadc7486 100644 --- a/src/components/atoms/NetworkBackground/NetworkBackground.tsx +++ b/src/components/atoms/NetworkBackground/NetworkBackground.tsx @@ -46,7 +46,7 @@ const NetworkBackground = (props: NetworkBackgroundProps) => { const { className = '', gridSize = 30, - nodeColor = '#00f5d4', + nodeColor = '#64ffda', networkIntensity = 0.5, animated = true, ...rest diff --git a/src/components/atoms/ProfileAvatar/ProfileAvatar.css b/src/components/atoms/ProfileAvatar/ProfileAvatar.css index 6c528c4a..8260415d 100644 --- a/src/components/atoms/ProfileAvatar/ProfileAvatar.css +++ b/src/components/atoms/ProfileAvatar/ProfileAvatar.css @@ -9,27 +9,24 @@ .profile-avatar__image { width: 150px; height: 150px; - border-radius: var(--border-radius-lg); + border-radius: var(--radius-card); object-fit: cover; - border: 4px solid rgba(var(--color-cyan-rgb), 0.5); - box-shadow: - 0 0 0 4px rgba(var(--color-navy-rgb), 0.5), - 0 10px 20px rgba(0, 0, 0, 0.3); + background: var(--surface-card); + border: 1px solid var(--surface-border-strong); + box-shadow: var(--shadow-card); } .profile-avatar__placeholder { display: flex; align-items: center; justify-content: center; - background-color: var(--color-navy); - color: var(--color-cyan); + background-color: var(--surface-card-raised); + color: var(--color-primary); font-size: 4rem; } .profile-avatar__image:hover { - box-shadow: - 0 0 0 4px rgba(var(--color-navy-rgb), 0.5), - 0 15px 25px rgba(0, 0, 0, 0.4); + box-shadow: var(--shadow-card-hover); } .profile-avatar__clearance { @@ -37,17 +34,19 @@ bottom: -10px; left: 50%; transform: translateX(-50%); - background-color: var(--color-cyan); - color: var(--color-navy); - padding: var(--spacing-1) var(--spacing-2); - border-radius: var(--border-radius-pill); + background-color: var(--surface-card-raised); + color: var(--color-primary); + border: 1px solid var(--surface-border-strong); + padding: var(--spacing-1) var(--spacing-3); + border-radius: var(--radius-chip); font-size: var(--font-size-xs); - font-weight: var(--font-weight-bold); + font-weight: var(--font-weight-medium); + letter-spacing: var(--letter-spacing-technical); font-family: var(--font-family-jetbrains); white-space: nowrap; display: flex; align-items: center; - box-shadow: var(--shadow-md); + box-shadow: var(--shadow-card); } .profile-avatar__lock-icon { diff --git a/src/components/atoms/ProfileAvatar/ProfileAvatar.stories.tsx b/src/components/atoms/ProfileAvatar/ProfileAvatar.stories.tsx index 72590c24..de35dcd5 100644 --- a/src/components/atoms/ProfileAvatar/ProfileAvatar.stories.tsx +++ b/src/components/atoms/ProfileAvatar/ProfileAvatar.stories.tsx @@ -2,7 +2,6 @@ import type { Meta, StoryObj } from '@storybook/react-vite'; import { motion } from 'framer-motion'; import ProfileAvatar from './ProfileAvatar'; import type { ProfileAvatarProps } from './ProfileAvatar'; -import { placeholderImage } from '@stories-utils/placeholderImage'; // Entrance variants, as a parent card would supply them const entranceVariants = { @@ -10,7 +9,8 @@ const entranceVariants = { visible: { opacity: 1, y: 0, transition: { duration: 0.6 } }, }; -const avatar = placeholderImage(200, 200, { label: 'JD' }); +// The turtle mark, served from /public +const avatar = '/turtle.png'; const meta = { title: 'Atoms/ProfileAvatar', @@ -41,7 +41,7 @@ const Template = (args: ProfileAvatarProps) => ( @@ -54,7 +54,7 @@ export const Default: Story = { render: Template, args: { src: avatar, - alt: 'John Doe', + alt: 'Derek Mackley', clearanceText: 'Security Clearance: Top Level', animate: true, }, @@ -67,8 +67,8 @@ export const CustomClearance: Story = { render: Template, args: { src: avatar, - alt: 'Jane Smith', - clearanceText: 'Jane Smith', + alt: 'Derek Mackley', + clearanceText: 'Principal Security Engineer', animate: true, }, }; @@ -80,7 +80,7 @@ export const NoAnimation: Story = { render: Template, args: { src: avatar, - alt: 'John Doe', + alt: 'Derek Mackley', clearanceText: 'Security Clearance: Top Level', animate: false, }, @@ -93,7 +93,7 @@ export const NoSource: Story = { render: Template, args: { src: '', - alt: 'John Doe', + alt: 'Derek Mackley', clearanceText: 'Security Clearance: Top Level', animate: false, }, diff --git a/src/components/atoms/Progress/Progress.css b/src/components/atoms/Progress/Progress.css index 7da590ce..d0e5b8fe 100644 --- a/src/components/atoms/Progress/Progress.css +++ b/src/components/atoms/Progress/Progress.css @@ -11,23 +11,20 @@ display: flex; height: 0.75rem; overflow: hidden; - background-color: var(--color-gray-200); - border-radius: var(--border-radius); + background-color: var(--surface-inset); + border: 1px solid var(--surface-border); + border-radius: var(--radius-chip); width: 100%; } -/* Security-themed progress container */ +/* Security-themed progress container: a stronger edge */ .tailwind-progress-security { - background-color: rgba(var(--color-navy-rgb), 0.3); - height: 0.75rem; - border: 1px solid rgba(var(--color-cyan-rgb), 0.3); + border-color: var(--surface-border-strong); } -/* Terminal-style progress container */ +/* Terminal-style progress container: thinner */ .tailwind-progress-terminal { - background-color: rgba(var(--color-navy-rgb), 0.7); height: 0.5rem; - border: none; } /* Progress bar */ @@ -38,7 +35,7 @@ text-align: center; white-space: nowrap; background-color: var(--color-primary); - /* Transition removed - now handled by framer-motion */ + border-radius: inherit; } /* Progress bar variants */ @@ -87,7 +84,7 @@ .tailwind-progress-terminal .tailwind-progress-bar { background-image: linear-gradient( 90deg, - var(--color-cyan) 50%, + var(--color-primary) 50%, transparent 50% ); background-size: 8px 100%; @@ -98,11 +95,11 @@ .tailwind-progress-striped .tailwind-progress-bar { background-image: linear-gradient( 45deg, - rgba(255, 255, 255, 0.15) 25%, + rgba(var(--color-navy-rgb), 0.25) 25%, transparent 25%, transparent 50%, - rgba(255, 255, 255, 0.15) 50%, - rgba(255, 255, 255, 0.15) 75%, + rgba(var(--color-navy-rgb), 0.25) 50%, + rgba(var(--color-navy-rgb), 0.25) 75%, transparent 75%, transparent ); @@ -116,7 +113,7 @@ /* Thinner variant */ .tailwind-progress-thin { - height: 0.375rem; + height: 0.5rem; } /* Thicker variant */ diff --git a/src/components/atoms/RatingStars/RatingStars.css b/src/components/atoms/RatingStars/RatingStars.css index 2e18abac..5fa414ae 100644 --- a/src/components/atoms/RatingStars/RatingStars.css +++ b/src/components/atoms/RatingStars/RatingStars.css @@ -1,14 +1,24 @@ /** * Rating Stars Component Styles + * Small cyan stars; unfilled stars are a faint cyan. */ .rating-stars { - color: var(--color-primary); display: flex; - gap: var(--spacing-1); + align-items: center; + gap: 2px; +} + +.rating-stars .star { + width: 14px; + height: 14px; + margin: 0; +} + +.rating-stars .star--filled { + color: var(--color-primary); } -.star { - width: 18px; - height: 18px; +.rating-stars .star--empty { + color: rgba(var(--color-primary-rgb), 0.2); } diff --git a/src/components/atoms/RatingStars/RatingStars.stories.tsx b/src/components/atoms/RatingStars/RatingStars.stories.tsx index 039e278a..acd297ef 100644 --- a/src/components/atoms/RatingStars/RatingStars.stories.tsx +++ b/src/components/atoms/RatingStars/RatingStars.stories.tsx @@ -5,15 +5,26 @@ const meta = { title: 'Atoms/RatingStars', component: RatingStars, tags: ['autodocs'], + parameters: { + docs: { + description: { + component: 'A small row of five cyan stars. Filled stars are cyan, the rest a faint cyan.', + }, + }, + }, argTypes: { rating: { - control: { type: 'range', min: 0, max: 5, step: 0.5 }, + control: { type: 'range', min: 0, max: 5, step: 1 }, description: 'Rating value from 0 to 5', }, className: { control: 'text', description: 'Additional CSS classes', }, + animated: { + control: 'boolean', + description: 'Whether the stars animate in', + }, }, } satisfies Meta; @@ -34,13 +45,6 @@ export const FullRating: Story = { } }; -// Half rating -export const HalfRating: Story = { - args: { - rating: 3.5, - } -}; - // Low rating export const LowRating: Story = { args: { @@ -48,36 +52,25 @@ export const LowRating: Story = { } }; -// With custom class -export const WithCustomClass: Story = { +// Without the entrance animation +export const WithoutAnimation: Story = { args: { - rating: 4, - className: 'large-stars', + rating: 5, + animated: false, } }; -// Multiple ratings example -export const MultipleRatings: StoryFn = () => ( -
-
-

Excellent

- -
-
-

Very Good

- -
-
-

Good

- -
-
-

Fair

- -
-
-

Poor

- -
+// Every rating, with its label +export const AllRatings: StoryFn = () => ( +
+ {[5, 4, 3, 2, 1].map((rating) => ( +
+ {rating}/5 + +
+ ))}
-); \ No newline at end of file +); diff --git a/src/components/atoms/RatingStars/RatingStars.tsx b/src/components/atoms/RatingStars/RatingStars.tsx index a2316ca9..53bb3dee 100644 --- a/src/components/atoms/RatingStars/RatingStars.tsx +++ b/src/components/atoms/RatingStars/RatingStars.tsx @@ -45,16 +45,10 @@ const RatingStars = ({ rating, className = "", animated = true }: RatingStarsPro } }; - // Hover animation for stars - const hoverAnimation = { - scale: 1.2, - rotate: 5, - transition: { duration: 0.2 } - }; - return ( diff --git a/src/components/atoms/ResponsiveImage/ResponsiveImage.css b/src/components/atoms/ResponsiveImage/ResponsiveImage.css index a3dd6d9b..cd4895bd 100644 --- a/src/components/atoms/ResponsiveImage/ResponsiveImage.css +++ b/src/components/atoms/ResponsiveImage/ResponsiveImage.css @@ -31,8 +31,9 @@ /* Security variants */ .responsive-image-security { - border: 1px solid rgba(var(--color-cyan-rgb), 0.3); - background-color: rgba(var(--color-navy-rgb), 0.1); + border: 1px solid var(--surface-border); + border-radius: var(--radius-card); + background-color: var(--surface-inset); } .responsive-image-security.loading { @@ -40,39 +41,40 @@ filter: blur(8px) brightness(0.7); background: linear-gradient( 45deg, - rgba(var(--color-navy-rgb), 0.3) 25%, - rgba(var(--color-cyan-rgb), 0.1) 50%, - rgba(var(--color-navy-rgb), 0.3) 75% + var(--surface-inset) 25%, + rgba(var(--color-primary-rgb), 0.1) 50%, + var(--surface-inset) 75% ); background-size: 200% 200%; /* Animation removed - now handled by framer-motion */ } .responsive-image-security.loaded { - box-shadow: 0 0 15px rgba(var(--color-cyan-rgb), 0.2); + box-shadow: var(--shadow-card); } .responsive-image-security.error { - border-color: var(--color-level-critical); + border-color: var(--color-danger); opacity: 0.7; filter: grayscale(1) brightness(0.7); } /* Terminal variants */ .responsive-image-terminal { - border: 2px solid var(--color-cyan); + border: 1px solid var(--surface-border-strong); + border-radius: var(--radius-card); padding: 2px; - background-color: var(--color-navy); + background-color: var(--surface-card); } .responsive-image-terminal.loading { - border: 2px dashed var(--color-cyan); + border: 1px solid var(--surface-border); opacity: 0.4; background: linear-gradient( 90deg, - var(--color-navy) 0%, - rgba(var(--color-cyan-rgb), 0.2) 50%, - var(--color-navy) 100% + var(--surface-inset) 0%, + rgba(var(--color-primary-rgb), 0.1) 50%, + var(--surface-inset) 100% ); background-size: 200% 100%; /* Animation removed - now handled by framer-motion */ @@ -83,8 +85,7 @@ } .responsive-image-terminal.error { - border-color: var(--color-level-critical); - border-style: dashed; + border-color: var(--color-danger); filter: grayscale(0.8) brightness(0.5); } diff --git a/src/components/atoms/ResponsiveImage/ResponsiveImage.stories.tsx b/src/components/atoms/ResponsiveImage/ResponsiveImage.stories.tsx index d550409c..0ef2bc1d 100644 --- a/src/components/atoms/ResponsiveImage/ResponsiveImage.stories.tsx +++ b/src/components/atoms/ResponsiveImage/ResponsiveImage.stories.tsx @@ -91,7 +91,7 @@ type Story = StoryObj; // Container to give the image reasonable dimensions const Container = ({ children, width = '300px', height = '200px' }: { children: ReactNode; width?: string; height?: string }) => ( -
+
{children}
); diff --git a/src/components/atoms/SchoolHeader/SchoolHeader.css b/src/components/atoms/SchoolHeader/SchoolHeader.css index 49605e40..59852778 100644 --- a/src/components/atoms/SchoolHeader/SchoolHeader.css +++ b/src/components/atoms/SchoolHeader/SchoolHeader.css @@ -1,37 +1,23 @@ /** - * School Header Component Styles + * School Header: the card heading. Inter semibold on the text colour. */ .school-header { - margin-bottom: var(--spacing-3); - position: relative; + min-width: 0; } .school-name { - font-size: var(--font-size-xl); - font-weight: var(--font-weight-bold); - color: var(--color-primary); + margin: 0; + font-family: var(--font-family-base); + font-size: var(--font-size-lg); + font-weight: var(--font-weight-semibold); line-height: 1.3; - display: inline-block; - margin-bottom: var(--spacing-2); + color: var(--color-text); + overflow-wrap: anywhere; } -.school-header-decoration { - display: block; - height: 3px; - width: 60px; - background: linear-gradient(to right, var(--color-primary), transparent); - border-radius: 2px; -} - -/* Responsive adaptations */ @media (max-width: 768px) { .school-name { - font-size: var(--font-size-lg); - } - - .school-header-decoration { - width: 40px; - height: 2px; + font-size: var(--font-size-md); } } diff --git a/src/components/atoms/SchoolHeader/SchoolHeader.stories.tsx b/src/components/atoms/SchoolHeader/SchoolHeader.stories.tsx index 1786dbb7..1c5fa1c2 100644 --- a/src/components/atoms/SchoolHeader/SchoolHeader.stories.tsx +++ b/src/components/atoms/SchoolHeader/SchoolHeader.stories.tsx @@ -1,68 +1,44 @@ -import type { Meta, StoryObj, StoryFn } from '@storybook/react-vite'; +import type { Meta, StoryObj } from '@storybook/react-vite'; import SchoolHeader from './SchoolHeader'; +import { educationInfo } from '@/portfolio'; const meta = { title: 'Atoms/SchoolHeader', component: SchoolHeader, tags: ['autodocs'], - argTypes: { - schoolName: { - control: 'text', - description: 'Name of the school or institution', - }, - className: { - control: 'text', - description: 'Additional CSS classes', + parameters: { + docs: { + description: { + component: 'The school name as a card heading: Inter semibold on the text colour. Long names wrap.', + }, }, }, + argTypes: { + schoolName: { control: 'text', description: 'Name of the school or institution' }, + className: { control: 'text', description: 'Additional CSS classes' }, + animated: { control: 'boolean', description: 'Whether the heading slides in' }, + }, } satisfies Meta; - export default meta; + type Story = StoryObj; -// Default story +/** The school from the real site data */ export const Default: Story = { - args: { - schoolName: 'University of Technology', - } + args: { schoolName: educationInfo[0].schoolName }, }; -// Long school name -export const LongSchoolName: Story = { - args: { - schoolName: 'Massachusetts Institute of Technology - School of Computer Science and Engineering', - } +export const ShortName: Story = { + args: { schoolName: 'Example University' }, }; -// With custom class -export const WithCustomClass: Story = { +export const LongName: Story = { args: { - schoolName: 'Stanford University', - className: 'highlighted-header', - } + schoolName: 'Example University, School of Engineering and Applied Sciences, Department of Computer Science', + }, + decorators: [(Story) =>
], }; -// Multiple schools example -export const MultipleSchools: StoryFn = () => ( -
- - - -
-); - -// With container -export const WithContainer: StoryFn = () => ( -
- -

- Founded in 1096, Oxford University is one of the oldest and most prestigious universities in the world. -

-
-); \ No newline at end of file +export const ReducedMotion: Story = { + args: { schoolName: 'Example University', animated: false }, +}; diff --git a/src/components/atoms/SchoolHeader/SchoolHeader.tsx b/src/components/atoms/SchoolHeader/SchoolHeader.tsx index b44666a7..c7fac0d6 100644 --- a/src/components/atoms/SchoolHeader/SchoolHeader.tsx +++ b/src/components/atoms/SchoolHeader/SchoolHeader.tsx @@ -1,5 +1,5 @@ import React from "react"; -import { motion, Variants } from 'framer-motion'; +import { motion } from 'framer-motion'; import { useMotionEnabled, slideUpVariants } from '@utils/motion'; import './SchoolHeader.css'; @@ -13,44 +13,22 @@ export interface SchoolHeaderProps { } /** - * A simple component for displaying the school/university name - * + * The school or university name, as a card heading. + * * @component */ const SchoolHeader = ({ schoolName, className = "", animated = true }: SchoolHeaderProps) => { // Animate only when the prop is on and reduced motion is not requested const shouldAnimate = useMotionEnabled(animated); - - // Decoration line animation - const decorationVariants: Variants = { - hidden: { width: 0, opacity: 0 }, - visible: { - width: "60px", - opacity: 1, - transition: { duration: 0.5, delay: 0.2 } - } - }; return ( - - - {schoolName} - - +

{schoolName}

); }; diff --git a/src/components/atoms/ScrollDown/ScrollDown.css b/src/components/atoms/ScrollDown/ScrollDown.css index 3270065e..8ef81dae 100644 --- a/src/components/atoms/ScrollDown/ScrollDown.css +++ b/src/components/atoms/ScrollDown/ScrollDown.css @@ -20,7 +20,8 @@ cursor: pointer; padding: 0; outline: none; - transition: all 0.3s ease; + border-radius: var(--radius-control); + transition: transform 0.3s ease; position: absolute; bottom: 2rem; left: 50%; @@ -32,33 +33,42 @@ } .scroll-down-container:focus-visible { - outline: 2px solid var(--color-cyan); - outline-offset: 4px; + box-shadow: var(--ring-focus); + outline: none; } /* Interface dots styling */ .interface-dot { - width: 2px; - height: 2px; - background-color: var(--color-cyan); - opacity: 0.6; + width: 3px; + height: 3px; + background-color: var(--color-primary); + opacity: 0.7; transition: all 0.3s ease; } +/* Line, markers and label */ +.scroll-down-line { background: var(--surface-border-strong); } +.scroll-down-base { background: var(--color-primary); } +.scroll-down-label { + color: var(--color-primary); + font-family: var(--font-family-jetbrains); +} + /* Data points animation */ .data-point { + background: var(--color-primary); transform-origin: center; transition: all 0.3s ease; } /* Hover effects */ .scroll-down-container:hover .data-point { + background: var(--color-primary); transform: scaleX(1.5); } .scroll-down-container:hover .interface-dot { opacity: 1; - box-shadow: 0 0 4px var(--color-cyan); } /* Terminal text effect */ @@ -74,7 +84,7 @@ top: 50%; width: 3px; height: 1px; - background-color: var(--color-cyan); + background-color: var(--color-primary); opacity: 0.6; } @@ -85,7 +95,7 @@ top: 50%; width: 3px; height: 1px; - background-color: var(--color-cyan); + background-color: var(--color-primary); opacity: 0.6; } @@ -103,3 +113,6 @@ } } + +.data-point--mid { opacity: 0.6; } +.data-point--low { opacity: 0.3; } diff --git a/src/components/atoms/ScrollDown/ScrollDown.stories.tsx b/src/components/atoms/ScrollDown/ScrollDown.stories.tsx index d743ad45..46bd2a9e 100644 --- a/src/components/atoms/ScrollDown/ScrollDown.stories.tsx +++ b/src/components/atoms/ScrollDown/ScrollDown.stories.tsx @@ -1,4 +1,5 @@ import type { Meta, StoryObj } from '@storybook/react-vite'; +import type { ComponentProps } from 'react'; import { action } from 'storybook/actions'; import ScrollDown from './ScrollDown'; @@ -48,10 +49,38 @@ const meta = { export default meta; type Story = StoryObj; +// The indicator is absolutely positioned at the bottom of its section +const HeroFrame = (args: ComponentProps) => ( +
+

Derek Mackley

+

+ Principal Security Engineer +

+ +
+); + export const Default: Story = { + render: (args) => , args: { onClick: action('scroll-clicked'), - label: 'SCROLL_DOWN', + label: '>>_NEXT', className: '' } }; diff --git a/src/components/atoms/ScrollDown/ScrollDown.tsx b/src/components/atoms/ScrollDown/ScrollDown.tsx index 31860995..4749fa70 100644 --- a/src/components/atoms/ScrollDown/ScrollDown.tsx +++ b/src/components/atoms/ScrollDown/ScrollDown.tsx @@ -1,6 +1,7 @@ import React, { memo } from 'react'; import { motion } from 'framer-motion'; import { useMotionEnabled } from '@utils/motion'; +import '@assets/css/tailwind.css'; import './ScrollDown.css'; /** @@ -75,19 +76,19 @@ const ScrollDown = ({ {/* Main indicator */}
{/* Central line with data points */} -
+
{/* Animated data points */} -
-
-
+
+
+
{/* Static base marker */} -
+
{/* Side interface elements */} @@ -109,7 +110,7 @@ const ScrollDown = ({ className="mt-2 terminal-text" animate={shouldAnimate ? labelVariants.animate : false} > - + {label} diff --git a/src/components/atoms/ScrollToTop/ScrollToTop.css b/src/components/atoms/ScrollToTop/ScrollToTop.css index e1fd1a6f..b7fbbdc5 100644 --- a/src/components/atoms/ScrollToTop/ScrollToTop.css +++ b/src/components/atoms/ScrollToTop/ScrollToTop.css @@ -1,39 +1,32 @@ -/* Scroll to top button styles */ +/* Scroll to top button: a round control on the raised navy surface */ .scroll-to-top { position: fixed; - bottom: 20px; - right: 20px; - width: 45px; - height: 45px; - background-color: var(--color-primary-600, #2563eb); - color: white; + bottom: var(--spacing-5, 1.25rem); + right: var(--spacing-5, 1.25rem); + width: 2.75rem; + height: 2.75rem; + background: var(--surface-card-raised); + color: var(--color-primary); + border: 1px solid var(--surface-border-strong); border-radius: 50%; - border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; z-index: 1000; - box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3), 0 0 15px rgba(59, 130, 246, 0.3); - /* Transitions now handled by framer-motion */ + box-shadow: var(--shadow-card); } -/* Hover styles are now handled by framer-motion variants */ -.scroll-to-top:focus { +.scroll-to-top:hover { + border-color: var(--color-primary); +} + +.scroll-to-top:focus-visible { + box-shadow: var(--ring-focus); outline: none; - box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.5); } .scroll-icon { width: 20px; height: 20px; } - -/* Accessibility considerations */ -@media (prefers-reduced-motion: reduce) { - /* Animations now controlled via AnimationContext and framer-motion */ - .scroll-to-top { - animation: none; - transition: background-color 0.2s ease; - } -} \ No newline at end of file diff --git a/src/components/atoms/ScrollToTop/ScrollToTop.stories.tsx b/src/components/atoms/ScrollToTop/ScrollToTop.stories.tsx index d27ee0fc..4ed9fec6 100644 --- a/src/components/atoms/ScrollToTop/ScrollToTop.stories.tsx +++ b/src/components/atoms/ScrollToTop/ScrollToTop.stories.tsx @@ -18,30 +18,6 @@ const meta = { export default meta; -// Create a container with scrollable content -const ScrollContainer = ({ children }: { children: ReactNode }) => ( -
-
- Scroll down to see the button appear -
- {children} -
- {Array.from({ length: 20 }).map((_, i) => ( -

- Scroll content {i + 1} -

- ))} -
-
-); - -// Default story -export const Default: StoryFn = () => ( - - - -); - const playbookSections = [ { title: 'Preparation', body: 'Keep an asset inventory, an on-call rota and tested backups. Agree severity levels and escalation paths before they are needed.' }, { title: 'Detection', body: 'Correlate endpoint, identity and network telemetry. Tune alerts so that every page is actionable and has an owner.' }, @@ -55,60 +31,61 @@ const playbookSections = [ { title: 'Hardening', body: 'Feed lessons back into detection rules, access policies and runbooks, then rehearse the scenario in a tabletop exercise.' }, ]; -// With custom content around it -export const WithContent: StoryFn = () => ( - -
-

Incident Response Playbook

-

A long-form page, as the ScrollToTop button would sit beside it on the site.

- {playbookSections.map(({ title, body }) => ( -
-

{title}

-

{body}

-
- ))} -
- -
+// Dark scrollable page with a sticky header, as the button sits on the site +const Header = ({ children }: { children: ReactNode }) => ( +
+ {children} +
); -// In a dark theme context -export const DarkTheme: StoryFn = () => ( -
-
- Dark theme example -
- {Array.from({ length: 20 }).map((_, i) => ( -

- Dark theme content {i + 1} -

+const Sections = () => ( +
+

Incident Response Playbook

+ {playbookSections.map(({ title, body }) => ( +
+

{title}

+

{body}

+
))} -
); +const ScrollContainer = ({ children }: { children: ReactNode }) => ( +
+
Scroll down past 300px and the button appears
+
+ +
+ {children} +
+); + +// Default story +export const Default: StoryFn = () => ( + + + +); + + // With reduced motion: the button appears and reacts without animation export const ReducedMotion: StoryFn = () => ( -
-
- Reduced motion: scroll down, the button appears without the slide-in +
+
Reduced motion: the button appears without the slide-in
+
+
-

- Animations are switched off with the animated prop, as they are when the visitor prefers reduced motion. Hover and tap effects are disabled too. -

- {Array.from({ length: 20 }).map((_, i) => ( -

- Content section {i + 1} -

- ))}
-); \ No newline at end of file +); diff --git a/src/components/atoms/ScrollToTop/ScrollToTop.tsx b/src/components/atoms/ScrollToTop/ScrollToTop.tsx index 7845971b..d8e2a22c 100644 --- a/src/components/atoms/ScrollToTop/ScrollToTop.tsx +++ b/src/components/atoms/ScrollToTop/ScrollToTop.tsx @@ -64,7 +64,7 @@ const ScrollToTop = ({ animated = true }: ScrollToTopProps) => { hover: { y: -5, scale: 1.05, - boxShadow: '0 6px 15px rgba(0, 0, 0, 0.4), 0 0 20px rgba(59, 130, 246, 0.5)', + boxShadow: 'var(--shadow-card-hover)', transition: { duration: 0.3 } diff --git a/src/components/atoms/SecurityBadge/SecurityBadge.css b/src/components/atoms/SecurityBadge/SecurityBadge.css index 799c57b2..c23b34b4 100644 --- a/src/components/atoms/SecurityBadge/SecurityBadge.css +++ b/src/components/atoms/SecurityBadge/SecurityBadge.css @@ -1,230 +1,69 @@ -/* SecurityBadge Component Styles - * Enhanced with improved readability, dark blue containers, and cybersecurity theming +/** + * SecurityBadge + * + * Chip family: --radius-chip, --surface-inset fill, --surface-border, + * JetBrains Mono xs text, no glow. Level modifiers only change the tone. */ .security-badge { + --tone: var(--color-primary); + --tone-rgb: var(--color-primary-rgb); + display: inline-flex; align-items: center; - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.95) 0%, - rgba(var(--color-navy-rgb), 0.9) 50%, - rgba(var(--color-navy-rgb), 0.95) 100% - ); - padding: var(--spacing-2) var(--spacing-4); - border-radius: var(--border-radius-pill); + gap: var(--spacing-2); + box-sizing: border-box; + min-height: 1.75rem; + padding: 0 var(--spacing-3); font-family: var(--font-family-jetbrains); - font-size: var(--font-size-sm); - font-weight: var(--font-weight-semibold); - color: var(--color-cyan); - letter-spacing: var(--letter-spacing-wide); - border: 1px solid rgba(var(--color-cyan-rgb), 0.4); - box-shadow: - 0 3px 10px rgba(0, 0, 0, 0.3), - 0 0 12px rgba(var(--color-cyan-rgb), 0.1), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.1); - backdrop-filter: blur(8px); - position: relative; - overflow: hidden; - text-shadow: 0 0 4px rgba(var(--color-cyan-rgb), 0.4); - min-height: 32px; -} - -/* Enhanced grid pattern overlay */ -.security-badge::before { - content: ''; - position: absolute; - inset: 0; - background: - repeating-linear-gradient( - 45deg, - transparent, - transparent 1px, - rgba(var(--color-cyan-rgb), 0.02) 1px, - rgba(var(--color-cyan-rgb), 0.02) 2px - ); - opacity: 0.7; - pointer-events: none; - border-radius: var(--border-radius-pill); + font-size: var(--font-size-xs); + font-weight: var(--font-weight-medium); + letter-spacing: var(--letter-spacing-technical); + color: var(--tone); + background: var(--surface-inset); + border: 1px solid var(--surface-border-strong); + border-radius: var(--radius-chip); } .security-badge__icon { - color: var(--color-cyan); - margin-right: var(--spacing-2); - font-size: var(--font-size-base); - filter: drop-shadow(0 0 3px rgba(var(--color-cyan-rgb), 0.4)); - position: relative; - z-index: 1; + color: var(--tone); + font-size: var(--font-size-sm); + flex-shrink: 0; } .security-badge__text { - font-weight: var(--font-weight-semibold); - position: relative; - z-index: 1; white-space: nowrap; } -/* Hover effects */ -.security-badge:hover { - border-color: rgba(var(--color-cyan-rgb), 0.6); - box-shadow: - 0 4px 12px rgba(0, 0, 0, 0.4), - 0 0 16px rgba(var(--color-cyan-rgb), 0.15), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.12); - text-shadow: 0 0 6px rgba(var(--color-cyan-rgb), 0.6); -} - -.security-badge:hover .security-badge__icon { - filter: drop-shadow(0 0 5px rgba(var(--color-cyan-rgb), 0.6)); -} - -/* Security level variants */ +/* Levels */ .security-badge--low { - color: var(--color-level-low); - border-color: rgba(var(--color-level-low-rgb), 0.4); - text-shadow: 0 0 4px rgba(var(--color-level-low-rgb), 0.4); -} - -.security-badge--low .security-badge__icon { - color: var(--color-level-low); - filter: drop-shadow(0 0 3px rgba(var(--color-level-low-rgb), 0.4)); -} - -.security-badge--low:hover { - border-color: rgba(var(--color-level-low-rgb), 0.6); - text-shadow: 0 0 6px rgba(var(--color-level-low-rgb), 0.6); + --tone: var(--color-level-low); + --tone-rgb: var(--color-level-low-rgb); } .security-badge--medium { - color: var(--color-level-medium); - border-color: rgba(var(--color-level-medium-rgb), 0.4); - text-shadow: 0 0 4px rgba(var(--color-level-medium-rgb), 0.4); -} - -.security-badge--medium .security-badge__icon { - color: var(--color-level-medium); - filter: drop-shadow(0 0 3px rgba(var(--color-level-medium-rgb), 0.4)); -} - -.security-badge--medium:hover { - border-color: rgba(var(--color-level-medium-rgb), 0.6); - text-shadow: 0 0 6px rgba(var(--color-level-medium-rgb), 0.6); + --tone: var(--color-level-medium); + --tone-rgb: var(--color-level-medium-rgb); } .security-badge--high { - color: var(--color-level-high); - border-color: rgba(var(--color-level-high-rgb), 0.4); - text-shadow: 0 0 4px rgba(var(--color-level-high-rgb), 0.4); -} - -.security-badge--high .security-badge__icon { - color: var(--color-level-high); - filter: drop-shadow(0 0 3px rgba(var(--color-level-high-rgb), 0.4)); -} - -.security-badge--high:hover { - border-color: rgba(var(--color-level-high-rgb), 0.6); - text-shadow: 0 0 6px rgba(var(--color-level-high-rgb), 0.6); + --tone: var(--color-level-high); + --tone-rgb: var(--color-level-high-rgb); } .security-badge--critical { - color: var(--color-level-critical); - border-color: rgba(var(--color-level-critical-rgb), 0.5); - text-shadow: 0 0 5px rgba(var(--color-level-critical-rgb), 0.5); - font-weight: var(--font-weight-bold); - box-shadow: - 0 4px 12px rgba(0, 0, 0, 0.4), - 0 0 15px rgba(var(--color-level-critical-rgb), 0.15), - inset 0 1px 0 rgba(var(--color-level-critical-rgb), 0.1); -} - -.security-badge--critical .security-badge__icon { - color: var(--color-level-critical); - filter: drop-shadow(0 0 4px rgba(var(--color-level-critical-rgb), 0.5)); + --tone: var(--color-level-critical); + --tone-rgb: var(--color-level-critical-rgb); } -.security-badge--critical:hover { - border-color: rgba(var(--color-level-critical-rgb), 0.7); - text-shadow: 0 0 8px rgba(var(--color-level-critical-rgb), 0.7); - box-shadow: - 0 5px 15px rgba(0, 0, 0, 0.5), - 0 0 20px rgba(var(--color-level-critical-rgb), 0.2), - inset 0 1px 0 rgba(var(--color-level-critical-rgb), 0.15); +.security-badge--low, +.security-badge--medium, +.security-badge--high, +.security-badge--critical { + border-color: rgba(var(--tone-rgb), 0.45); } -/* Focus styles for accessibility */ .security-badge:focus-visible { - outline: 2px solid var(--color-cyan); - outline-offset: 2px; -} - -.security-badge--low:focus-visible { - outline-color: var(--color-level-low); -} - -.security-badge--medium:focus-visible { - outline-color: var(--color-level-medium); -} - -.security-badge--high:focus-visible { - outline-color: var(--color-level-high); + outline: none; + box-shadow: var(--ring-focus); } - -.security-badge--critical:focus-visible { - outline-color: var(--color-level-critical); -} - -/* Responsive adjustments with better touch targets */ -@media (max-width: 768px) { - .security-badge { - font-size: var(--font-size-sm); - padding: var(--spacing-2) var(--spacing-3); - min-height: 30px; - } - - .security-badge__icon { - font-size: var(--font-size-sm); - margin-right: var(--spacing-1); - } -} - -@media (max-width: 480px) { - .security-badge { - font-size: var(--font-size-xs); - padding: var(--spacing-1) var(--spacing-3); - min-height: 28px; - } - - .security-badge__icon { - font-size: var(--font-size-xs); - margin-right: var(--spacing-1); - } -} - -/* High contrast mode support */ -@media (prefers-contrast: high) { - .security-badge { - border-width: 2px; - background: rgba(var(--color-navy-rgb), 0.98); - text-shadow: none; - } - - .security-badge::before { - display: none; - } - - .security-badge__icon { - filter: none; - } -} - -/* Reduced motion preferences */ -@media (prefers-reduced-motion: reduce) { - .security-badge { - transition: none; - } - - .security-badge:hover { - transform: none; - } -} \ No newline at end of file diff --git a/src/components/atoms/SecurityBadge/SecurityBadge.stories.tsx b/src/components/atoms/SecurityBadge/SecurityBadge.stories.tsx index 7078a80b..f9b98302 100644 --- a/src/components/atoms/SecurityBadge/SecurityBadge.stories.tsx +++ b/src/components/atoms/SecurityBadge/SecurityBadge.stories.tsx @@ -17,7 +17,7 @@ const meta = { parameters: { docs: { description: { - component: 'Security-themed badge component with icon and text for displaying security credentials or roles.', + component: 'Chip-family badge with an icon and text, for credentials or roles: inset fill, 1px border, JetBrains Mono xs text.', }, }, componentSubtitle: 'A security component for displaying credentials and roles', @@ -39,7 +39,7 @@ const Template = (args: SecurityBadgeProps) => ( @@ -62,7 +62,7 @@ export const Default: Story = { export const WithLockIcon: Story = { render: Template, args: { - text: 'Security Clearance: Level 5', + text: 'Zero Trust Architect', icon: FaLock, animate: true, }, @@ -74,7 +74,7 @@ export const WithLockIcon: Story = { export const WithUserShieldIcon: Story = { render: Template, args: { - text: 'Security Administrator', + text: 'Incident Commander', icon: FaUserShield, animate: true, }, diff --git a/src/components/atoms/SecurityClassification/SecurityClassification.css b/src/components/atoms/SecurityClassification/SecurityClassification.css index d03fee75..32e9d51f 100644 --- a/src/components/atoms/SecurityClassification/SecurityClassification.css +++ b/src/components/atoms/SecurityClassification/SecurityClassification.css @@ -1,31 +1,33 @@ /** - * SecurityClassification Atom Component Styles - * Isolated security classification banner with animated bars + * SecurityClassification + * + * A classification banner. Same family as the chips: inset fill, hairline + * border, small mono text, no glow. Colour carries the level: cyan for the + * default (declassified), green for secure, and red only for the alarming + * levels (breach, critical). */ .security-classification { + --tone-rgb: var(--color-primary-rgb); + --tone: var(--color-primary); + display: flex; align-items: center; justify-content: space-between; - padding: 0.75rem 1rem; + padding: var(--spacing-2) var(--spacing-4); margin: 0 -2rem 1.5rem; - background: linear-gradient( - 90deg, - rgba(var(--color-cyan-rgb), 0.1), - rgba(var(--color-cyan-rgb), 0.05), - rgba(var(--color-cyan-rgb), 0.1) - ); - border-top: 1px solid rgba(var(--color-cyan-rgb), 0.3); - border-bottom: 1px solid rgba(var(--color-cyan-rgb), 0.3); + background: var(--surface-inset); + border-top: 1px solid rgba(var(--tone-rgb), 0.3); + border-bottom: 1px solid rgba(var(--tone-rgb), 0.3); font-family: var(--font-family-jetbrains); } .security-classification__label { - color: var(--color-cyan); - font-size: 0.8rem; - font-weight: 700; - letter-spacing: 2px; - text-shadow: 0 0 8px rgba(var(--color-cyan-rgb), 0.5); + color: var(--tone); + font-size: var(--font-size-xs); + font-weight: var(--font-weight-semibold); + letter-spacing: var(--letter-spacing-technical); + text-transform: uppercase; } .security-classification__bars { @@ -36,72 +38,21 @@ .security-classification__bar { width: 3px; height: 16px; - background: rgba(var(--color-cyan-rgb), 0.6); + background: rgba(var(--tone-rgb), 0.6); border-radius: 1px; } -/* Variant Styles */ .security-classification--secure { - background: linear-gradient( - 90deg, - rgba(34, 197, 94, 0.1), - rgba(34, 197, 94, 0.05), - rgba(34, 197, 94, 0.1) - ); - border-top-color: rgba(34, 197, 94, 0.3); - border-bottom-color: rgba(34, 197, 94, 0.3); -} - -.security-classification--secure .security-classification__label { - color: var(--color-green-400); - text-shadow: 0 0 8px rgba(34, 197, 94, 0.5); -} - -.security-classification--secure .security-classification__bar { - background: rgba(34, 197, 94, 0.6); -} - -.security-classification--breach { - background: linear-gradient( - 90deg, - rgba(248, 113, 113, 0.1), - rgba(248, 113, 113, 0.05), - rgba(248, 113, 113, 0.1) - ); - border-top-color: rgba(248, 113, 113, 0.3); - border-bottom-color: rgba(248, 113, 113, 0.3); -} - -.security-classification--breach .security-classification__label { - color: var(--color-red-400); - text-shadow: 0 0 8px rgba(248, 113, 113, 0.5); -} - -.security-classification--breach .security-classification__bar { - background: rgba(248, 113, 113, 0.6); + --tone-rgb: var(--color-level-low-rgb); + --tone: var(--color-level-low); } +.security-classification--breach, .security-classification--critical { - background: linear-gradient( - 90deg, - rgba(251, 191, 36, 0.1), - rgba(251, 191, 36, 0.05), - rgba(251, 191, 36, 0.1) - ); - border-top-color: rgba(251, 191, 36, 0.3); - border-bottom-color: rgba(251, 191, 36, 0.3); -} - -.security-classification--critical .security-classification__label { - color: var(--color-yellow-400); - text-shadow: 0 0 8px rgba(251, 191, 36, 0.5); + --tone-rgb: var(--color-level-critical-rgb); + --tone: var(--color-level-critical); } -.security-classification--critical .security-classification__bar { - background: rgba(251, 191, 36, 0.6); -} - -/* Responsive adjustments */ @media (max-width: 768px) { .security-classification { margin: 0 -1.25rem 1.25rem; @@ -111,13 +62,6 @@ @media (max-width: 480px) { .security-classification { margin: 0 -1rem 1rem; - padding: 0.5rem 0.75rem; + padding: var(--spacing-2) var(--spacing-3); } } - -/* Reduced motion */ -@media (prefers-reduced-motion: reduce) { - .security-classification__bar { - animation: none; - } -} \ No newline at end of file diff --git a/src/components/atoms/SecurityClassification/SecurityClassification.stories.tsx b/src/components/atoms/SecurityClassification/SecurityClassification.stories.tsx index 71816f51..13b4e7b2 100644 --- a/src/components/atoms/SecurityClassification/SecurityClassification.stories.tsx +++ b/src/components/atoms/SecurityClassification/SecurityClassification.stories.tsx @@ -6,14 +6,19 @@ const meta = { component: SecurityClassification, parameters: { layout: 'centered', - backgrounds: { - default: 'dark', - values: [ - { name: 'dark', value: '#0a192f' }, - { name: 'navy', value: '#162b3d' }, - ], + docs: { + description: { + component: 'A classification banner in the chip family. Cyan is the neutral default (declassified), green is secure, and red is kept for the alarming levels (breach, critical).', + }, }, }, + decorators: [ + (Story) => ( +
+ +
+ ), + ], argTypes: { animated: { control: 'boolean', description: 'Play animations; reduced motion always turns them off' }, variant: { @@ -66,7 +71,7 @@ export const Critical: Story = { export const CustomLabel: Story = { args: { - label: 'TOP SECRET', + label: 'INTERNAL USE ONLY', variant: 'default', expanded: true } diff --git a/src/components/atoms/SkeletonCard/SkeletonCard.css b/src/components/atoms/SkeletonCard/SkeletonCard.css index c3216f22..07b8416c 100644 --- a/src/components/atoms/SkeletonCard/SkeletonCard.css +++ b/src/components/atoms/SkeletonCard/SkeletonCard.css @@ -1,246 +1,108 @@ -/** - * SkeletonCard Component - * - * Styles for the skeleton loading cards with security-themed variants. - * Note: Animations are now managed by framer-motion through the AnimationContext +/* + * SkeletonCard: loading placeholders on the shared card surface. + * Blocks use the inset fill; a soft cyan-navy shimmer sweeps across. + * Shimmer is hidden for reduced motion and when animation is off. */ -/* Base skeleton card */ [class*="-card-skeleton"] { position: relative; overflow: hidden; - background-color: var(--color-gray-100); - border-radius: var(--border-radius); - padding: 1rem; - margin-bottom: 1rem; - /* Animation removed - now handled by framer-motion */ + background: var(--surface-card); + border: 1px solid var(--surface-border); + border-radius: var(--radius-card); + box-shadow: var(--shadow-card); + padding: var(--spacing-4); + margin-bottom: var(--spacing-4); } -/* Security-themed skeleton cards */ [class*="-card-skeleton"].security { - background-color: var(--color-navy); - border: 1px solid rgba(var(--color-cyan-rgb), 0.3); - padding: 1rem; + border-color: var(--surface-border-strong); } -/* Terminal-themed skeleton cards */ [class*="-card-skeleton"].terminal { - background-color: var(--color-navy); - border: 1px solid var(--color-cyan); - border-left: 3px solid var(--color-cyan); - padding: 1rem; font-family: var(--font-family-jetbrains); } -/* Elements in skeleton cards */ +/* Placeholder blocks */ .skeleton-title, .skeleton-description, .skeleton-tags, .skeleton-actions, .skeleton-header, -.skeleton-subtitle { - background-color: var(--color-gray-200); - border-radius: var(--border-radius-sm); - margin-bottom: 0.5rem; -} - -/* Security-themed elements */ -.security .skeleton-title, -.security .skeleton-description, -.security .skeleton-tags, -.security .skeleton-actions, -.security .skeleton-header, -.security .skeleton-subtitle { - background-color: rgba(var(--color-navy-rgb), 0.5); - border: 1px solid rgba(var(--color-cyan-rgb), 0.1); -} - -/* Terminal-themed elements */ -.terminal .skeleton-title, -.terminal .skeleton-description, -.terminal .skeleton-tags, -.terminal .skeleton-actions, -.terminal .skeleton-header, -.terminal .skeleton-subtitle { - background-color: rgba(var(--color-navy-rgb), 0.7); - border: 1px dashed rgba(var(--color-cyan-rgb), 0.2); -} - -/* Specific element dimensions */ -.skeleton-title { - height: 1.5rem; - width: 70%; -} - -.skeleton-description { - height: 1rem; - width: 100%; +.skeleton-subtitle, +.skeleton-image, +.skeleton-image-circle, +.skeleton-icon, +.skeleton-name { + background-color: var(--surface-inset); + border: 1px solid var(--surface-divider); } +.skeleton-title, +.skeleton-description, +.skeleton-tags, +.skeleton-actions, +.skeleton-header, .skeleton-subtitle { - height: 1rem; - width: 50%; -} - -.skeleton-tags { - height: 1.5rem; - width: 80%; -} - -.skeleton-actions { - height: 2rem; - width: 50%; -} - -.skeleton-header { - height: 2rem; - width: 100%; + border-radius: var(--radius-control); + margin-bottom: var(--spacing-2); } -/* Security-themed title */ -.security .skeleton-title { - border-left: 3px solid var(--color-cyan); -} - -/* Terminal-themed description */ -.terminal .skeleton-description { - height: 0.8rem; - margin-bottom: 0.8rem; -} +.skeleton-title { height: 1.5rem; width: 70%; } +.skeleton-description { height: 1rem; width: 100%; } +.skeleton-subtitle { height: 1rem; width: 50%; } +.skeleton-tags { height: 1.5rem; width: 80%; border-radius: var(--radius-chip); } +.skeleton-actions { height: 2rem; width: 50%; } +.skeleton-header { height: 2rem; width: 100%; } -/* Image placeholders */ .skeleton-image { width: 100%; height: 160px; - background-color: var(--color-gray-200); - border-radius: var(--border-radius-sm); - margin-bottom: 1rem; + border-radius: var(--radius-control); + margin-bottom: var(--spacing-4); } .skeleton-image-circle { width: 60px; height: 60px; - background-color: var(--color-gray-200); border-radius: 50%; - margin-bottom: 1rem; + margin-bottom: var(--spacing-4); } -/* Security-themed images */ -.security .skeleton-image, -.security .skeleton-image-circle { - background-color: rgba(var(--color-navy-rgb), 0.5); - border: 1px solid rgba(var(--color-cyan-rgb), 0.2); -} - -/* Terminal-themed images */ -.terminal .skeleton-image { - border: 1px dashed var(--color-cyan); - background-color: rgba(var(--color-navy-rgb), 0.7); -} - -.terminal .skeleton-image-circle { - border: 1px dashed var(--color-cyan); - background-color: transparent; -} - -/* Icon placeholder */ .skeleton-icon { width: 3rem; height: 3rem; - background-color: var(--color-gray-200); - border-radius: var(--border-radius-sm); - margin: 0 auto 0.5rem; -} - -/* Security-themed icon */ -.security .skeleton-icon { - background-color: rgba(var(--color-navy-rgb), 0.5); - border: 1px solid rgba(var(--color-cyan-rgb), 0.3); - border-radius: 8px; -} - -/* Terminal-themed icon */ -.terminal .skeleton-icon { - background-color: rgba(var(--color-navy-rgb), 0.7); - border: 1px dashed var(--color-cyan); - border-radius: 4px; + border-radius: var(--radius-control); + margin: 0 auto var(--spacing-2); } -/* Skill name placeholder */ .skeleton-name { width: 80%; height: 1rem; - background-color: var(--color-gray-200); - border-radius: var(--border-radius-sm); + border-radius: var(--radius-control); margin: 0 auto; } -/* Security-themed name */ -.security .skeleton-name { - background-color: rgba(var(--color-navy-rgb), 0.5); - border: 1px solid rgba(var(--color-cyan-rgb), 0.1); -} - -/* Terminal-themed name */ -.terminal .skeleton-name { - background-color: rgba(var(--color-navy-rgb), 0.7); - border: 1px dashed rgba(var(--color-cyan-rgb), 0.2); -} - -/* Shimmer effect overlay - static styling, animation now handled by framer-motion */ +/* Shimmer overlay: position is driven by framer-motion */ .skeleton-shimmer { position: absolute; - top: 0; - left: 0; - width: 100%; - height: 100%; - background: linear-gradient( - 90deg, - rgba(255, 255, 255, 0) 0%, - rgba(255, 255, 255, 0.2) 50%, - rgba(255, 255, 255, 0) 100% - ); - background-size: 200% 100%; - /* Animation removed - now handled by framer-motion */ -} - -/* Security-themed shimmer */ -.security .skeleton-shimmer { + inset: 0; + pointer-events: none; background: linear-gradient( 90deg, - rgba(var(--color-cyan-rgb), 0) 0%, - rgba(var(--color-cyan-rgb), 0.1) 50%, - rgba(var(--color-cyan-rgb), 0) 100% + transparent 0%, + rgba(var(--color-primary-rgb), 0.08) 50%, + transparent 100% ); background-size: 200% 100%; - /* Animation removed - now handled by framer-motion */ } -/* Terminal-themed shimmer */ -.terminal .skeleton-shimmer { - background: linear-gradient( - 90deg, - rgba(var(--color-navy-rgb), 0) 0%, - rgba(var(--color-cyan-rgb), 0.05) 50%, - rgba(var(--color-navy-rgb), 0) 100% - ); - background-size: 200% 100%; - /* Animation removed - now handled by framer-motion */ +.skeleton-static .skeleton-shimmer { + display: none; } -/* - * Animations removed - now implemented with framer-motion variants - * @keyframes fadeIn {...} - * @keyframes shimmer {...} - */ - -/* Reduced motion preferences - No longer needed as handled by AnimationContext */ @media (prefers-reduced-motion: reduce) { - [class*="-card-skeleton"] { - /* No CSS animations to disable - framer-motion handles reduced motion preferences */ - } - .skeleton-shimmer { - /* No CSS animations to disable - framer-motion handles reduced motion preferences */ + display: none; } } diff --git a/src/components/atoms/SkeletonCard/SkeletonCard.tsx b/src/components/atoms/SkeletonCard/SkeletonCard.tsx index 4cc287d5..5598eed7 100644 --- a/src/components/atoms/SkeletonCard/SkeletonCard.tsx +++ b/src/components/atoms/SkeletonCard/SkeletonCard.tsx @@ -38,6 +38,7 @@ const SkeletonCard = ({ const combinedClassName = [ baseClass, variant, // Will add 'security' or 'terminal' class if provided + shouldAnimate ? '' : 'skeleton-static', className ].filter(Boolean).join(' '); diff --git a/src/components/atoms/Skill/Skill.css b/src/components/atoms/Skill/Skill.css index 9d9286ff..418fa960 100644 --- a/src/components/atoms/Skill/Skill.css +++ b/src/components/atoms/Skill/Skill.css @@ -1,12 +1,8 @@ -/** - * Skill Component - * - * Styles for the Skill component following atomic design principles. - * Updated with improved readability, dark blue containers, and enhanced cybersecurity theming. - * Animations now handled by framer-motion. +/* + * Skill: an icon tile on the shared card surface, with an optional + * proficiency badge. Animations are handled by framer-motion. */ -/* Base skill icon wrapper with improved spacing */ .skill-icon-wrapper { position: relative; display: inline-flex; @@ -15,380 +11,96 @@ margin: var(--spacing-2); cursor: pointer; padding: var(--spacing-1); - border-radius: 8px; - transition: none; /* animations handled by framer-motion */ + border-radius: var(--radius-card); } -/* Skill icon container with dark blue background */ .skill-icon { display: flex; justify-content: center; align-items: center; width: 100%; height: 100%; - border-radius: 8px; - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.95) 0%, - rgba(var(--color-navy-rgb), 0.9) 100% - ); - border: 1px solid rgba(var(--color-cyan-rgb), 0.3); - overflow: hidden; - box-shadow: - 0 3px 8px rgba(0, 0, 0, 0.3), - 0 0 12px rgba(var(--color-cyan-rgb), 0.08), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.1); - backdrop-filter: blur(8px); + border-radius: var(--radius-card); + background: var(--surface-card); + border: 1px solid var(--surface-border); + box-shadow: var(--shadow-card); position: relative; } -/* Enhanced grid pattern for skill icons */ -.skill-icon::after { - content: ''; - position: absolute; - inset: 0; - background: - repeating-linear-gradient( - 0deg, - transparent, - transparent 1px, - rgba(var(--color-cyan-rgb), 0.02) 1px, - rgba(var(--color-cyan-rgb), 0.02) 2px - ), - repeating-linear-gradient( - 90deg, - transparent, - transparent 1px, - rgba(var(--color-cyan-rgb), 0.02) 1px, - rgba(var(--color-cyan-rgb), 0.02) 2px - ); - opacity: 0.6; - pointer-events: none; -} - -/* Enhanced security-themed skill icon */ .skill-security .skill-icon { - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.98) 0%, - rgba(var(--color-navy-rgb), 0.95) 100% - ); - border: 1px solid rgba(var(--color-cyan-rgb), 0.5); - box-shadow: - 0 4px 12px rgba(0, 0, 0, 0.4), - 0 0 15px rgba(var(--color-cyan-rgb), 0.15), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.12); - backdrop-filter: blur(10px); -} - -.skill-security .skill-icon::after { - background: - repeating-linear-gradient( - 45deg, - transparent, - transparent 1px, - rgba(var(--color-cyan-rgb), 0.03) 1px, - rgba(var(--color-cyan-rgb), 0.03) 2px - ); - opacity: 0.8; -} - -/* Size variants with improved proportions */ -.skill-icon-sm { - width: 2.75rem; - height: 2.75rem; + background: var(--surface-card-raised); + border-color: var(--surface-border-strong); } -.skill-icon-md { - width: 3.75rem; - height: 3.75rem; -} +/* Sizes */ +.skill-icon-sm { width: 2.75rem; height: 2.75rem; } +.skill-icon-md { width: 3.75rem; height: 3.75rem; } +.skill-icon-lg { width: 5.25rem; height: 5.25rem; } -.skill-icon-lg { - width: 5.25rem; - height: 5.25rem; -} - -/* Security size variants with slightly larger dimensions */ -.skill-security.skill-icon-sm { - width: 3rem; - height: 3rem; -} - -.skill-security.skill-icon-md { - width: 4rem; - height: 4rem; -} - -.skill-security.skill-icon-lg { - width: 5.5rem; - height: 5.5rem; -} +.skill-security.skill-icon-sm { width: 3rem; height: 3rem; } +.skill-security.skill-icon-md { width: 4rem; height: 4rem; } +.skill-security.skill-icon-lg { width: 5.5rem; height: 5.5rem; } -/* Enhanced skill SVG icon with better contrast */ .skill-icon-svg { width: 1.75rem; height: 1.75rem; - color: var(--color-cyan); - filter: drop-shadow(0 0 3px rgba(var(--color-cyan-rgb), 0.3)); + color: var(--color-primary); position: relative; - z-index: 1; } -.skill-icon-sm .skill-icon-svg { - width: 1.5rem; - height: 1.5rem; -} - -.skill-icon-md .skill-icon-svg { - width: 2rem; - height: 2rem; -} - -.skill-icon-lg .skill-icon-svg { - width: 2.75rem; - height: 2.75rem; -} - -/* Enhanced security-themed skill SVG icon */ -.skill-security .skill-icon-svg { - color: var(--color-cyan); - filter: drop-shadow(0 0 4px rgba(var(--color-cyan-rgb), 0.6)); - text-shadow: 0 0 8px rgba(var(--color-cyan-rgb), 0.4); -} +.skill-icon-sm .skill-icon-svg { width: 1.5rem; height: 1.5rem; } +.skill-icon-md .skill-icon-svg { width: 2rem; height: 2rem; } +.skill-icon-lg .skill-icon-svg { width: 2.75rem; height: 2.75rem; } -/* Improved proficiency level indicator */ +/* Proficiency badge: a small mono chip on the tile corner */ .skill-level { position: absolute; bottom: -6px; right: -6px; - width: 1.2rem; - height: 1.2rem; - border-radius: 50%; - background: linear-gradient( - 135deg, - var(--color-cyan) 0%, - color-mix(in srgb, var(--color-cyan) 85%, var(--color-primary-dark)) 100% - ); - border: 2px solid rgba(var(--color-navy-rgb), 0.9); + min-width: 1.25rem; + height: 1.25rem; + padding: 0 var(--spacing-1); + border-radius: var(--radius-chip); + background: var(--surface-card-raised); + border: 1px solid var(--color-primary); + color: var(--color-primary); display: flex; justify-content: center; align-items: center; - font-size: 0.7rem; - color: var(--color-navy); + font-size: var(--font-size-xs); font-weight: var(--font-weight-bold); font-family: var(--font-family-jetbrains); - box-shadow: - 0 2px 6px rgba(0, 0, 0, 0.3), - 0 0 8px rgba(var(--color-cyan-rgb), 0.3); - text-shadow: 0 1px 1px rgba(var(--color-navy-rgb), 0.3); z-index: 2; } -/* Enhanced security-themed proficiency levels */ -.skill-security .skill-level { - bottom: -8px; - right: -8px; - width: 1.4rem; - height: 1.4rem; - background: linear-gradient( - 135deg, - rgba(var(--color-navy-rgb), 0.95) 0%, - rgba(var(--color-navy-rgb), 0.9) 100% - ); - border: 2px solid var(--color-cyan); - color: var(--color-cyan); - font-family: var(--font-family-jetbrains); - box-shadow: - 0 3px 8px rgba(0, 0, 0, 0.4), - 0 0 10px rgba(var(--color-cyan-rgb), 0.3), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.1); - text-shadow: 0 0 4px rgba(var(--color-cyan-rgb), 0.5); -} - -.skill-security .skill-level.level-1 { - background: linear-gradient( - 135deg, - var(--color-level-low) 0%, - color-mix(in srgb, var(--color-level-low) 85%, black) 100% - ); - color: var(--color-white); - border-color: var(--color-level-low); - text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3); -} - -.skill-security .skill-level.level-2 { - background: linear-gradient( - 135deg, - var(--color-level-medium) 0%, - color-mix(in srgb, var(--color-level-medium) 85%, black) 100% - ); +/* Higher levels read as stronger, not as danger: cyan fills in */ +.skill-level.level-4, +.skill-level.level-5 { + background: var(--color-primary); color: var(--color-navy); - border-color: var(--color-level-medium); - text-shadow: 0 1px 1px rgba(var(--color-navy-rgb), 0.3); -} - -.skill-security .skill-level.level-3 { - background: linear-gradient( - 135deg, - var(--color-level-high) 0%, - color-mix(in srgb, var(--color-level-high) 85%, black) 100% - ); - color: var(--color-white); - border-color: var(--color-level-high); - text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3); } -.skill-security .skill-level.level-4 { - background: linear-gradient( - 135deg, - var(--color-level-critical) 0%, - color-mix(in srgb, var(--color-level-critical) 85%, black) 100% - ); - color: var(--color-white); - border-color: var(--color-level-critical); - text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4); - box-shadow: - 0 3px 8px rgba(0, 0, 0, 0.4), - 0 0 12px rgba(var(--color-level-critical-rgb), 0.4); -} - -.skill-security .skill-level.level-5 { - background: linear-gradient( - 135deg, - var(--color-level-critical) 0%, - color-mix(in srgb, var(--color-level-critical) 90%, white) 100% - ); - color: var(--color-white); - border-color: color-mix(in srgb, var(--color-level-critical) 90%, white); - text-shadow: 0 1px 1px rgba(0, 0, 0, 0.4); - box-shadow: - 0 4px 10px rgba(0, 0, 0, 0.5), - 0 0 15px rgba(var(--color-level-critical-rgb), 0.5), - inset 0 1px 0 rgba(255, 255, 255, 0.1); - animation: critical-pulse 2s ease-in-out infinite alternate; -} - -@keyframes critical-pulse { - 0% { - box-shadow: - 0 4px 10px rgba(0, 0, 0, 0.5), - 0 0 15px rgba(var(--color-level-critical-rgb), 0.5); - } - 100% { - box-shadow: - 0 4px 10px rgba(0, 0, 0, 0.5), - 0 0 20px rgba(var(--color-level-critical-rgb), 0.7); - } -} - -/* Hover enhancement for skill wrapper */ .skill-icon-wrapper:hover .skill-icon { - border-color: rgba(var(--color-cyan-rgb), 0.5); - box-shadow: - 0 4px 12px rgba(0, 0, 0, 0.4), - 0 0 16px rgba(var(--color-cyan-rgb), 0.15), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.12); + border-color: var(--surface-border-strong); + box-shadow: var(--shadow-card-hover); } -.skill-icon-wrapper:hover .skill-icon-svg { - filter: drop-shadow(0 0 5px rgba(var(--color-cyan-rgb), 0.5)); -} - -.skill-security .skill-icon-wrapper:hover .skill-icon { - border-color: rgba(var(--color-cyan-rgb), 0.7); - box-shadow: - 0 5px 15px rgba(0, 0, 0, 0.5), - 0 0 20px rgba(var(--color-cyan-rgb), 0.2), - inset 0 1px 0 rgba(var(--color-cyan-rgb), 0.15); -} - -.skill-security .skill-icon-wrapper:hover .skill-icon-svg { - filter: drop-shadow(0 0 6px rgba(var(--color-cyan-rgb), 0.7)); -} - -/* Accessibility: Enhanced focus styles */ .skill-icon-wrapper:focus-visible { - outline: 2px solid var(--color-cyan); - outline-offset: 3px; - border-radius: 10px; -} - -.skill-security:focus-visible { - outline: 2px solid var(--color-cyan); - outline-offset: 3px; - box-shadow: - 0 0 0 4px rgba(var(--color-cyan-rgb), 0.3), - 0 4px 12px rgba(0, 0, 0, 0.4); -} - -/* Reduced motion support */ -@media (prefers-reduced-motion: reduce) { - .skill-security .skill-level.level-5 { - animation: none; - } - - @keyframes critical-pulse { - 0%, 100% { - box-shadow: - 0 4px 10px rgba(0, 0, 0, 0.5), - 0 0 15px rgba(var(--color-level-critical-rgb), 0.5); - } - } + box-shadow: var(--ring-focus); + outline: none; } -/* High contrast mode support */ @media (prefers-contrast: high) { - .skill-icon { - border-width: 2px; - background: rgba(var(--color-navy-rgb), 0.98); - } - - .skill-icon::after { - display: none; - } - - .skill-icon-svg { - filter: none; - text-shadow: none; - } - - .skill-level { - border-width: 3px; - font-weight: var(--font-weight-bold); - } + .skill-icon { border-width: 2px; } + .skill-level { border-width: 2px; } } -/* Responsive adjustments */ @media (max-width: 768px) { .skill-icon-wrapper { margin: var(--spacing-1); padding: calc(var(--spacing-1) / 2); } - - .skill-icon-sm { - width: 2.5rem; - height: 2.5rem; - } - - .skill-icon-md { - width: 3.5rem; - height: 3.5rem; - } - - .skill-icon-lg { - width: 4.75rem; - height: 4.75rem; - } - - .skill-level { - width: 1.1rem; - height: 1.1rem; - font-size: 0.65rem; - } - - .skill-security .skill-level { - width: 1.25rem; - height: 1.25rem; - } -} \ No newline at end of file + .skill-icon-sm { width: 2.5rem; height: 2.5rem; } + .skill-icon-md { width: 3.5rem; height: 3.5rem; } + .skill-icon-lg { width: 4.75rem; height: 4.75rem; } +} diff --git a/src/components/atoms/Skill/Skill.stories.tsx b/src/components/atoms/Skill/Skill.stories.tsx index b174bb23..76e51566 100644 --- a/src/components/atoms/Skill/Skill.stories.tsx +++ b/src/components/atoms/Skill/Skill.stories.tsx @@ -132,8 +132,9 @@ const exampleSkills = [ const SkillContainer = ({ children, style = {} }: { children: ReactNode; style?: CSSProperties }) => (
{children} @@ -142,8 +143,15 @@ const SkillContainer = ({ children, style = {} }: { children: ReactNode; style?: // Default skill export const Default: StoryFn = () => ( - - + +

+ Toolbox +

+
+ {exampleSkills.map((skill, index) => ( + + ))} +
); @@ -152,15 +160,15 @@ export const Sizes: StoryFn = () => (
-

Small

+

Small

-

Medium

+

Medium

-

Large

+

Large

@@ -172,11 +180,11 @@ export const Variants: StoryFn = () => (
-

Default

+

Default

-

Security

+

Security

@@ -189,7 +197,7 @@ export const WithLevels: StoryFn = () => (
{exampleSkills.slice(0, 5).map((skill, index) => (
-

Level {skill.level}

+

Level {skill.level}

(
-

Frontend

+

Frontend

{exampleSkills .filter(skill => skill.category === 'frontend') @@ -241,7 +249,7 @@ export const SkillGrid: StoryFn = () => (
-

Backend

+

Backend

{exampleSkills .filter(skill => skill.category === 'backend') @@ -258,7 +266,7 @@ export const SkillGrid: StoryFn = () => (
-

DevOps & Cloud

+

DevOps & Cloud

{exampleSkills .filter(skill => ['devops', 'cloud'].includes(skill.category)) @@ -281,7 +289,7 @@ export const SkillGrid: StoryFn = () => ( export const Responsive: StoryFn = () => (
-

Desktop View

+

Desktop View

( -

Mobile View

+

Mobile View