Search
Duplicate

Tailwind - Table ν…Œμ΄λΈ”

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 μ‚¬μ΄μ¦ˆμ—μ„œ 좜λ ₯λ˜λ„λ‘ ν•  수 μžˆμŠ΅λ‹ˆλ‹€.