22 <main class =" container" >
33 <div class =" vue-flow-container" >
44 <div class =" vue-flow-header" >
5- <div class =" vue-flow-create-model" >
6- <input
7- class =" create-model-input"
8- type =" text"
9- placeholder =" Enter Model Name"
10- v-model =" modelName"
11- />
12- <button class =" create-model-btn" @click =" createNode" >Create</button >
13- </div >
5+ <div class =" header-section" @click =" () => console.log('Models clicked')" >Models</div >
6+ <div class =" header-divider" />
7+ <div class =" header-section" @click =" () => console.log('Enums clicked')" >Enums</div >
148 </div >
159
1610 <div class =" vue-flow-viewport" >
1711 <VueFlow v-model:nodes =" store.nodes" v-model:edges =" store.edges" >
12+ <div class =" create-wrapper" >
13+ <div v-if =" showInput" class =" floating-create-expanded" >
14+ <button class =" collapse-btn" @click =" showInput = false" >
15+ <svg xmlns =" http://www.w3.org/2000/svg" width =" 24" height =" 24" viewBox =" 0 0 24 24" fill =" none" stroke =" currentColor" stroke-width =" 2" stroke-linecap =" round" stroke-linejoin =" round" class =" lucide lucide-chevron-left size-4 rdp-nav_icon" ><path d =" m15 18-6-6 6-6" ></path ></svg >
16+ </button >
17+ <input
18+ class =" create-model-input"
19+ type =" text"
20+ placeholder =" Enter Model Name"
21+ v-model =" modelName"
22+ @keyup.enter =" handleCreateClick"
23+ />
24+ <button class =" create-model-btn" @click =" handleCreateClick" >Create</button >
25+ </div >
26+
27+ <div v-if =" !showInput" class =" create-circle" @click =" showInput = true" >+</div >
28+ </div >
29+
1830 <template #node-custom =" customNodeProps " >
1931 <CustomNode
2032 v-bind =" customNodeProps"
@@ -51,11 +63,13 @@ const store = useProjectStore()
5163const modalStore = useModalStore ()
5264
5365const modelName = ref (" " )
66+ const showInput = ref (false )
5467
55- const createNode = () => {
68+ const handleCreateClick = () => {
5669 if (modelName .value .trim () === " " ) return
5770 store .createNode (modelName .value )
5871 modelName .value = " "
72+ showInput .value = false
5973}
6074
6175const deleteNode = (id : string ) => {
@@ -88,57 +102,128 @@ const openEditRelationModal = (id: string, relation: RelationalRelationField) =>
88102 width : 100% ;
89103 height : 100% ;
90104}
105+
91106.vue-flow-container {
92107 width : 1000px ;
93108 height : 500px ;
94109 background-color : #ffffff ;
95110 border : 2px solid black ;
96111}
112+
97113.vue-flow-header {
98114 height : 40px ;
99- border-bottom : 2px solid black ;
100115 display : flex ;
101116 align-items : center ;
102117 background-color : #ffdb58 ;
118+ width : 100% ;
119+ border-bottom : 2px solid black ;
120+ box-sizing : border-box ;
121+ }
122+
123+ .header-section {
124+ flex : 1 ;
125+ text-align : center ;
126+ cursor : pointer ;
127+ font-weight : bold ;
128+ display : flex ;
129+ align-items : center ;
130+ justify-content : center ;
131+ height : 100% ;
132+ }
133+
134+ .header-divider {
135+ width : 2px ;
136+ height : 100% ;
137+ background-color : black ;
103138}
104139
105140.vue-flow-viewport {
141+ position : relative ;
106142 width : 100% ;
107143 height : calc (100% - 42px );
108144}
109145
110- .vue-flow-create-model {
146+ .create-wrapper {
147+ position : absolute ;
148+ top : 10px ;
149+ left : 10px ;
111150 display : flex ;
112151 align-items : center ;
113- gap : 0.3rem ;
114- width : 300px ;
115152}
116153
117- .create-model-input {
118- width : 100 % ;
119- height : 12 px ;
120- padding : 0.5 rem ;
154+ .create-circle {
155+ width : 40 px ;
156+ height : 40 px ;
157+ background-color : #ffdb58 ;
121158 border : 2px solid black ;
122- border-radius : 4px ;
123- margin-left : 20px ;
159+ color : black ;
160+ border-radius : 50% ;
161+ font-size : 20px ;
162+ display : flex ;
163+ justify-content : center ;
164+ align-items : center ;
165+ cursor : pointer ;
166+ user-select : none ;
167+ font-weight : bold ;
168+ z-index : 10 ;
169+ box-shadow : 2px 2px 0px rgba (0 , 0 , 0 , 1 );
170+ transition : transform 0.1s ease-out , box-shadow 0.1s ;
124171}
125- .create-model-input :focus {
126- outline : none ;
172+
173+ .create-circle :hover {
174+ box-shadow : 0px 0px 0px rgba (0 , 0 , 0 , 1 );
175+ transform : translate (2px , 2px );
176+ }
177+
178+ .floating-create-expanded {
179+ display : flex ;
180+ align-items : center ;
181+ background : #ffdb58 ;
182+ border : 2px solid black ;
183+ border-radius : 50px ;
184+ height : 40px ;
185+ padding : 0 10px ;
186+ gap : 8px ;
187+ z-index : 1000 ;
188+ margin-top : 2px ;
189+ margin-left : 2px ;
190+ }
191+
192+ .collapse-btn {
193+ display : grid ;
194+ place-items : center ;
195+ width : 24px ;
196+ height : 24px ;
197+ padding : 0 ;
198+ cursor : pointer ;
199+ background : none ;
200+ border : none ;
201+ }
202+
203+ .collapse-btn svg {
204+ width : 20px ;
205+ height : 20px ;
206+ }
207+
208+ .create-model-input {
209+ height : 26px ;
210+ border : 2px solid black ;
211+ border-radius : 6px ;
212+ padding : 0 10px ;
213+ width : 160px ;
127214}
128215
129216.create-model-btn {
130- caret-color : transparent ;
217+ height : 30px ;
218+ padding : 0 12px ;
131219 border : 2px solid black ;
132- border-radius : 4px ;
133- background-color : #f4f4f0 ;
134- padding : 0.25rem ;
135- height : 32px ;
220+ border-radius : 6px ;
221+ cursor : pointer ;
136222 font-weight : bold ;
137223}
138-
139224.create-model-btn :hover {
140- cursor : pointer ;
141- transition : 0.1s ;
142225 background-color : #2fff2f ;
143226}
144- </style >
227+
228+
229+ </style >
0 commit comments