lukeonline

source for my website
git clone https://git.lukeonline.net/repos/lukeonline
Log | Files | Refs | README | LICENSE

Table.astro (606B)


      1 ---
      2 const { rows } = Astro.props
      3 ---
      4 
      5 <table class="w-full table-auto">
      6   {
      7     Object.entries(rows).map(([param, value]) => (
      8       <tr class="w-full p-4 odd:bg-gray-100 even:bg-gray-50">
      9         <td class="p-2 pr-4 pl-4 italic">{param}</td>
     10         <td class="flex h-auto flex-row flex-wrap gap-2 p-2 pr-4 pl-4">
     11           {Array.isArray(value)
     12             ? value.map((item) => (
     13                 <span class="p-1/2 rounded-sm bg-gray-600 pr-2 pl-2 text-white">
     14                   {item}
     15                 </span>
     16               ))
     17             : (value ?? '-')}
     18         </td>
     19       </tr>
     20     ))
     21   }
     22 </table>