|
| 1 | +import type { RackWidth } from '../../../types'; |
| 2 | +import { Port } from './Port'; |
| 3 | + |
| 4 | +export const Switch48Port = ({ |
| 5 | + isPowered, |
| 6 | + rackWidth = '19inch', |
| 7 | +}: { |
| 8 | + isPowered?: boolean; |
| 9 | + rackWidth?: RackWidth; |
| 10 | +}) => { |
| 11 | + const is10Inch = rackWidth === '10inch'; |
| 12 | + |
| 13 | + if (is10Inch) { |
| 14 | + // 10-inch Rack Layout (Currently same as 19-inch, but separated for future customization) |
| 15 | + return ( |
| 16 | + <div className="flex flex-col gap-1 w-full max-w-[90%] items-end pr-4 mt-3"> |
| 17 | + {/* 2 Rows of 12 Ports (3 groups of 4) */} |
| 18 | + <div className="flex gap-3 justify-end w-full"> |
| 19 | + {[0, 1, 2].map((groupIndex) => ( |
| 20 | + <div key={`top-group-${groupIndex}`} className="flex gap-1"> |
| 21 | + {Array.from({ length: 4 }).map((_, i) => ( |
| 22 | + <div key={`top-${groupIndex}-${i}`}> |
| 23 | + <Port isPowered={isPowered} /> |
| 24 | + </div> |
| 25 | + ))} |
| 26 | + </div> |
| 27 | + ))} |
| 28 | + </div> |
| 29 | + <div className="flex gap-3 justify-end w-full"> |
| 30 | + {[0, 1, 2].map((groupIndex) => ( |
| 31 | + <div key={`bottom-group-${groupIndex}`} className="flex gap-1"> |
| 32 | + {Array.from({ length: 4 }).map((_, i) => ( |
| 33 | + <div key={`bottom-${groupIndex}-${i}`}> |
| 34 | + <Port isPowered={isPowered} /> |
| 35 | + </div> |
| 36 | + ))} |
| 37 | + </div> |
| 38 | + ))} |
| 39 | + </div> |
| 40 | + </div> |
| 41 | + ); |
| 42 | + } |
| 43 | + |
| 44 | + // 19-inch Rack Layout (Standard) |
| 45 | + return ( |
| 46 | + <div className="flex flex-col gap-1 w-full max-w-[95%] items-end pr-2 mt-3"> |
| 47 | + {/* 2 Rows of 24 Ports (4 groups of 6) */} |
| 48 | + <div className="flex gap-5 justify-end w-full"> |
| 49 | + {[0, 1, 2].map((groupIndex) => ( |
| 50 | + <div key={`top-group-${groupIndex}`} className="flex gap-[2px]"> |
| 51 | + {Array.from({ length: 8 }).map((_, i) => ( |
| 52 | + <div key={`top-${groupIndex}-${i}`}> |
| 53 | + <Port isPowered={isPowered} /> |
| 54 | + </div> |
| 55 | + ))} |
| 56 | + </div> |
| 57 | + ))} |
| 58 | + </div> |
| 59 | + <div className="flex gap-5 justify-end w-full"> |
| 60 | + {[0, 1, 2].map((groupIndex) => ( |
| 61 | + <div key={`bottom-group-${groupIndex}`} className="flex gap-[2px]"> |
| 62 | + {Array.from({ length: 8 }).map((_, i) => ( |
| 63 | + <div key={`bottom-${groupIndex}-${i}`}> |
| 64 | + <Port isPowered={isPowered} /> |
| 65 | + </div> |
| 66 | + ))} |
| 67 | + </div> |
| 68 | + ))} |
| 69 | + </div> |
| 70 | + </div> |
| 71 | + ); |
| 72 | +}; |
0 commit comments