import React, { useState, useEffect, useRef } from 'react';
import { Save, Instagram, Linkedin, Mail, Twitter, MousePointer, Pencil, Eraser, X, Wind, Star } from 'lucide-react';
const App = () => {
const [is90sMode, setIs90sMode] = useState(false);
// Paint State
const canvasRef = useRef(null);
const [isDrawing, setIsDrawing] = useState(false);
const [tool, setTool] = useState('cursor'); // cursor, pencil, eraser, spray
const [color, setColor] = useState('#000000');
const [brushSize, setBrushSize] = useState(2);
// Toggle the retro mode
const toggleRetroMode = () => {
setIs90sMode(!is90sMode);
if (!is90sMode) {
setTool('pencil');
} else {
setTool('cursor');
}
};
// Canvas Logic
useEffect(() => {
if (is90sMode && canvasRef.current) {
const canvas = canvasRef.current;
const ctx = canvas.getContext('2d');
const handleResize = () => {
const tempCanvas = document.createElement('canvas');
tempCanvas.width = canvas.width;
tempCanvas.height = canvas.height;
tempCanvas.getContext('2d').drawImage(canvas, 0, 0);
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
ctx.drawImage(tempCanvas, 0, 0);
};
canvas.width = window.innerWidth;
canvas.height = window.innerHeight;
window.addEventListener('resize', handleResize);
return () => window.removeEventListener('resize', handleResize);
}
}, [is90sMode]);
const startDrawing = (e) => {
if (tool === 'cursor') return;
const { offsetX, offsetY } = e.nativeEvent;
const ctx = canvasRef.current.getContext('2d');
ctx.beginPath();
ctx.moveTo(offsetX, offsetY);
setIsDrawing(true);
draw(e);
};
const draw = (e) => {
if (!isDrawing || tool === 'cursor') return;
const { offsetX, offsetY } = e.nativeEvent;
const ctx = canvasRef.current.getContext('2d');
if (tool === 'spray') {
ctx.fillStyle = color;
const sprayRadius = 20;
const dotsPerFrame = 10;
for (let i = 0; i < dotsPerFrame; i++) {
const angle = Math.random() * Math.PI * 2;
const radius = Math.random() * sprayRadius;
const x = offsetX + Math.cos(angle) * radius;
const y = offsetY + Math.sin(angle) * radius;
ctx.fillRect(x, y, 1, 1);
}
} else {
ctx.lineTo(offsetX, offsetY);
ctx.strokeStyle = tool === 'eraser' ? (is90sMode ? '#c0c0c0' : '#ffffff') : color;
ctx.globalCompositeOperation = tool === 'eraser' ? 'destination-out' : 'source-over';
ctx.lineWidth = tool === 'eraser' ? 20 : brushSize;
ctx.lineCap = 'round';
ctx.stroke();
ctx.globalCompositeOperation = 'source-over';
}
};
const stopDrawing = () => {
if (isDrawing) {
const ctx = canvasRef.current.getContext('2d');
ctx.closePath();
setIsDrawing(false);
}
};
// Dog Cursor Logic
useEffect(() => {
const cursorStyleId = 'dog-cursor-styles';
let styleElement = document.getElementById(cursorStyleId);
if (is90sMode) {
// Create the 8-bit dog cursor as a base64 encoded SVG for maximum compatibility
// This represents a merle dog with floppy ears and a pink collar
const dogSvg = `
`;
const encodedSvg = btoa(dogSvg);
const cursorUrl = `url('data:image/svg+xml;base64,${encodedSvg}') 16 16, auto`;
if (!styleElement) {
styleElement = document.createElement('style');
styleElement.id = cursorStyleId;
document.head.appendChild(styleElement);
}
// If tool is 'cursor', force the dog cursor everywhere
if (tool === 'cursor') {
styleElement.innerHTML = `
* { cursor: ${cursorUrl} !important; }
a, button, [role="button"] { cursor: ${cursorUrl} !important; }
`;
} else {
// If using drawing tools, use crosshair
styleElement.innerHTML = `
* { cursor: crosshair !important; }
`;
}
} else {
if (styleElement) {
styleElement.remove();
}
}
return () => {
if (styleElement) styleElement.remove();
};
}, [is90sMode, tool]);
return (
{is90sMode && (
<>
Tool Box
setTool('cursor')}
className={`w-8 h-8 flex items-center justify-center border-t border-l border-white border-b border-r border-gray-800 ${tool === 'cursor' ? 'bg-white border-none shadow-inner' : 'bg-[#C0C0C0]'}`}
title="Dog Select"
>
setTool('eraser')}
className={`w-8 h-8 flex items-center justify-center border-t border-l border-white border-b border-r border-gray-800 ${tool === 'eraser' ? 'bg-white border-none shadow-inner' : 'bg-[#C0C0C0]'}`}
title="Eraser"
>
setTool('pencil')}
className={`w-8 h-8 flex items-center justify-center border-t border-l border-white border-b border-r border-gray-800 ${tool === 'pencil' ? 'bg-white border-none shadow-inner' : 'bg-[#C0C0C0]'}`}
title="Pencil"
>
setTool('spray')}
className={`w-8 h-8 flex items-center justify-center border-t border-l border-white border-b border-r border-gray-800 ${tool === 'spray' ? 'bg-white border-none shadow-inner' : 'bg-[#C0C0C0]'}`}
title="Spray Paint"
>
{['#000000', '#808080', '#800000', '#808000', '#008000', '#008080', '#000080', '#800080', '#ffffff', '#c0c0c0', '#ff0000', '#ffff00', '#00ff00', '#00ffff', '#0000ff', '#ff00ff'].map((c) => (
{ setColor(c); setTool(tool === 'eraser' || tool === 'cursor' ? 'pencil' : tool); }}
className="w-4 h-4 border border-gray-400 active:border-black"
style={{ backgroundColor: c }}
/>
))}
{tool.toUpperCase()}
>
)}
{is90sMode && (
*** WELCOME TO ANNEKE'S CYBERSPACE *** BEST VIEWED IN NETSCAPE NAVIGATOR *** SIGN THE GUESTBOOK *** UNDER CONSTRUCTION ***
)}
{is90sMode ? 'Anneke\'s Page' : 'ANNEKE VAN DEN HOF.'}
{is90sMode ? (
Welcome to my Web Zone!
) : (
<>
MARKETING
AND
BRAND STRATEGY.
>
)}
{is90sMode ? (
<>
I am a marketer living in Halifax. I like surfing the web and hanging with Tater Tot .
>
) : (
"My career has been focused on marketing, advertising account service, creative strategy, and creative operations. My goal has been to understand what’s working on any team, and where we can find more effective, creative, and inclusive ways to work."
)}
{is90sMode && (
)}
{!is90sMode && (
<>
>
)}
Insert Photo
{!is90sMode && (
BASED IN HALIFAX
)}
{is90sMode && (
)}
);
};
export default App;