Compare.js 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. import React, { useState } from 'react';
  2. import { Table } from 'antd';
  3. import '../asstes/css/Compare.css'
  4. import CocoPiImg from '../asstes/img/CocoPi.png';
  5. import MicrobitImg from '../asstes/img/Microbit.png';
  6. import RaspberryImg from '../asstes/img/Raspberry.png';
  7. const columns = [
  8. {
  9. title: 'Name',
  10. dataIndex: 'name',
  11. key: 'name',
  12. align: 'center',
  13. },
  14. {
  15. title: 'CocoPi',
  16. dataIndex: 'CocoPi',
  17. key: 'CocoPi',
  18. align: 'center',
  19. render: (type, data) => {
  20. if (data.name === '圖片') {
  21. return <img src={data.CocoPi} alt=""></img>
  22. } else {
  23. return <div dangerouslySetInnerHTML={{ __html: data.CocoPi }}></div>
  24. }
  25. }
  26. },
  27. {
  28. title: 'Microbit V2',
  29. dataIndex: 'Microbit',
  30. key: 'Microbit',
  31. align: 'center',
  32. render: (type, data) => {
  33. if (data.name === '圖片') {
  34. return <img src={data.Microbit} alt=""></img>
  35. } else {
  36. return <div dangerouslySetInnerHTML={{ __html: data.Microbit }}></div>
  37. }
  38. }
  39. },
  40. {
  41. title: '樹莓派 Pi 4 (1GB)',
  42. dataIndex: 'Raspberry',
  43. key: 'Raspberry',
  44. align: 'center',
  45. render: (type, data) => {
  46. console.log(data)
  47. if (data.name === '圖片') {
  48. return <img src={data.Raspberry} alt=""></img>
  49. } else {
  50. return <div dangerouslySetInnerHTML={{ __html: data.Raspberry }}></div>
  51. }
  52. }
  53. },
  54. ];
  55. const data = [
  56. {
  57. key: '1',
  58. name: '圖片',
  59. CocoPi: CocoPiImg,
  60. Microbit: MicrobitImg,
  61. Raspberry: RaspberryImg,
  62. },
  63. {
  64. key: '2',
  65. name: '處理器',
  66. CocoPi: "Allwinner V831",
  67. Microbit: "Nordic nRF52833",
  68. Raspberry: "Broadcom BCM2711",
  69. },
  70. {
  71. key: '3',
  72. name: '內存',
  73. CocoPi: "1GB",
  74. Microbit: "512KB",
  75. Raspberry: "1GB",
  76. },
  77. {
  78. key: '4',
  79. name: '連接',
  80. CocoPi: "<div>802.11n 無線 2.4GHz<br/>Type-C *1<br/>USB 2.0*1</div>",
  81. Microbit: "<div>藍牙 5.1 with BLE <br/>2.4GHz 無線</div>",
  82. Raspberry: "<div>2.4 GHz 和 5.0 GHz IEEE 802.11b/g/n/ac 無線<br/>藍牙 5.0, BLE<br/>LAN,千兆乙太網<br/>2 × USB 3.0 ports<br/>2 × USB 2.0 ports.</div>",
  83. },
  84. {
  85. key: '5',
  86. name: 'GPIO 引腳',
  87. CocoPi: "<div>標準 IIC/SPI/UART 介面<br/>標準私服馬達介面 *2<br/>標準電機介面 *2</div>",
  88. Microbit: "<div>5 環鱷魚夾<br/>19 板載針腳</div>",
  89. Raspberry: "<div>標準40針GPIO頭<br/>micro-HDM 埠*2 <br/>2通道MIPI DSI顯示埠<br/>2通道MIPI CSI攝像頭埠</div>",
  90. },
  91. {
  92. key: '6',
  93. name: '板載感測器',
  94. CocoPi: "<div>溫溼度感測器*1<br/>三軸陀螺儀和三軸加速度計*1<br/>麥克風*1<br/>光敏感測器*1<br/>200W 圖元MIPI攝像頭*1</div>",
  95. Microbit: "<div>三軸加速度計和磁力計 *1<br/>溫度感測器*1<br/>麥克風*1</div>",
  96. Raspberry: "無",
  97. },
  98. {
  99. key: '7',
  100. name: '板載執行器',
  101. CocoPi: "<div>揚聲器*1<br/>RGB LED*1<br/>2.8 英寸 顯示屏*1<br/>模擬伺服 *2<br/>模擬電機*2</div>",
  102. Microbit: "Speaker*1",
  103. Raspberry: "無",
  104. },
  105. {
  106. key: '8',
  107. name: '軟件',
  108. CocoPi: "Linux/C++/Python/Blockly/Scratch",
  109. Microbit: "C++/Python/Makecode/Scratch",
  110. Raspberry: "Linux/Raspbian/Windows",
  111. },
  112. {
  113. key: '9',
  114. name: '視頻',
  115. CocoPi: "<div>H.264,最高支持 1080P@30fps<br/>H.265,最高支持 1080P@30fps<br/>JPEG,最高支持 1080P@30fps</div>",
  116. Microbit: "無",
  117. Raspberry: "<div>H.265 (4Kp60 解碼);<br/>H.264 (1080p60 解碼, 1080p30 編碼);<br/>OpenGL ES, 3.0 圖形</div>",
  118. },
  119. {
  120. key: '10',
  121. name: '攝像頭',
  122. CocoPi: "200W 圖元MIPI攝像頭*1",
  123. Microbit: "無",
  124. Raspberry: "無",
  125. },
  126. {
  127. key: '11',
  128. name: '顯示幕',
  129. CocoPi: "2.8 英寸 顯示幕*1",
  130. Microbit: "5x5點陣燈屏",
  131. Raspberry: "無",
  132. },
  133. {
  134. key: '12',
  135. name: 'SD 卡支持',
  136. CocoPi: "微型 SD 卡槽",
  137. Microbit: "無",
  138. Raspberry: "微型 SD 卡槽",
  139. },
  140. {
  141. key: '13',
  142. name: '輸入電源',
  143. CocoPi: "<div>PH2.0端子<br/>Type-C<br/>USB 2.0</div>",
  144. Microbit: "<div>Micro USB<br/>帶鱷魚夾的邊緣連接器</div>",
  145. Raspberry: "<div>5V直流輸入(通過 USB-C口)<br/>5V直流輸入(通過 GPIO頭)<br/>乙太網供電(PoE)</div>",
  146. },
  147. {
  148. key: '14',
  149. name: '大小',
  150. CocoPi: "85.6*54*12mm",
  151. Microbit: "51.6*42*11.7mm",
  152. Raspberry: "85.6*56.5*11mm",
  153. },
  154. {
  155. key: '15',
  156. name: '官方價格',
  157. CocoPi: `<p class="compare_p">驚 喜 價</p>
  158. <a href="#Contact">
  159. <Button class="compare_button"><span>聯絡我們</span></Button>
  160. </a>`,
  161. Microbit: "HK$160.12",
  162. Raspberry: "HK$385.79",
  163. },
  164. ];
  165. const CompareStyle = {
  166. padding: '0 100px',
  167. textAlign: 'center',
  168. }
  169. const Compare = () => {
  170. return (
  171. <div>
  172. <h1>產品對比</h1>
  173. <div style={CompareStyle}>
  174. <Table
  175. columns={columns}
  176. pagination={false}
  177. dataSource={data}
  178. showSizeChanger={false}
  179. />
  180. </div>
  181. </div>
  182. );
  183. };
  184. export default Compare;