|
|
|
@ -3,20 +3,28 @@
|
|
|
|
import { BookmarkCategoryWithBookmarks } from '@/types'
|
|
|
|
import { BookmarkCategoryWithBookmarks } from '@/types'
|
|
|
|
import { Tabs, Tab } from '@nextui-org/tabs'
|
|
|
|
import { Tabs, Tab } from '@nextui-org/tabs'
|
|
|
|
import { BookmarkCard } from './bookmarkCard'
|
|
|
|
import { BookmarkCard } from './bookmarkCard'
|
|
|
|
|
|
|
|
import { useContext, useState } from 'react'
|
|
|
|
|
|
|
|
import { BookmarkCategoryContext } from '@/app/providers'
|
|
|
|
|
|
|
|
|
|
|
|
export default function BookmarkTabs({
|
|
|
|
export default function BookmarkTabs({
|
|
|
|
data,
|
|
|
|
data,
|
|
|
|
}: {
|
|
|
|
}: {
|
|
|
|
data: BookmarkCategoryWithBookmarks[]
|
|
|
|
data: BookmarkCategoryWithBookmarks[]
|
|
|
|
}) {
|
|
|
|
}) {
|
|
|
|
|
|
|
|
const { selectedCategory, setSelectedCategory } = useContext(
|
|
|
|
|
|
|
|
BookmarkCategoryContext
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
return (
|
|
|
|
<div className='flex w-full max-w-4xl flex-col'>
|
|
|
|
<div className='flex w-full max-w-4xl flex-col'>
|
|
|
|
<Tabs
|
|
|
|
<Tabs
|
|
|
|
fullWidth
|
|
|
|
fullWidth
|
|
|
|
|
|
|
|
selectedKey={selectedCategory}
|
|
|
|
|
|
|
|
onSelectionChange={(key) => setSelectedCategory(key.toString())}
|
|
|
|
color='primary'>
|
|
|
|
color='primary'>
|
|
|
|
{data.map((bookmarkCategory, index) => (
|
|
|
|
{data.map((bookmarkCategory) => (
|
|
|
|
<Tab
|
|
|
|
<Tab
|
|
|
|
key={index}
|
|
|
|
key={bookmarkCategory.id}
|
|
|
|
title={bookmarkCategory.name}>
|
|
|
|
title={bookmarkCategory.name}>
|
|
|
|
<div className='mt-12 flex flex-wrap justify-center gap-6'>
|
|
|
|
<div className='mt-12 flex flex-wrap justify-center gap-6'>
|
|
|
|
{bookmarkCategory.bookmark.map((data, index) => (
|
|
|
|
{bookmarkCategory.bookmark.map((data, index) => (
|
|
|
|
|