-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomponent.jsx
More file actions
444 lines (439 loc) · 14.9 KB
/
component.jsx
File metadata and controls
444 lines (439 loc) · 14.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
/**
* v0 by Vercel.
* @see https://v0.dev/t/ziQM9L6atoV
* Documentation: https://v0.dev/docs#integrating-generated-code-into-your-nextjs-app
*/
"use client"
import { useState } from "react"
import { Input } from "@/components/ui/input"
import { Button } from "@/components/ui/button"
import Link from "next/link"
import { Pagination, PaginationContent, PaginationItem, PaginationLink } from "@/components/ui/pagination"
import { Card, CardHeader, CardTitle, CardContent } from "@/components/ui/card"
import { Label } from "@/components/ui/label"
import { Textarea } from "@/components/ui/textarea"
export default function Component() {
const [searchTerm, setSearchTerm] = useState("")
const [filteredAds, setFilteredAds] = useState([
{
image: "/placeholder.svg?height=400&width=600",
title: "软件工程师",
description: "寻求具有丰富JavaScript技能的有经验软件工程师。",
type: "工程",
salary: "80,000 - 120,000",
requirements: {
experience: "3年以上",
education: "计算机科学或相关领域的学士学位",
skills: ["JavaScript", "React", "Node.js"],
},
companyWebsite: "https://www.acme.com",
isEditable: true,
},
{
image: "/placeholder.svg?height=400&width=600",
title: "营销协调员",
description: "加入我们充满活力的营销团队,助力业务增长。",
type: "营销",
salary: "45,000 - 55,000",
requirements: {
experience: "1-2年",
education: "营销或传播学士学位",
skills: ["社交媒体", "内容创作", "电子邮件营销"],
},
companyWebsite: "https://www.example.com",
isEditable: true,
},
{
image: "/placeholder.svg?height=400&width=600",
title: "平面设计师",
description: "寻求一位才华横溢的平面设计师,创造出视觉震撼的设计。",
type: "设计",
salary: "55,000 - 70,000",
requirements: {
experience: "2-4年",
education: "平面设计或相关领域的学士学位",
skills: ["Adobe创意套件", "排版", "品牌设计"],
},
companyWebsite: "https://www.design.com",
isEditable: true,
},
{
image: "/placeholder.svg?height=400&width=600",
title: "产品经理",
description: "寻求一位出色的产品经理,推动产品创新与发展。",
type: "产品",
salary: "70,000 - 100,000",
requirements: {
experience: "3-5年",
education: "工商管理或相关领域的学士学位",
skills: ["用户研究", "产品策略", "项目管理"],
},
companyWebsite: "https://www.product.com",
isEditable: false,
},
{
image: "/placeholder.svg?height=400&width=600",
title: "数据分析师",
description: "寻求一位精通数据分析的专业人士,为业务提供数据支持。",
type: "数据",
salary: "60,000 - 80,000",
requirements: {
experience: "2-4年",
education: "统计学或相关领域的学士学位",
skills: ["SQL", "Python", "Power BI"],
},
companyWebsite: "https://www.data.com",
isEditable: false,
},
{
image: "/placeholder.svg?height=400&width=600",
title: "内容编辑",
description: "寻求一位出色的内容编辑,为我们的网站创作优质内容。",
type: "内容",
salary: "45,000 - 55,000",
requirements: {
experience: "1-3年",
education: "新闻传播或相关领域的学士学位",
skills: ["写作", "编辑", "SEO"],
},
companyWebsite: "https://www.content.com",
isEditable: true,
},
{
image: "/placeholder.svg?height=400&width=600",
title: "项目经理",
description: "寻求一位富有经验的项目经理,带领团队高效交付项目。",
type: "项目",
salary: "70,000 - 90,000",
requirements: {
experience: "4-6年",
education: "工程管理或相关领域的学士学位",
skills: ["项目管理", "沟通协调", "风险管理"],
},
companyWebsite: "https://www.project.com",
isEditable: false,
},
{
image: "/placeholder.svg?height=400&width=600",
title: "市场营销专员",
description: "寻求一位热情洋溢的市场营销专员,推动产品销售。",
type: "营销",
salary: "40,000 - 50,000",
requirements: {
experience: "1-2年",
education: "营销或相关领域的学士学位",
skills: ["活动策划", "广告投放", "数据分析"],
},
companyWebsite: "https://www.marketing.com",
isEditable: true,
},
{
image: "/placeholder.svg?height=400&width=600",
title: "用户体验设计师",
description: "寻求一位出色的用户体验设计师,打造优秀的产品交互体验。",
type: "设计",
salary: "60,000 - 80,000",
requirements: {
experience: "2-4年",
education: "交互设计或相关领域的学士学位",
skills: ["Figma", "用户研究", "交互设计"],
},
companyWebsite: "https://www.ux.com",
isEditable: true,
},
{
image: "/placeholder.svg?height=400&width=600",
title: "数据科学家",
description: "寻求一位精通数据科学的专业人士,为业务提供数据驱动的洞见。",
type: "数据",
salary: "80,000 - 100,000",
requirements: {
experience: "3-5年",
education: "统计学或相关领域的硕士学位",
skills: ["Python", "R", "机器学习"],
},
companyWebsite: "https://www.data-science.com",
isEditable: false,
},
{
image: "/placeholder.svg?height=400&width=600",
title: "内容策略师",
description: "寻求一位出色的内容策略师,制定并执行内容营销计划。",
type: "内容",
salary: "50,000 - 70,000",
requirements: {
experience: "2-4年",
education: "新媒体或相关领域的学士学位",
skills: ["内容策划", "内容创作", "内容分析"],
},
companyWebsite: "https://www.content-strategy.com",
isEditable: true,
},
])
const [currentPage, setCurrentPage] = useState(1)
const adsPerPage = 10
const handleSearch = (e) => {
setSearchTerm(e.target.value)
setFilteredAds(filteredAds.filter((ad) => ad.type.toLowerCase().includes(e.target.value.toLowerCase())))
}
const handleFilterByType = (type) => {
setSearchTerm(type)
setFilteredAds(filteredAds.filter((ad) => ad.type.toLowerCase() === type.toLowerCase()))
}
const indexOfLastAd = currentPage * adsPerPage
const indexOfFirstAd = indexOfLastAd - adsPerPage
const currentAds = filteredAds.slice(indexOfFirstAd, indexOfLastAd)
const totalPages = Math.ceil(filteredAds.length / adsPerPage)
const handlePageChange = (pageNumber) => {
setCurrentPage(pageNumber)
}
const [newAd, setNewAd] = useState({
image: "/placeholder.svg?height=400&width=600",
title: "",
description: "",
type: "",
salary: "",
requirements: {
experience: "",
education: "",
skills: [],
},
companyWebsite: "",
isEditable: true,
})
const handleAddAd = () => {
setFilteredAds([...filteredAds, newAd])
setNewAd({
image: "/placeholder.svg?height=400&width=600",
title: "",
description: "",
type: "",
salary: "",
requirements: {
experience: "",
education: "",
skills: [],
},
companyWebsite: "",
isEditable: true,
})
}
const handleInputChange = (e) => {
setNewAd({
...newAd,
[e.target.name]: e.target.value,
})
}
const handleRequirementChange = (e, index) => {
const updatedRequirements = [...newAd.requirements.skills]
updatedRequirements[index] = e.target.value
setNewAd({
...newAd,
requirements: {
...newAd.requirements,
skills: updatedRequirements,
},
})
}
const handleAddRequirement = () => {
setNewAd({
...newAd,
requirements: {
...newAd.requirements,
skills: [...newAd.requirements.skills, ""],
},
})
}
return (
<div className="w-full max-w-4xl mx-auto py-12 md:py-16 lg:py-20">
<div className="mb-8 md:mb-10 lg:mb-12">
<h2 className="text-2xl md:text-3xl lg:text-4xl font-bold text-center">探索我们的精选信息</h2>
<div className="mt-4 flex justify-center">
<Input
type="search"
placeholder="按工作类型搜索..."
value={searchTerm}
onChange={handleSearch}
className="max-w-md w-full"
/>
</div>
<div className="mt-4 flex justify-center gap-2">
<Button
variant="outline"
className="px-4 py-2 text-sm"
onClick={() => handleFilterByType("\u8BA1\u7B97\u673A\u8F6F\u4EF6")}
>
计算机软件
</Button>
<Button variant="outline" className="px-4 py-2 text-sm">
电子商务
</Button>
<Button variant="outline" className="px-4 py-2 text-sm">
金融
</Button>
<Button variant="outline" className="px-4 py-2 text-sm">
医疗保健
</Button>
<Button variant="outline" className="px-4 py-2 text-sm">
教育
</Button>
</div>
</div>
<div className="grid grid-cols-1 gap-6 md:gap-8 lg:gap-10">
{currentAds.map((ad, index) => (
<div
key={index}
className="bg-background rounded-lg shadow-lg overflow-hidden grid grid-cols-1 md:grid-cols-2"
>
<div className="relative">
<img
src="/placeholder.svg"
alt={ad.title}
width={600}
height={400}
className="w-full h-full object-cover"
/>
</div>
<div className="p-4 md:p-6 flex flex-col justify-between">
<div>
<h3 className="text-lg md:text-xl font-semibold mb-2 cursor-pointer">{ad.title}</h3>
<p className="text-muted-foreground text-sm md:text-base">{ad.description}</p>
</div>
<div className="mt-4 flex items-center justify-between">
<div className="text-primary font-semibold">{ad.salary}</div>
<div className="text-muted-foreground text-sm">
{ad.requirements.experience} | {ad.requirements.education}
</div>
</div>
<div className="mt-4 text-sm text-muted-foreground">
<Link href="#" className="hover:underline flex items-center gap-2" prefetch={false}>
{new URL(ad.companyWebsite).hostname}
<Button variant="ghost" size="icon" onClick={() => navigator.clipboard.writeText(ad.companyWebsite)}>
<CopyIcon className="h-4 w-4" />
<span className="sr-only">Copy link</span>
</Button>
</Link>
</div>
</div>
</div>
))}
</div>
<div className="mt-8 flex justify-center">
<Pagination>
<PaginationContent>
{Array.from({ length: totalPages }, (_, i) => i + 1).map((pageNumber) => (
<PaginationItem key={pageNumber}>
<PaginationLink
href="#"
isActive={pageNumber === currentPage}
onClick={() => handlePageChange(pageNumber)}
>
{pageNumber}
</PaginationLink>
</PaginationItem>
))}
</PaginationContent>
</Pagination>
</div>
<div className="mt-8 flex justify-center">
<Card className="w-full max-w-md">
<CardHeader>
<CardTitle>Add New Ad</CardTitle>
</CardHeader>
<CardContent>
<div className="grid gap-4">
<div className="grid gap-2">
<Label htmlFor="title">Title</Label>
<Input id="title" name="title" value={newAd.title} onChange={handleInputChange} />
</div>
<div className="grid gap-2">
<Label htmlFor="description">Description</Label>
<Textarea
id="description"
name="description"
value={newAd.description}
onChange={handleInputChange}
className="min-h-[100px]"
/>
</div>
<div className="grid gap-2">
<Label htmlFor="type">Type</Label>
<Input id="type" name="type" value={newAd.type} onChange={handleInputChange} />
</div>
<div className="grid gap-2">
<Label htmlFor="salary">Salary</Label>
<Input id="salary" name="salary" value={newAd.salary} onChange={handleInputChange} />
</div>
<div className="grid gap-2">
<Label htmlFor="experience">Experience</Label>
<Input
id="experience"
name="experience"
value={newAd.requirements.experience}
onChange={handleInputChange}
/>
</div>
<div className="grid gap-2">
<Label htmlFor="education">Education</Label>
<Input
id="education"
name="education"
value={newAd.requirements.education}
onChange={handleInputChange}
/>
</div>
<div className="grid gap-2">
<Label htmlFor="skills">Skills</Label>
<div className="grid gap-2">
{newAd.requirements.skills.map((skill, index) => (
<div key={index} className="flex items-center gap-2">
<Input i />
</div>
))}
</div>
</div>
</div>
</CardContent>
</Card>
</div>
</div>
)
}
function CopyIcon(props) {
return (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<rect width="14" height="14" x="8" y="8" rx="2" ry="2" />
<path d="M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" />
</svg>
)
}
function XIcon(props) {
return (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
width="24"
height="24"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth="2"
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M18 6 6 18" />
<path d="m6 6 12 12" />
</svg>
)
}