11<template >
22 <main class =" relation-container" >
3- <div class =" grid-2x2 " >
3+ <div class =" input-container " >
44 <div class =" input-group" >
5- <label class =" relation-label" >Field Name: </label >
5+ <label class =" relation-label" >Field name </label >
66 <input class =" relation-input" v-model =" fieldName" type =" text" />
77 </div >
88
99 <div class =" input-group" >
10- <label class =" relation-label" >Target Model: </label >
10+ <label class =" relation-label" >Target model </label >
1111 <select class =" relation-select" v-model =" selectedNodeId" >
1212 <option disabled value =" " >-- Select a model --</option >
1313 <option v-for =" node in filteredNodes" :key =" node.id" :value =" node.id" >
1717 </div >
1818
1919 <div class =" input-group" >
20- <label class =" relation-label" >OnDelete: </label >
20+ <label class =" relation-label" >OnDelete</label >
2121 <select class =" relation-select" v-model =" onDelete" >
2222 <option disabled value =" " >-- Select behavior --</option >
2323 <option value =" CASCADE" >CASCADE</option >
2626 </div >
2727
2828 <div class =" input-group" >
29- <label class =" relation-label" >Back Populates: </label >
29+ <label class =" relation-label" >Back populates </label >
3030 <input class =" relation-input" v-model =" backPopulates" type =" text" />
3131 </div >
3232 </div >
@@ -82,7 +82,6 @@ const filteredNodes = computed(() => projectStore.nodes.filter((node) => node.id
8282
8383const saveChanges = () => {
8484 if (! selectedNodeId .value || ! fieldName .value ) return
85-
8685 projectStore .updateRelation (props .id , props .relation .targetModel , props .relation .fieldName , {
8786 fieldName: fieldName .value ,
8887 targetModel: selectedNodeId .value ,
@@ -92,7 +91,6 @@ const saveChanges = () => {
9291 isUnique: unique .value ,
9392 isIndex: indexed .value ,
9493 })
95-
9694 modalStore .close ()
9795}
9896
@@ -107,60 +105,53 @@ const deleteRelation = () => {
107105 display : flex ;
108106 flex-direction : column ;
109107 gap : 1rem ;
110- border : 2px solid black ;
111108 padding : 1rem ;
112- box-shadow : 4px 4px 0px black ;
113- background-color : #fff ;
114109}
115110
116- .grid-2x2 {
117- display : grid ;
118- grid-template-columns : 1 fr 1 fr ;
111+ .input-container {
112+ display : flex ;
113+ flex-direction : column ;
119114 gap : 1rem ;
120115}
121116
122117.input-group {
123118 display : flex ;
124119 flex-direction : column ;
120+ gap : 0.15rem ;
125121}
126122
127123.relation-label {
128124 font-weight : bold ;
129- margin-bottom : 0.25 rem ;
125+ margin-bottom : 5 px ;
130126}
131127
132128.relation-input ,
133129.relation-select {
134130 border : 2px solid black ;
135- border-radius : 4px ;
136- padding : 0.5rem ;
137- box-shadow : 3px 3px 0px black ;
138- background-color : var (--color-background );
139- transition :
140- transform 0.1s ease-in-out ,
141- box-shadow 0.1s ease-in-out ;
142- }
143-
144- .relation-input :focus ,
145- .relation-select :focus {
146- outline : none ;
147- transform : translate (2px , 2px );
148- box-shadow : none ;
131+ border-radius : 6px ;
132+ padding : 0.6rem ;
133+ background-color : white ;
149134}
150135
151136.checkbox-group {
152137 display : flex ;
153- justify-content : space-between ;
154- gap : 1 rem ;
138+ flex-direction : column ;
139+ gap : 0.5 rem ;
155140 font-weight : bold ;
156141}
157142
143+ .action-group {
144+ gap : 0.5rem ;
145+ margin-top : 2rem ;
146+ display : flex ;
147+ flex-direction : column ;
148+ }
149+
158150.save-relation-btn {
159- align-self : flex-end ;
151+ width : 100 % ;
160152 padding : 0.5rem 1rem ;
161153 border : 2px solid black ;
162154 border-radius : 4px ;
163- font-weight : bold ;
164155 background-color : var (--color-success );
165156 box-shadow : 3px 3px 0px black ;
166157 transition :
@@ -175,11 +166,10 @@ const deleteRelation = () => {
175166}
176167
177168.delete-relation-btn {
178- align-self : flex-end ;
169+ width : 100 % ;
179170 padding : 0.5rem 1rem ;
180171 border : 2px solid black ;
181172 border-radius : 4px ;
182- font-weight : bold ;
183173 background-color : var (--color-danger );
184174 box-shadow : 3px 3px 0px black ;
185175 transition :
@@ -192,10 +182,4 @@ const deleteRelation = () => {
192182 transform : translate (2px , 2px );
193183 box-shadow : none ;
194184}
195-
196- .action-group {
197- display : flex ;
198- justify-content : space-between ;
199- gap : 1rem ;
200- }
201185 </style >
0 commit comments