feat: implement dashboard contents page with data table and styling
This commit is contained in:
@@ -0,0 +1,102 @@
|
||||
type TContens = {
|
||||
id: number
|
||||
createdAt: string
|
||||
author: string
|
||||
title: string
|
||||
tags: string
|
||||
category: string
|
||||
status: string
|
||||
}
|
||||
|
||||
export const CONTENTS: TContens[] = [
|
||||
{
|
||||
id: 1,
|
||||
createdAt: '24/10/2024',
|
||||
author: 'John Doe',
|
||||
title: 'Introduction to TypeScript',
|
||||
tags: 'typescript, programming',
|
||||
category: 'Education',
|
||||
status: 'Published',
|
||||
},
|
||||
{
|
||||
id: 2,
|
||||
createdAt: '24/10/2024',
|
||||
author: 'Jane Smith',
|
||||
title: 'Advanced React Patterns',
|
||||
tags: 'react, javascript',
|
||||
category: 'Development',
|
||||
status: 'Draft',
|
||||
},
|
||||
{
|
||||
id: 3,
|
||||
createdAt: '24/10/2024',
|
||||
author: 'Alice Johnson',
|
||||
title: 'Understanding Redux',
|
||||
tags: 'redux, state management',
|
||||
category: 'Development',
|
||||
status: 'Published',
|
||||
},
|
||||
{
|
||||
id: 4,
|
||||
createdAt: '24/10/2024',
|
||||
author: 'Bob Brown',
|
||||
title: 'CSS Grid Layout',
|
||||
tags: 'css, design',
|
||||
category: 'Design',
|
||||
status: 'Published',
|
||||
},
|
||||
{
|
||||
id: 5,
|
||||
createdAt: '24/10/2024',
|
||||
author: 'Charlie Davis',
|
||||
title: 'Node.js Best Practices',
|
||||
tags: 'nodejs, backend',
|
||||
category: 'Development',
|
||||
status: 'Published',
|
||||
},
|
||||
{
|
||||
id: 6,
|
||||
createdAt: '24/10/2024',
|
||||
author: 'Diana Evans',
|
||||
title: 'GraphQL for Beginners',
|
||||
tags: 'graphql, api',
|
||||
category: 'Development',
|
||||
status: 'Draft',
|
||||
},
|
||||
{
|
||||
id: 7,
|
||||
createdAt: '24/10/2024',
|
||||
author: 'Evan Harris',
|
||||
title: 'Building RESTful APIs',
|
||||
tags: 'rest, api',
|
||||
category: 'Development',
|
||||
status: 'Published',
|
||||
},
|
||||
{
|
||||
id: 8,
|
||||
createdAt: '24/10/2024',
|
||||
author: 'Fiona Green',
|
||||
title: 'Introduction to Docker',
|
||||
tags: 'docker, devops',
|
||||
category: 'DevOps',
|
||||
status: 'Published',
|
||||
},
|
||||
{
|
||||
id: 9,
|
||||
createdAt: '24/10/2024',
|
||||
author: 'George King',
|
||||
title: 'Microservices Architecture',
|
||||
tags: 'microservices, architecture',
|
||||
category: 'Development',
|
||||
status: 'Draft',
|
||||
},
|
||||
{
|
||||
id: 10,
|
||||
createdAt: '24/10/2024',
|
||||
author: 'Hannah Lee',
|
||||
title: 'Kubernetes Essentials',
|
||||
tags: 'kubernetes, devops',
|
||||
category: 'DevOps',
|
||||
status: 'Published',
|
||||
},
|
||||
]
|
||||
@@ -0,0 +1,36 @@
|
||||
import DT from 'datatables.net-dt'
|
||||
import DataTable from 'datatables.net-react'
|
||||
|
||||
import { TitleDashboard } from '~/components/ui/title-dashboard'
|
||||
|
||||
import { CONTENTS } from './data'
|
||||
|
||||
export const ContentsPage = () => {
|
||||
DataTable.use(DT)
|
||||
const columns = [
|
||||
{ title: 'No', data: 'id' },
|
||||
{ title: 'Tanggal Kontent', data: 'createdAt' },
|
||||
{ title: 'Nama Penulis', data: 'author' },
|
||||
{ title: 'Judul', data: 'title' },
|
||||
{ title: 'Kategori', data: 'category' },
|
||||
{ title: 'Tags', data: 'tags' },
|
||||
{ title: 'Action', data: 'id', render: () => 'Edit' },
|
||||
]
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<TitleDashboard title="Konten" />
|
||||
<DataTable
|
||||
className="cell-border"
|
||||
data={CONTENTS}
|
||||
columns={columns}
|
||||
options={{
|
||||
paging: true,
|
||||
searching: true,
|
||||
ordering: true,
|
||||
info: true,
|
||||
}}
|
||||
></DataTable>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
Reference in New Issue
Block a user