近期為了熟悉元件 Component 的客製化,便參照「哎呀!不小心刻了一套 React UI 元件庫」一書進行練習。這篇筆記下 Table。
[ Repo ]:https://github.com/andy922200/practice-storybook-react
內容
一個初始的簡易 Table,會包含 <table>, <thead>, <tbody>, <tr>, <th>, <td>。藉由 dataSource 將自定義的物件陣列傳入,並由 columns 來傳入欄位的設定值
參數
1. dataSource – 自定義物件陣列
2. columns – 欄位內容,相關的寬度、屬性等都是定義在這邊
3. maxWidth – 設定 <table> 父層的 div 寬度,確保 stickyColumn 效果
概念
1. border 邊框設置在 table, th, td 這三個標籤上
2. 表格相關的 css 屬性都要設置上 border-box
3. <table> 外層加上 overflow: ‘auto’:確保出現捲軸;width: 100% :確保寬度可以跟隨 wrapper 一致
4. 固定欄位後的陰影效果,是做在偽元素 ::after 上
程式碼
相關文章
★全文分享★ [筆記] 哎呀!不小心刻了一套 React UI 元件庫 30 – 佈署發佈
![[筆記] 哎呀!不小心刻了一套 React UI 元件庫 30 – 佈署發佈 [筆記] 哎呀!不小心刻了一套 React UI 元件庫 30 – 佈署發佈](https://smlpoints.com/wp-content/uploads/notes-react-hooks-ch1-ch2-1.jpeg)
近期為了熟悉元件 Component 的客製化,便
★全文分享★ [筆記] 哎呀!不小心刻了一套 React UI 元件庫 29 – Toast
![[筆記] 哎呀!不小心刻了一套 React UI 元件庫 29 – Toast [筆記] 哎呀!不小心刻了一套 React UI 元件庫 29 – Toast](https://smlpoints.com/wp-content/uploads/notes-react-hooks-ch1-ch2-1.jpeg)
近期為了熟悉元件 Component 的客製化,便
★全文分享★ [筆記] 哎呀!不小心刻了一套 React UI 元件庫 28 – Modal
![[筆記] 哎呀!不小心刻了一套 React UI 元件庫 28 – Modal [筆記] 哎呀!不小心刻了一套 React UI 元件庫 28 – Modal](https://smlpoints.com/wp-content/uploads/notes-react-hooks-ch1-ch2-1.jpeg)
近期為了熟悉元件 Component 的客製化,便
★全文分享★ [筆記] 哎呀!不小心刻了一套 React UI 元件庫 27 – Progress Circle
![[筆記] 哎呀!不小心刻了一套 React UI 元件庫 27 – Progress Circle [筆記] 哎呀!不小心刻了一套 React UI 元件庫 27 – Progress Circle](https://smlpoints.com/wp-content/uploads/notes-react-hooks-ch1-ch2-1.jpeg)
近期為了熟悉元件 Component 的客製化,便
★全文分享★ [筆記] 哎呀!不小心刻了一套 React UI 元件庫 26 – Progress Bar
![[筆記] 哎呀!不小心刻了一套 React UI 元件庫 26 – Progress Bar [筆記] 哎呀!不小心刻了一套 React UI 元件庫 26 – Progress Bar](https://smlpoints.com/wp-content/uploads/notes-react-hooks-ch1-ch2-1.jpeg)
近期為了熟悉元件 Component 的客製化,便
★全文分享★ [筆記] 哎呀!不小心刻了一套 React UI 元件庫 25 – Skeleton
![[筆記] 哎呀!不小心刻了一套 React UI 元件庫 25 – Skeleton [筆記] 哎呀!不小心刻了一套 React UI 元件庫 25 – Skeleton](https://smlpoints.com/wp-content/uploads/notes-react-hooks-ch1-ch2-1.jpeg)
近期為了熟悉元件 Component 的客製化,便
★全文分享★ [筆記] 哎呀!不小心刻了一套 React UI 元件庫 24 – Spin
![[筆記] 哎呀!不小心刻了一套 React UI 元件庫 24 – Spin [筆記] 哎呀!不小心刻了一套 React UI 元件庫 24 – Spin](https://smlpoints.com/wp-content/uploads/notes-react-hooks-ch1-ch2-1.jpeg)
近期為了熟悉元件 Component 的客製化,便
★全文分享★ [筆記] 哎呀!不小心刻了一套 React UI 元件庫 23 – Pagination
![[筆記] 哎呀!不小心刻了一套 React UI 元件庫 23 – Pagination [筆記] 哎呀!不小心刻了一套 React UI 元件庫 23 – Pagination](https://smlpoints.com/wp-content/uploads/notes-react-hooks-ch1-ch2-1.jpeg)
近期為了熟悉元件 Component 的客製化,便
★全文分享★ [筆記] 哎呀!不小心刻了一套 React UI 元件庫 22 – Tabs
![[筆記] 哎呀!不小心刻了一套 React UI 元件庫 22 – Tabs [筆記] 哎呀!不小心刻了一套 React UI 元件庫 22 – Tabs](https://smlpoints.com/wp-content/uploads/notes-react-hooks-ch1-ch2-1.jpeg)
近期為了熟悉元件 Component 的客製化,便
★全文分享★ [筆記] 哎呀!不小心刻了一套 React UI 元件庫 21 – Drawer
![[筆記] 哎呀!不小心刻了一套 React UI 元件庫 21 – Drawer [筆記] 哎呀!不小心刻了一套 React UI 元件庫 21 – Drawer](https://smlpoints.com/wp-content/uploads/notes-react-hooks-ch1-ch2-1.jpeg)
近期為了熟悉元件 Component 的客製化,便
