๐จ ๋ฌธ์ ์ํฉ
ํ ์ด๋ธ ์ปฌ๋ผ์ ๋น์จ ๋จ์(ex. w-1/16)๋ก ์ค์ ํ์ ๋, ์ ์ฒด ์ปฌ๋ผ์ ํฉ์ด 1์ด์ง๋ง ๊ฐ๋ก ์คํฌ๋กค์ด ์๊ธฐ๋ ํ์์ด ๋ฐ์ํ๋ค.

<thead className="bg-white text-gray-500">
<tr>
<th className="w-1/16 px-4 py-2 whitespace-nowrap">๋ฆฌ๋ทฐ ๋ฒํธ</th>
<th className="w-4/16 px-4 py-2 whitespace-nowrap">์ฒดํํ์ต๋ช
</th>
<th className="w-2/16 px-4 py-2 whitespace-nowrap">์์ฑ์</th>
<th
className="w-2/16 px-4 py-2 cursor-pointer select-none whitespace-nowrap"
onClick={() => onSort("rating")}
>
ํ์ <SortIcon sortKey={sortKey} sortOrder={sortOrder} target="rating" disabled={sortedReviews.length === 0} />
</th>
<th className="w-5/16 px-4 py-2">๋ฆฌ๋ทฐ ๋ด์ฉ</th>
<th
className="w-1/16 px-4 py-2 cursor-pointer select-none whitespace-nowrap"
onClick={() => onSort("date")}
>
์์ฑ์ผ <SortIcon sortKey={sortKey} sortOrder={sortOrder} target="date" disabled={sortedReviews.length === 0} />
</th>
<th
className="w-1/16 px-4 py-2 cursor-pointer select-none whitespace-nowrap text-center"
onClick={() => onSort("reply")}
>
๋ต๋ณ ์ฌ๋ถ <SortIcon sortKey={sortKey} sortOrder={sortOrder} target="reply" disabled={sortedReviews.length === 0} />
</th>
</tr>
</thead>
๐ค ์์ธ
Tailwind์ fraction ๋จ์(w-1/3, w-1/16 ๋ฑ)๋ ๋น๋ ์์ ์ ๊ณ ์ ๋ ์์์ ๊ณ์ฐ๊ฐ์ผ๋ก ๋ณํ๋๋ค.
์๋ฅผ ๋ค์ด w-1/16์ ์ค์ ๋ก ์๋์ ๊ฐ์ด CSS๋ก ๋ฐ๋๋ค.
.w-1\/16 {
width: 6.25%;
}
ํ์ง๋ง ์ด๋ฐ ์์น๋ฅผ ์ฌ๋ฌ ๊ฐ ํฉ์น๋ฉด 6.25 × 16 = 100.000000... ์ฒ๋ผ ์์์ ๋ฐ์ฌ๋ฆผ ์ค์ฐจ๊ฐ ๋์ ๋๋ค.
table-fixed๋ ๊ฐ ์
์ ํญ์ ๊ฐ์ ๋ก ํฉ์ฐํ๊ธฐ ๋๋ฌธ์, ์ด ์ค์ฐจ๊ฐ ํฉ์ณ์ง๋ฉด ์ ์ฒด ํญ์ด 100%๋ฅผ ์ด๊ณผํ๋ฉด์ overflow๊ฐ ๋ฐ์ํ๋ค.
๊ทธ ๊ฒฐ๊ณผ, ๋ธ๋ผ์ฐ์ ๋ ๊ฐ๋ก ์คํฌ๋กค์ ์์ฑํ๋ค.
๐ ๏ธ ํด๊ฒฐ ๊ณผ์
fraction ๋์ ๋ช ์์ ์ธ % ๋จ์๋ฅผ ์ฌ์ฉํ์ฌ ํด๊ฒฐํ ์ ์์๋ค.
<thead className="bg-white text-gray-500">
<tr>
<th className="w-[7%] px-4 py-2 whitespace-nowrap">๋ฆฌ๋ทฐ ๋ฒํธ</th>
<th className="w-[24%] px-4 py-2 whitespace-nowrap">์ฒดํํ์ต๋ช
</th>
<th className="w-[12%] px-4 py-2 whitespace-nowrap">์์ฑ์</th>
<th
className="w-[12%] px-4 py-2 cursor-pointer select-none whitespace-nowrap"
onClick={() => onSort("rating")}
>
ํ์ <SortIcon sortKey={sortKey} sortOrder={sortOrder} target="rating" disabled={sortedReviews.length === 0} />
</th>
<th className="w-[26%] px-4 py-2">๋ฆฌ๋ทฐ ๋ด์ฉ</th>
<th
className="w-[10%] px-4 py-2 cursor-pointer select-none whitespace-nowrap"
onClick={() => onSort("date")}
>
์์ฑ์ผ <SortIcon sortKey={sortKey} sortOrder={sortOrder} target="date" disabled={sortedReviews.length === 0} />
</th>
<th
className="w-[9%] px-4 py-2 cursor-pointer select-none whitespace-nowrap text-center"
onClick={() => onSort("reply")}
>
๋ต๋ณ ์ฌ๋ถ <SortIcon sortKey={sortKey} sortOrder={sortOrder} target="reply" disabled={sortedReviews.length === 0} />
</th>
</tr>
</thead>
์ด ๋ฐฉ์์ Tailwind๊ฐ ๋น๋ ์ ๊ณ์ฐํ์ง ์๊ณ , ๋ธ๋ผ์ฐ์ ๊ฐ ๋ ๋๋ง ์์ ์ ์ง์ ๊ณ์ฐํ๋ฏ๋ก ๋ฐ์ฌ๋ฆผ ์ค์ฐจ๊ฐ ์ฌ๋ผ์ง๊ณ ์คํฌ๋กค์ด ์๊ธฐ์ง ์๋๋ค.
'์ฝ์ง๊ธฐ๋ก' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
| [์ฝ์ง๊ธฐ๋ก] Linter๊ฐ ์ฝ๋๋ฅผ ๋งํฌ๋ก ์ธ์ํใทใ ?! (CI ํต๊ณผ์ํค๋ ๊ผผ์) (1) | 2025.08.19 |
|---|