ផ្នែក​ខាង​ក្រោម​នៃ​ទំព័រ​គ្រប់គ្រង ជា​ផ្នែក​ដែល​បង្ហាញ​​ទិន្នន័យ​នៃ​ការផ្សាយ (post) ​ឬ​ទិន្នន័យ​ផ្សេង​ៗ​ទៀត​ទាក់ទង​នឹង​ទំព័រណា​មួយ។ ដោយ​ហេតុ​ថា ទំព័រ​គ្រប់គ្រង​នឹង​ត្រូវ​យក​ទៅ​ប្រើ​ជា​គំរូ​ទំព័រ​គ្រឹះ​សំរាប់​ទំព័រ​ដទៃ​ទៀត ដូចនេះ​ទិន្នន័យ​ត្រូវ​បង្ហាញ​នៅ​​​ផ្នែក​ខាង​ក្រោ​ម​នៃ​ទំព័រ​គ្រប់គ្រង នឹង​ត្រូវ​ប្រែប្រួល​ទៅ​តាម​ប្រភេទ​នៃ​ទំព័រ​និមួយ​ៗ​។

 

<!--src/layouts/admin/Bottom.astro-->
---
const total = 0
const videos = true
---

<section class="max-w-5xl mx-auto md:px-0 px-2">
    <div class="text-center bg-teal-100 mt-2 py-2">
        ទាំងអស់​មាន​ចំនួនៈ {total}
    </div>
    <ul id="item-listing" class="grid md:grid-cols-2 grid-cols-1 gap-2 py-2 text-gray-600">
        {[...Array(4).keys()].map((item, i)=>(
        <li class="bg-teal-100 grid grid-cols-[20%_60%_15%] gap-x-2 items-center group">
            <a class="relative pt-[56.25%] overflow-hidden" href="/post/:id">
                <img class="absolute top-0 left-0 w-full min-h-full" 
                    src="https://i.imgur.com/0uhZ49R.png" 
                />
                {videos && 
                <img class="absolute top-1/2 left-1/2 min-h-auto w-1/4 -translate-x-1/2 -translate-y-1/2" 
                    src="/images/play.png" 
                />
                }
            </a>
            <div class="truncate">
                <a href="/post/:id">
                    ចំណង​ជើង
                </a>
                <div>02/10/2023</div>
            </div>
            <div class="flex flex-row">
                <a class="block w-1/2" href="/admin/edit/:id">
                    <img class="invisible group-hover:visible" src="/images/edit.png" />
                </a>
                <a id="" class="delete block w-1/2" href=`/admin/delete/${i}`>
                    <img class="invisible group-hover:visible" src="/images/delete.png" />
                </a>
            </div>
        </li>
        ))}
        <script>
            $('#item-listing .delete').on('click', function () {
                return confirm('តើ​ពិតជា​ចង់​លុប?');
            });
        </script>
    </ul>
    <div class="bg-teal-100 py-2 mb-5">
        <img class="mx-auto hover:opacity-75 cursor-pointer" src="/images/load-more.png" />
    </div>
</section>

 

<!--src/layouts/admin/Base.astro-->
---
import "../../styles/global.css"
const { pageTitle="ទំព័រ​គ្រឹះ" } = Astro.props
import Footer from "../Footer.astro"
import Header from "./Header.astro"
import Menu from "./Menu.astro"
import Bottom from "./Bottom.astro"
---

<html lang="en">
    <head>
        <meta charset="utf-8" />
        <meta name="viewport" content="width=device-width" />
        <meta name="generator" content={Astro.generator} />
        <title>{pageTitle}</title>
        <link rel="icon" href="/images/siteLogo.png" />
        <link href="/fonts/setup.css" rel="stylesheet" />
        <script is:inline src="/scripts/jquery.js"></script>
    </head>
    <body class="text-sm leading-normal">
        <Header pageTitle={pageTitle}/>
        <div class="max-w-5xl mx-auto flex md:flex-row flex-col mt-5 md:px-0 px-2">
            <Menu/>
            <slot/>
        </div>
        <Bottom/>
        <Footer/>
    </body>
</html>

 

Netlify: https://khmerweb-dynamic-blog.netlify.app/admin

GitHub: https://github.com/Sokhavuth/dynamic-blog