Tailwind - Table ν μ΄λΈ
tailwind λ‘ Table μ λ§λ€μ΄λ΄
λλ€.
import React from 'react'
import MainLayout from '../../layouts/MainLayout'
const Table = () => {
return (
<MainLayout>
<div className="sm:p-24 px-4 py-12 flex flex-col justify-center items-center">
<h3 className="pb-10 font-bold text-4xl">
Table
</h3>
<div className="inline-block min-w-full shadow-md rounded-lg overflow-hidden">
<table className="min-w-full leading-normal">
<thead>
<tr>
<th
className="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-700 uppercase tracking-wider"
>
κ³ κ°λͺ
</th>
<th
className="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-700 uppercase tracking-wider hidden md:table-cell"
>
μ νλ²νΈ / μ΄λ©μΌ
</th>
<th
className="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-700 uppercase tracking-wider hidden md:table-cell"
>
κ°μ
μΌμ
</th>
<th
className="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-700 uppercase tracking-wider hidden sm:table-cell"
>
μν
</th>
<th
className="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-right"
></th>
</tr>
</thead>
<tbody>
<tr>
<td className="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div className="flex">
<div className="flex-shrink-0 w-10 h-10">
<img
className="w-full h-full rounded-full border"
src="https://i.imgur.com/CbuD3gl.png"
alt=""
/>
</div>
<div className="ml-3">
<p className="text-gray-900 whitespace-no-wrap">
μλ‘ν
</p>
<p className="text-gray-600 whitespace-no-wrap hidden md:block">Lv.100</p>
</div>
</div>
</td>
<td className="px-5 py-5 border-b border-gray-200 bg-white text-sm hidden md:table-cell">
<p className="text-gray-900 whitespace-no-wrap">010-0000-0000</p>
<p className="text-gray-600 whitespace-no-wrap">wwwaloha@kakao.com</p>
</td>
<td className="px-5 py-5 border-b border-gray-200 bg-white text-sm hidden md:table-cell">
<p className="text-gray-900 whitespace-no-wrap">2025/01/01</p>
<p className="text-gray-600 whitespace-no-wrap">3 μΌμ </p>
</td>
<td className="px-5 py-5 border-b border-gray-200 bg-white text-sm hidden sm:table-cell">
<span
className="relative inline-block px-3 py-1 font-semibold text-green-900 leading-tight"
>
<span
aria-hidden
className="absolute inset-0 bg-green-200 opacity-50 rounded-full"
></span>
<span className="relative">νλμ€</span>
</span>
</td>
<td
className="px-5 py-5 border-b border-gray-200 bg-white text-sm text-right"
>
<button
type="button"
className="inline-block text-gray-500 hover:text-gray-700"
>
<svg
className="inline-block h-6 w-6 fill-current"
viewBox="0 0 24 24"
>
<path
d="M12 6a2 2 0 110-4 2 2 0 010 4zm0 8a2 2 0 110-4 2 2 0 010 4zm-2 6a2 2 0 104 0 2 2 0 00-4 0z"
/>
</svg>
</button>
</td>
</tr>
<tr>
<td className="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div className="flex">
<div className="flex-shrink-0 w-10 h-10">
<img
className="w-full h-full rounded-full border"
src="https://i.imgur.com/PqgZlA0.png"
alt=""
/>
</div>
<div className="ml-3">
<p className="text-gray-900 whitespace-no-wrap">
κΉμ‘°μ
</p>
<p className="text-gray-600 whitespace-no-wrap hidden md:block">Lv.50</p>
</div>
</div>
</td>
<td className="px-5 py-5 border-b border-gray-200 bg-white text-sm hidden md:table-cell">
<p className="text-gray-900 whitespace-no-wrap">010-0000-0000</p>
<p className="text-gray-600 whitespace-no-wrap">wwwaloha@kakao.com</p>
</td>
<td className="px-5 py-5 border-b border-gray-200 bg-white text-sm hidden md:table-cell">
<p className="text-gray-900 whitespace-no-wrap">2025/01/01</p>
<p className="text-gray-600 whitespace-no-wrap">3 μΌμ </p>
</td>
<td className="px-5 py-5 border-b border-gray-200 bg-white text-sm hidden sm:table-cell">
<span
className="relative inline-block px-3 py-1 font-semibold text-green-900 leading-tight"
>
<span
aria-hidden
className="absolute inset-0 bg-green-200 opacity-50 rounded-full"
></span>
<span className="relative">νλμ€</span>
</span>
</td>
<td
className="px-5 py-5 border-b border-gray-200 bg-white text-sm text-right"
>
<button
type="button"
className="inline-block text-gray-500 hover:text-gray-700"
>
<svg
className="inline-block h-6 w-6 fill-current"
viewBox="0 0 24 24"
>
<path
d="M12 6a2 2 0 110-4 2 2 0 010 4zm0 8a2 2 0 110-4 2 2 0 010 4zm-2 6a2 2 0 104 0 2 2 0 00-4 0z"
/>
</svg>
</button>
</td>
</tr>
<tr>
<td className="px-5 py-5 border-b border-gray-200 bg-white text-sm">
<div className="flex">
<div className="flex-shrink-0 w-10 h-10">
<img
className="w-full h-full rounded-full border"
src="https://i.imgur.com/vmkZm6D.png"
alt=""
/>
</div>
<div className="ml-3">
<p className="text-gray-900 whitespace-no-wrap">
μ μ€μ
</p>
<p className="text-gray-600 whitespace-no-wrap hidden md:block">Lv.1</p>
</div>
</div>
</td>
<td className="px-5 py-5 border-b border-gray-200 bg-white text-sm hidden md:table-cell">
<p className="text-gray-900 whitespace-no-wrap">010-0000-0000</p>
<p className="text-gray-600 whitespace-no-wrap">wwwaloha@kakao.com</p>
</td>
<td className="px-5 py-5 border-b border-gray-200 bg-white text-sm hidden md:table-cell">
<p className="text-gray-900 whitespace-no-wrap">2025/01/01</p>
<p className="text-gray-600 whitespace-no-wrap">3 μΌμ </p>
</td>
<td className="px-5 py-5 border-b border-gray-200 bg-white text-sm hidden sm:table-cell">
<span
className="relative inline-block px-3 py-1 font-semibold text-orange-900 leading-tight"
>
<span
aria-hidden
className="absolute inset-0 bg-orange-200 opacity-50 rounded-full"
></span>
<span className="relative">λκΈ°μ€</span>
</span>
</td>
<td
className="px-5 py-5 border-b border-gray-200 bg-white text-sm text-right"
>
<button
type="button"
className="inline-block text-gray-500 hover:text-gray-700"
>
<svg
className="inline-block h-6 w-6 fill-current"
viewBox="0 0 24 24"
>
<path
d="M12 6a2 2 0 110-4 2 2 0 010 4zm0 8a2 2 0 110-4 2 2 0 010 4zm-2 6a2 2 0 104 0 2 2 0 00-4 0z"
/>
</svg>
</button>
</td>
</tr>
<tr>
<td className="px-5 py-5 bg-white text-sm">
<div className="flex">
<div className="flex-shrink-0 w-10 h-10">
<img
className="w-full h-full rounded-full border"
src="https://i.imgur.com/OD1a0Mv.png"
alt=""
/>
</div>
<div className="ml-3">
<p className="text-gray-900 whitespace-no-wrap">
ꡬκ΅μ°¬
</p>
<p className="text-gray-600 whitespace-no-wrap hidden md:block">Lv.5</p>
</div>
</div>
</td>
<td className="px-5 py-5 border-b border-gray-200 bg-white text-sm hidden md:table-cell">
<p className="text-gray-900 whitespace-no-wrap">010-0000-0000</p>
<p className="text-gray-600 whitespace-no-wrap">wwwaloha@kakao.com</p>
</td>
<td className="px-5 py-5 border-b border-gray-200 bg-white text-sm hidden md:table-cell">
<p className="text-gray-900 whitespace-no-wrap">2025/01/01</p>
<p className="text-gray-600 whitespace-no-wrap">3 μΌμ </p>
</td>
<td className="px-5 py-5 bg-white text-sm hidden sm:table-cell">
<span
className="relative inline-block px-3 py-1 font-semibold text-red-900 leading-tight"
>
<span
aria-hidden
className="absolute inset-0 bg-red-200 opacity-50 rounded-full"
></span>
<span className="relative">λΉνμ±ν</span>
</span>
</td>
<td className="px-5 py-5 bg-white text-sm text-right">
<button
type="button"
className="inline-block text-gray-500 hover:text-gray-700"
>
<svg
className="inline-block h-6 w-6 fill-current"
viewBox="0 0 24 24"
>
<path
d="M12 6a2 2 0 110-4 2 2 0 010 4zm0 8a2 2 0 110-4 2 2 0 010 4zm-2 6a2 2 0 104 0 2 2 0 00-4 0z"
/>
</svg>
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</MainLayout>
)
}
export default Table
JavaScript
볡μ¬
<thead>
<tr>
<th
className="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-700 uppercase tracking-wider"
>
κ³ κ°λͺ
</th>
<th
className="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-700 uppercase tracking-wider
hidden md:table-cell"
>
μ νλ²νΈ / μ΄λ©μΌ
</th>
<th
className="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-700 uppercase tracking-wider
hidden md:table-cell"
>
κ°μ
μΌμ
</th>
<th
className="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-700 uppercase tracking-wider '
hidden sm:table-cell"
>
μν
</th>
<th
className="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-right"
></th>
</tr>
</thead>
JavaScript
볡μ¬
β’
PC : κ³ κ°λͺ
, μ νλ²νΈ/μ΄λ©μΌ, κ°μ
μΌμ, μν, (λ보기)
β’
Tablet : κ³ κ°λͺ
, μν, (λ보기)
β’
mobile : κ³ κ°λͺ
, (λ보기)
λ°μν ν
μ΄λΈλ‘ ꡬννκΈ° μν΄μ, κ°κ° λλ°μ΄μ€ λ³λ‘ μΆλ ₯ν μ΄μ μμ κ°μ΄ μ ν©λλ€.
μ΄ λ mobile~PC κΉμ§ μΆλ ₯νλ μ΄μ κ³ κ°λͺ
κ³Ό (λ보기) μ
λλ€.
hidden ν΄λμ€λ₯Ό μ§μ νλ©΄ νλ©΄μ μΆλ ₯λμ§ μμ΅λλ€.
sm:table-cell ν΄λμ€λ₯Ό μ§μ νλ©΄ sm(μ΅μ 640px μ΄μ) μ¬μ΄μ¦λΆν° μΆλ ₯ν μ μμ΅λλ€.
λ°λΌμ Tablet μ¬μ΄μ¦λΆν° 보μ¬μ£Όμ΄μΌν μν μ΄μ μλμ κ°μ΄ μ§μ νλ©΄, νλΈλ¦Ώ μ λ μ¬μ΄μ¦λΆν° μν μ΄μ μΆλ ₯ν μ μμ΅λλ€.
<th
className="px-5 py-3 border-b-2 border-gray-200 bg-gray-100 text-left text-xs font-semibold text-gray-700 uppercase tracking-wider '
hidden sm:table-cell"
>
μν
</th>
JavaScript
볡μ¬
μ νλ²νΈ/μ΄λ©μΌ, κ°μ
μΌμ λ νλΈλ¦Ώ μ λ μ¬μ΄μ¦λ³΄λ€ μ‘°κΈ λ ν° μ¬μ΄μ¦λΆν° 보μ¬μ£Όμ΄μΌνλ―λ‘, md:table-cell ν΄λμ€λ₯Ό μ§μ νμ¬, νλΈλ¦Ώμ΄μλΆν° PC μ¬μ΄μ¦μμ μΆλ ₯λλλ‘ ν μ μμ΅λλ€.