1
- // CodeEditor.tsx
2
1
import { DroppedItem } from '@/types/types'
3
2
import React from 'react'
4
3
import MonacoEditor from 'react-monaco-editor'
5
- import { Button , Select , Tabs , Tooltip } from '@mantine/core'
6
4
import { FaFileDownload } from 'react-icons/fa'
7
5
import { FaDownload } from 'react-icons/fa'
6
+ import { Tabs , TabsList , TabsTrigger } from '@/components/ui/tabs'
7
+ import { TooltipContent , TooltipTrigger , Tooltip } from '../ui/tooltip'
8
+ import {
9
+ SelectContent ,
10
+ Select ,
11
+ SelectItem ,
12
+ SelectTrigger ,
13
+ SelectValue ,
14
+ } from '../ui/select'
15
+ import { Button } from '../ui/button'
16
+
8
17
interface CodeEditorProps {
9
18
droppedItems : DroppedItem [ ]
10
19
}
11
20
12
21
const CodeEditor : React . FC < CodeEditorProps > = ( { droppedItems } ) => {
13
- // Extract relevant data from droppedItems and format it as needed
14
22
const code = droppedItems
15
23
. map (
16
24
( item ) =>
@@ -23,56 +31,58 @@ const CodeEditor: React.FC<CodeEditorProps> = ({ droppedItems }) => {
23
31
24
32
return (
25
33
< div className = "absolute top-[4rem] right-0 w-[25%] border-zinc-200 border-[1px] bg-white" >
26
- < div className = "my -2 space-y-1" >
27
- < Tabs defaultValue = "gallery" >
28
- < Tabs . List >
29
- < Tabs . Tab value = "gallery" className = "uppercase w-full" >
34
+ < div className = "mb -2 space-y-1" >
35
+ < Tabs defaultValue = "gallery" className = "w-full" >
36
+ < TabsList className = "w-full" >
37
+ < TabsTrigger value = "gallery" className = "uppercase w-full" >
30
38
TerraForm Code
31
- </ Tabs . Tab >
32
- </ Tabs . List >
39
+ </ TabsTrigger >
40
+ </ TabsList >
33
41
</ Tabs >
34
- < div className = "grid grid-cols-2" >
35
- < Select
36
- className = "mx-2 w-fit"
37
- defaultValue = { 'main.tf' }
38
- checkIconPosition = "right"
39
- placeholder = "Pick value"
40
- data = { [ 'main.tf' ] }
41
- />
42
- < Button . Group >
43
- < Tooltip
44
- withArrow
45
- label = { 'Download Selected File' }
46
- transitionProps = { {
47
- transition : 'fade' ,
48
- duration : 200 ,
49
- } }
50
- className = "font-medium shadow-2xl border-[1px] border-gray-200 text-[#003ab7]"
51
- position = "bottom"
52
- arrowSize = { 6 }
53
- color = "#fff"
54
- >
55
- < Button className = "text-zinc-500 w-fit border-zinc-200" >
56
- < FaFileDownload />
57
- </ Button >
42
+ < div className = "grid grid-cols-2 gap-2 px-2" >
43
+ < Tooltip >
44
+ < TooltipTrigger >
45
+ < Select defaultValue = { 'aws' } >
46
+ < SelectTrigger className = "w-full focus-visible:ring-1" >
47
+ < SelectValue placeholder = "Select the service provider" />
48
+ </ SelectTrigger >
49
+ < SelectContent >
50
+ < SelectItem value = "aws" > main.tf</ SelectItem >
51
+ </ SelectContent >
52
+ </ Select >
53
+ </ TooltipTrigger >
54
+ < TooltipContent >
55
+ < p className = "font-medium shadow-2xl border-[1px] border-gray-200 text-[#003ab7]" >
56
+ Select a tf file
57
+ </ p >
58
+ </ TooltipContent >
59
+ </ Tooltip >
60
+ < div className = "space-x-2" >
61
+ < Tooltip >
62
+ < TooltipTrigger >
63
+ < Button className = "text-zinc-600 w-fit border-zinc-200 bg-zinc-100 hover:bg-white hover:text-black" >
64
+ < FaFileDownload />
65
+ </ Button >
66
+ </ TooltipTrigger >
67
+ < TooltipContent >
68
+ < p className = "font-medium shadow-2xl border-[1px] border-gray-200 text-[#003ab7]" >
69
+ Download Selected File
70
+ </ p >
71
+ </ TooltipContent >
58
72
</ Tooltip >
59
- < Tooltip
60
- withArrow
61
- label = { 'Download All Files' }
62
- transitionProps = { {
63
- transition : 'fade' ,
64
- duration : 200 ,
65
- } }
66
- className = "font-medium shadow-2xl border-[1px] border-gray-200 text-[#003ab7]"
67
- position = "bottom"
68
- arrowSize = { 6 }
69
- color = "#fff"
70
- >
71
- < Button className = "text-zinc-500 w-fit border-zinc-200" >
72
- < FaDownload />
73
- </ Button >
73
+ < Tooltip >
74
+ < TooltipTrigger >
75
+ < Button className = "text-zinc-600 w-fit border-zinc-200 bg-zinc-100 hover:bg-white hover:text-black" >
76
+ < FaDownload />
77
+ </ Button >
78
+ </ TooltipTrigger >
79
+ < TooltipContent >
80
+ < p className = "font-medium shadow-2xl border-[1px] border-gray-200 text-[#003ab7]" >
81
+ Download All Files
82
+ </ p >
83
+ </ TooltipContent >
74
84
</ Tooltip >
75
- </ Button . Group >
85
+ </ div >
76
86
</ div >
77
87
</ div >
78
88
< MonacoEditor
0 commit comments