|
1 | 1 | import Link from 'next/link' |
2 | | -import { motion, useMotionTemplate, useMotionValue } from 'framer-motion' |
| 2 | +import {motion, useMotionTemplate, useMotionValue} from 'framer-motion' |
3 | 3 |
|
4 | | -import { GridPattern } from '@/components/GridPattern' |
5 | | -import { Heading } from '@/components/Heading' |
6 | | -import { ChatBubbleIcon } from '@/components/icons/ChatBubbleIcon' |
7 | | -import { EnvelopeIcon } from '@/components/icons/EnvelopeIcon' |
8 | | -import { UserIcon } from '@/components/icons/UserIcon' |
9 | | -import { UsersIcon } from '@/components/icons/UsersIcon' |
| 4 | +import {GridPattern} from '@/components/GridPattern' |
| 5 | +import {Heading} from '@/components/Heading' |
| 6 | +import {ShapesIcon} from "@/components/icons/ShapesIcon"; |
| 7 | +import {MapPinIcon} from "@/components/icons/MapPinIcon"; |
| 8 | +import {SquaresPlusIcon} from "@/components/icons/SquaresPlusIcon"; |
10 | 9 |
|
11 | 10 | const resources = [ |
12 | | - { |
13 | | - href: '/messages', |
14 | | - name: 'Messages', |
15 | | - description: |
16 | | - 'Learn about the message model and how to create, retrieve, update, delete, and list messages.', |
17 | | - icon: EnvelopeIcon, |
18 | | - pattern: { |
19 | | - y: 32, |
20 | | - squares: [ |
21 | | - [0, 2], |
22 | | - [1, 4], |
23 | | - ], |
| 11 | + { |
| 12 | + href: '/phone-numbers', |
| 13 | + name: 'Phone numbers', |
| 14 | + description: |
| 15 | + 'Learn about the Phone Numbers model and how to query for a phone number that you are checking is good or bad to call.', |
| 16 | + icon: ShapesIcon, |
| 17 | + pattern: { |
| 18 | + y: 32, |
| 19 | + squares: [ |
| 20 | + [0, 2], |
| 21 | + [1, 4], |
| 22 | + ], |
| 23 | + }, |
24 | 24 | }, |
25 | | - }, |
26 | | - { |
27 | | - href: '/groups', |
28 | | - name: 'Groups', |
29 | | - description: |
30 | | - 'Learn about the group model and how to create, retrieve, update, delete, and list groups.', |
31 | | - icon: UsersIcon, |
32 | | - pattern: { |
33 | | - y: 22, |
34 | | - squares: [[0, 1]], |
| 25 | + { |
| 26 | + href: '/ip-addresses', |
| 27 | + name: 'IP addresses', |
| 28 | + description: |
| 29 | + 'Learn about the IP address model and how to query for the source address of a early reconnaissance attack.', |
| 30 | + icon: MapPinIcon, |
| 31 | + pattern: { |
| 32 | + y: 22, |
| 33 | + squares: [[0, 1]], |
| 34 | + }, |
| 35 | + }, |
| 36 | + { |
| 37 | + href: '/honeypot-events', |
| 38 | + name: 'Honeypot events', |
| 39 | + description: |
| 40 | + 'Learn about the Events model and how to create a honeypot event you have detected on your network.', |
| 41 | + icon: SquaresPlusIcon, |
| 42 | + pattern: { |
| 43 | + y: 22, |
| 44 | + squares: [[0, 1]], |
| 45 | + }, |
35 | 46 | }, |
36 | | - }, |
37 | 47 | ] |
38 | 48 |
|
39 | | -function ResourceIcon({ icon: Icon }) { |
40 | | - return ( |
41 | | - <div className="flex h-7 w-7 items-center justify-center rounded-full bg-zinc-900/5 ring-1 ring-zinc-900/25 backdrop-blur-[2px] transition duration-300 group-hover:bg-white/50 group-hover:ring-zinc-900/25 dark:bg-white/7.5 dark:ring-white/15 dark:group-hover:bg-indigo-300/10 dark:group-hover:ring-indigo-400"> |
42 | | - <Icon className="h-5 w-5 fill-zinc-700/10 stroke-zinc-700 transition-colors duration-300 group-hover:stroke-zinc-900 dark:fill-white/10 dark:stroke-zinc-400 dark:group-hover:fill-indigo-300/10 dark:group-hover:stroke-indigo-400" /> |
43 | | - </div> |
44 | | - ) |
| 49 | +function ResourceIcon({icon: Icon}) { |
| 50 | + return ( |
| 51 | + <div |
| 52 | + className="flex h-7 w-7 items-center justify-center rounded-full bg-zinc-900/5 ring-1 ring-zinc-900/25 backdrop-blur-[2px] transition duration-300 group-hover:bg-white/50 group-hover:ring-zinc-900/25 dark:bg-white/7.5 dark:ring-white/15 dark:group-hover:bg-indigo-300/10 dark:group-hover:ring-indigo-400"> |
| 53 | + <Icon |
| 54 | + className="h-5 w-5 fill-zinc-700/10 stroke-zinc-700 transition-colors duration-300 group-hover:stroke-zinc-900 dark:fill-white/10 dark:stroke-zinc-400 dark:group-hover:fill-indigo-300/10 dark:group-hover:stroke-indigo-400"/> |
| 55 | + </div> |
| 56 | + ) |
45 | 57 | } |
46 | 58 |
|
47 | | -function ResourcePattern({ mouseX, mouseY, ...gridProps }) { |
48 | | - let maskImage = useMotionTemplate`radial-gradient(180px at ${mouseX}px ${mouseY}px, white, transparent)` |
49 | | - let style = { maskImage, WebkitMaskImage: maskImage } |
| 59 | +function ResourcePattern({mouseX, mouseY, ...gridProps}) { |
| 60 | + let maskImage = useMotionTemplate`radial-gradient(180px at ${mouseX}px ${mouseY}px, white, transparent)` |
| 61 | + let style = {maskImage, WebkitMaskImage: maskImage} |
50 | 62 |
|
51 | | - return ( |
52 | | - <div className="pointer-events-none"> |
53 | | - <div className="absolute inset-0 rounded-2xl transition duration-300 [mask-image:linear-gradient(white,transparent)] group-hover:opacity-50"> |
54 | | - <GridPattern |
55 | | - width={72} |
56 | | - height={56} |
57 | | - x="50%" |
58 | | - className="absolute inset-x-0 inset-y-[-30%] h-[160%] w-full skew-y-[-18deg] fill-black/[0.02] stroke-black/5 dark:fill-white/1 dark:stroke-white/2.5" |
59 | | - {...gridProps} |
60 | | - /> |
61 | | - </div> |
62 | | - <motion.div |
63 | | - className="absolute inset-0 rounded-2xl bg-gradient-to-r from-[#6D50A0] to-indigo-600/30 opacity-0 transition duration-300 group-hover:opacity-100 dark:from-[#202D2E] dark:to-[#303428]" |
64 | | - style={style} |
65 | | - /> |
66 | | - <motion.div |
67 | | - className="absolute inset-0 rounded-2xl opacity-0 mix-blend-overlay transition duration-300 group-hover:opacity-100" |
68 | | - style={style} |
69 | | - > |
70 | | - <GridPattern |
71 | | - width={72} |
72 | | - height={56} |
73 | | - x="50%" |
74 | | - className="absolute inset-x-0 inset-y-[-30%] h-[160%] w-full skew-y-[-18deg] fill-black/50 stroke-black/70 dark:fill-white/2.5 dark:stroke-white/10" |
75 | | - {...gridProps} |
76 | | - /> |
77 | | - </motion.div> |
78 | | - </div> |
79 | | - ) |
| 63 | + return ( |
| 64 | + <div className="pointer-events-none"> |
| 65 | + <div |
| 66 | + className="absolute inset-0 rounded-2xl transition duration-300 [mask-image:linear-gradient(white,transparent)] group-hover:opacity-50"> |
| 67 | + <GridPattern |
| 68 | + width={72} |
| 69 | + height={56} |
| 70 | + x="50%" |
| 71 | + className="absolute inset-x-0 inset-y-[-30%] h-[160%] w-full skew-y-[-18deg] fill-black/[0.02] stroke-black/5 dark:fill-white/1 dark:stroke-white/2.5" |
| 72 | + {...gridProps} |
| 73 | + /> |
| 74 | + </div> |
| 75 | + <motion.div |
| 76 | + className="absolute inset-0 rounded-2xl bg-gradient-to-r from-[#6D50A0] to-indigo-600/30 opacity-0 transition duration-300 group-hover:opacity-100 dark:from-[#202D2E] dark:to-[#303428]" |
| 77 | + style={style} |
| 78 | + /> |
| 79 | + <motion.div |
| 80 | + className="absolute inset-0 rounded-2xl opacity-0 mix-blend-overlay transition duration-300 group-hover:opacity-100" |
| 81 | + style={style} |
| 82 | + > |
| 83 | + <GridPattern |
| 84 | + width={72} |
| 85 | + height={56} |
| 86 | + x="50%" |
| 87 | + className="absolute inset-x-0 inset-y-[-30%] h-[160%] w-full skew-y-[-18deg] fill-black/50 stroke-black/70 dark:fill-white/2.5 dark:stroke-white/10" |
| 88 | + {...gridProps} |
| 89 | + /> |
| 90 | + </motion.div> |
| 91 | + </div> |
| 92 | + ) |
80 | 93 | } |
81 | 94 |
|
82 | | -function Resource({ resource }) { |
83 | | - let mouseX = useMotionValue(0) |
84 | | - let mouseY = useMotionValue(0) |
| 95 | +function Resource({resource}) { |
| 96 | + let mouseX = useMotionValue(0) |
| 97 | + let mouseY = useMotionValue(0) |
85 | 98 |
|
86 | | - function onMouseMove({ currentTarget, clientX, clientY }) { |
87 | | - let { left, top } = currentTarget.getBoundingClientRect() |
88 | | - mouseX.set(clientX - left) |
89 | | - mouseY.set(clientY - top) |
90 | | - } |
| 99 | + function onMouseMove({currentTarget, clientX, clientY}) { |
| 100 | + let {left, top} = currentTarget.getBoundingClientRect() |
| 101 | + mouseX.set(clientX - left) |
| 102 | + mouseY.set(clientY - top) |
| 103 | + } |
91 | 104 |
|
92 | | - return ( |
93 | | - <div |
94 | | - key={resource.href} |
95 | | - onMouseMove={onMouseMove} |
96 | | - className="group relative flex rounded-2xl bg-zinc-50 transition-shadow hover:shadow-md hover:shadow-zinc-900/5 dark:bg-white/2.5 dark:hover:shadow-black/5" |
97 | | - > |
98 | | - <ResourcePattern {...resource.pattern} mouseX={mouseX} mouseY={mouseY} /> |
99 | | - <div className="absolute inset-0 rounded-2xl ring-1 ring-inset ring-zinc-900/7.5 group-hover:ring-zinc-900/10 dark:ring-white/10 dark:group-hover:ring-white/20" /> |
100 | | - <div className="relative rounded-2xl px-4 pb-4 pt-16"> |
101 | | - <ResourceIcon icon={resource.icon} /> |
102 | | - <h3 className="mt-4 text-sm font-semibold leading-7 text-zinc-900 dark:text-white"> |
103 | | - <Link href={resource.href}> |
104 | | - <span className="absolute inset-0 rounded-2xl" /> |
105 | | - {resource.name} |
106 | | - </Link> |
107 | | - </h3> |
108 | | - <p className="mt-1 text-sm text-zinc-600 dark:text-zinc-400"> |
109 | | - {resource.description} |
110 | | - </p> |
111 | | - </div> |
112 | | - </div> |
113 | | - ) |
| 105 | + return ( |
| 106 | + <div |
| 107 | + key={resource.href} |
| 108 | + onMouseMove={onMouseMove} |
| 109 | + className="group relative flex rounded-2xl bg-zinc-50 transition-shadow hover:shadow-md hover:shadow-zinc-900/5 dark:bg-white/2.5 dark:hover:shadow-black/5" |
| 110 | + > |
| 111 | + <ResourcePattern {...resource.pattern} mouseX={mouseX} mouseY={mouseY}/> |
| 112 | + <div |
| 113 | + className="absolute inset-0 rounded-2xl ring-1 ring-inset ring-zinc-900/7.5 group-hover:ring-zinc-900/10 dark:ring-white/10 dark:group-hover:ring-white/20"/> |
| 114 | + <div className="relative rounded-2xl px-4 pb-4 pt-16"> |
| 115 | + <ResourceIcon icon={resource.icon}/> |
| 116 | + <h3 className="mt-4 text-sm font-semibold leading-7 text-zinc-900 dark:text-white"> |
| 117 | + <Link href={resource.href}> |
| 118 | + <span className="absolute inset-0 rounded-2xl"/> |
| 119 | + {resource.name} |
| 120 | + </Link> |
| 121 | + </h3> |
| 122 | + <p className="mt-1 text-sm text-zinc-600 dark:text-zinc-400"> |
| 123 | + {resource.description} |
| 124 | + </p> |
| 125 | + </div> |
| 126 | + </div> |
| 127 | + ) |
114 | 128 | } |
115 | 129 |
|
116 | 130 | export function Resources() { |
117 | | - return ( |
118 | | - <div className="my-16 xl:max-w-none"> |
119 | | - <Heading level={2} id="resources"> |
120 | | - Resources |
121 | | - </Heading> |
122 | | - <div className="not-prose mt-4 grid grid-cols-1 gap-8 border-t border-zinc-900/5 pt-10 dark:border-white/5 sm:grid-cols-2 xl:grid-cols-4"> |
123 | | - {resources.map((resource) => ( |
124 | | - <Resource key={resource.href} resource={resource} /> |
125 | | - ))} |
126 | | - </div> |
127 | | - </div> |
128 | | - ) |
| 131 | + return ( |
| 132 | + <div className="my-16 xl:max-w-none"> |
| 133 | + <Heading level={2} id="resources"> |
| 134 | + Resources |
| 135 | + </Heading> |
| 136 | + <div |
| 137 | + className="not-prose mt-4 grid grid-cols-1 gap-8 border-t border-zinc-900/5 pt-10 dark:border-white/5 sm:grid-cols-2 xl:grid-cols-4"> |
| 138 | + {resources.map((resource) => ( |
| 139 | + <Resource key={resource.href} resource={resource}/> |
| 140 | + ))} |
| 141 | + </div> |
| 142 | + </div> |
| 143 | + ) |
129 | 144 | } |
0 commit comments