|
| 1 | +import { cn } from '@/lib/utils'; |
| 2 | +import { useState } from 'react'; |
| 3 | + |
1 | 4 | const EC2 = () => { |
2 | | - return <>EC</>; |
| 5 | + const [services, setServices] = useState({ |
| 6 | + key_pair: false, |
| 7 | + security_group: false, |
| 8 | + aws_instance: false, |
| 9 | + ami_from_instance: false, |
| 10 | + }); |
| 11 | + |
| 12 | + const handleServices = (serviceItem: keyof typeof services) => { |
| 13 | + setServices((prev) => ({ |
| 14 | + ...prev, |
| 15 | + [serviceItem]: !prev[serviceItem], |
| 16 | + })); |
| 17 | + }; |
| 18 | + |
| 19 | + return ( |
| 20 | + <div className="w-full max-w-96"> |
| 21 | + <div className="border border-gray-500 rounded-md"> |
| 22 | + <div className="divide-y divide-gray-500"> |
| 23 | + <div className="flex items-center justify-between w-full px-3 py-3"> |
| 24 | + <p>Key Pair</p> |
| 25 | + <input |
| 26 | + type="checkbox" |
| 27 | + className={cn('toggle border-gray-500 bg-gray-500', { |
| 28 | + 'bg-orange-base hover:bg-orange-base/70': services.key_pair, |
| 29 | + })} |
| 30 | + onChange={() => handleServices('key_pair')} |
| 31 | + /> |
| 32 | + </div> |
| 33 | + <div className="flex items-center justify-between w-full px-3 py-3"> |
| 34 | + <p>Security Group</p> |
| 35 | + <input |
| 36 | + type="checkbox" |
| 37 | + className={cn('toggle border-gray-500 bg-gray-500', { |
| 38 | + 'bg-orange-base hover:bg-orange-base/70': |
| 39 | + services.security_group, |
| 40 | + })} |
| 41 | + onChange={() => handleServices('security_group')} |
| 42 | + /> |
| 43 | + </div> |
| 44 | + <div className="flex items-center justify-between w-full px-3 py-3"> |
| 45 | + <p>AWS Instance</p> |
| 46 | + <input |
| 47 | + type="checkbox" |
| 48 | + className={cn('toggle border-gray-500 bg-gray-500', { |
| 49 | + 'bg-orange-base hover:bg-orange-base/70': services.aws_instance, |
| 50 | + })} |
| 51 | + onChange={() => handleServices('aws_instance')} |
| 52 | + /> |
| 53 | + </div> |
| 54 | + <div className="flex items-center justify-between w-full px-3 py-3"> |
| 55 | + <p>AMI From Instance</p> |
| 56 | + <input |
| 57 | + type="checkbox" |
| 58 | + className={cn('toggle border-gray-500 bg-gray-500', { |
| 59 | + 'bg-orange-base hover:bg-orange-base/70': |
| 60 | + services.ami_from_instance, |
| 61 | + })} |
| 62 | + onChange={() => handleServices('ami_from_instance')} |
| 63 | + /> |
| 64 | + </div> |
| 65 | + </div> |
| 66 | + </div> |
| 67 | + <button className="w-full mt-3 text-white btn bg-orange-base hover:bg-orange-base/70"> |
| 68 | + Submit |
| 69 | + </button> |
| 70 | + </div> |
| 71 | + ); |
3 | 72 | }; |
4 | 73 |
|
5 | 74 | export default EC2; |
0 commit comments