|
| 1 | +import React, { type ReactNode, useState } from "react"; |
| 2 | +import clsx from "clsx"; |
| 3 | +import type { Props } from "@theme/NotFound/Content"; |
| 4 | +import Heading from "@theme/Heading"; |
| 5 | + |
| 6 | +// --- Style Definitions --- |
| 7 | + |
| 8 | +// The main "card" background, from your footer's gradient |
| 9 | +const wrapperStyle: React.CSSProperties = { |
| 10 | + background: |
| 11 | + "linear-gradient(135deg, #0f0f23 0%, #1a1a2e 25%, #16213e 50%, #0f3460 75%, #533483 100%)", |
| 12 | + borderRadius: "16px", |
| 13 | + padding: "4rem 2rem", // More vertical padding |
| 14 | + border: "1px solid rgba(255, 255, 255, 0.1)", |
| 15 | + boxShadow: "0 16px 40px rgba(0, 0, 0, 0.3)", |
| 16 | + position: "relative", |
| 17 | + overflow: "hidden", |
| 18 | + textAlign: "center", |
| 19 | +}; |
| 20 | + |
| 21 | +// The giant "404" watermark |
| 22 | +const big404Style: React.CSSProperties = { |
| 23 | + position: "absolute", |
| 24 | + fontSize: "20rem", |
| 25 | + fontWeight: 700, |
| 26 | + lineHeight: 1, |
| 27 | + color: "#A740F2", // Electric purple |
| 28 | + opacity: 0.05, // Make it very subtle on the dark background |
| 29 | + top: "-2rem", |
| 30 | + left: 0, |
| 31 | + right: 0, |
| 32 | + zIndex: 1, |
| 33 | + userSelect: "none", |
| 34 | +}; |
| 35 | + |
| 36 | +// Gradient text for the main title, like in your footer |
| 37 | +const titleStyle: React.CSSProperties = { |
| 38 | + background: "linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%)", |
| 39 | + WebkitBackgroundClip: "text", |
| 40 | + WebkitTextFillColor: "transparent", |
| 41 | + backgroundClip: "text", |
| 42 | + color: "transparent", // Fallback |
| 43 | + marginBottom: "1rem", |
| 44 | + position: "relative", |
| 45 | + zIndex: 2, // Above the watermark |
| 46 | +}; |
| 47 | + |
| 48 | +// Style for the paragraph text |
| 49 | +const textStyle: React.CSSProperties = { |
| 50 | + color: "#cbd5e1", // Light, soft gray |
| 51 | + fontSize: "1.25rem", |
| 52 | + fontWeight: 300, |
| 53 | + position: "relative", |
| 54 | + zIndex: 2, |
| 55 | +}; |
| 56 | + |
| 57 | +// Button style from your footer's newsletter button |
| 58 | +const buttonStyle: React.CSSProperties = { |
| 59 | + background: "linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%)", |
| 60 | + color: "#ffffff", |
| 61 | + borderColor: "transparent", |
| 62 | + fontWeight: 700, |
| 63 | + textTransform: "uppercase", |
| 64 | + letterSpacing: "0.5px", |
| 65 | + padding: "14px 28px", |
| 66 | + borderRadius: "12px", |
| 67 | + boxShadow: |
| 68 | + "0 8px 24px rgba(102, 126, 234, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2)", |
| 69 | + transition: "all 0.3s ease", |
| 70 | + position: "relative", |
| 71 | + zIndex: 2, |
| 72 | + cursor: "pointer", |
| 73 | + textDecoration: "none", |
| 74 | +}; |
| 75 | + |
| 76 | +// Button hover effect, also from your CSS |
| 77 | +const buttonHoverStyle: React.CSSProperties = { |
| 78 | + transform: "translateY(-2px) scale(1.02)", |
| 79 | + boxShadow: |
| 80 | + "0 12px 32px rgba(102, 126, 234, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.3)", |
| 81 | +}; |
| 82 | + |
| 83 | +// --- The Component --- |
| 84 | + |
| 85 | +export default function NotFoundContent({ className }: Props): ReactNode { |
| 86 | + // We use state to toggle the hover style for the button |
| 87 | + const [isHovered, setIsHovered] = useState(false); |
| 88 | + |
| 89 | + return ( |
| 90 | + <main className={clsx("margin-vert--xl container", className)}> |
| 91 | + <div className="row"> |
| 92 | + {/* We apply the card style to the column */} |
| 93 | + <div className={clsx("col col--8 col--offset-2")} style={wrapperStyle}> |
| 94 | + <div style={big404Style}>404</div> |
| 95 | + |
| 96 | + <Heading as="h1" className="hero__title" style={titleStyle}> |
| 97 | + Page Not Found |
| 98 | + </Heading> |
| 99 | + |
| 100 | + <p style={textStyle}>Looks like you've ventured into the unknown.</p> |
| 101 | + <p |
| 102 | + style={{ |
| 103 | + ...textStyle, |
| 104 | + fontSize: "1rem", |
| 105 | + fontWeight: 400, |
| 106 | + opacity: 0.8, |
| 107 | + }} |
| 108 | + > |
| 109 | + Let's get you back to safety. |
| 110 | + </p> |
| 111 | + |
| 112 | + <div style={{ marginTop: "2rem" }}> |
| 113 | + <a |
| 114 | + href="/" |
| 115 | + className="button" // Remove button--primary, we are fully custom |
| 116 | + style={ |
| 117 | + isHovered |
| 118 | + ? { ...buttonStyle, ...buttonHoverStyle } |
| 119 | + : buttonStyle |
| 120 | + } |
| 121 | + onMouseEnter={() => setIsHovered(true)} |
| 122 | + onMouseLeave={() => setIsHovered(false)} |
| 123 | + > |
| 124 | + Back to RecodeHive |
| 125 | + </a> |
| 126 | + </div> |
| 127 | + </div> |
| 128 | + </div> |
| 129 | + </main> |
| 130 | + ); |
| 131 | +} |
0 commit comments