@@ -17,6 +17,11 @@ import Can from '@/components/elements/Can';
1717import { ServerDatabase } from '@/api/server/getServerDatabases' ;
1818import useServer from '@/plugins/useServer' ;
1919import useFlash from '@/plugins/useFlash' ;
20+ import tw from 'twin.macro' ;
21+ import Button from '@/components/elements/Button' ;
22+ import Label from '@/components/elements/Label' ;
23+ import Input from '@/components/elements/Input' ;
24+ import GreyRowBox from '@/components/elements/GreyRowBox' ;
2025
2126interface Props {
2227 database : ServerDatabase ;
@@ -51,13 +56,14 @@ export default ({ database, className }: Props) => {
5156 addError ( { key : 'database:delete' , message : httpErrorToHuman ( error ) } ) ;
5257 } ) ;
5358 } ;
54-
59+
5560 return (
56- < React . Fragment >
61+ < >
5762 < Formik
5863 onSubmit = { submit }
5964 initialValues = { { confirm : '' } }
6065 validationSchema = { schema }
66+ isInitialValid = { false }
6167 >
6268 {
6369 ( { isSubmitting, isValid, resetForm } ) => (
@@ -70,98 +76,98 @@ export default ({ database, className }: Props) => {
7076 resetForm ( ) ;
7177 } }
7278 >
73- < FlashMessageRender byKey = { 'database:delete' } className = { ' mb-6' } />
74- < h3 className = { ' mb-6' } > Confirm database deletion</ h3 >
75- < p className = { ' text-sm' } >
79+ < FlashMessageRender byKey = { 'database:delete' } css = { tw ` mb-6` } />
80+ < h2 css = { tw `text-2xl mb-6` } > Confirm database deletion</ h2 >
81+ < p css = { tw ` text-sm` } >
7682 Deleting a database is a permanent action, it cannot be undone. This will permanetly
7783 delete the < strong > { database . name } </ strong > database and remove all associated data.
7884 </ p >
79- < Form className = { ' m-0 mt-6' } >
85+ < Form css = { tw ` m-0 mt-6` } >
8086 < Field
8187 type = { 'text' }
8288 id = { 'confirm_name' }
8389 name = { 'confirm' }
8490 label = { 'Confirm Database Name' }
8591 description = { 'Enter the database name to confirm deletion.' }
8692 />
87- < div className = { ' mt-6 text-right' } >
88- < button
93+ < div css = { tw ` mt-6 text-right` } >
94+ < Button
8995 type = { 'button' }
90- className = { 'btn btn-sm btn-secondary mr-2' }
96+ isSecondary
97+ css = { tw `mr-2` }
9198 onClick = { ( ) => setVisible ( false ) }
9299 >
93100 Cancel
94- </ button >
95- < button
101+ </ Button >
102+ < Button
96103 type = { 'submit' }
97- className = { 'btn btn-sm btn- red' }
104+ color = { 'red' }
98105 disabled = { ! isValid }
99106 >
100107 Delete Database
101- </ button >
108+ </ Button >
102109 </ div >
103110 </ Form >
104111 </ Modal >
105112 )
106113 }
107114 </ Formik >
108115 < Modal visible = { connectionVisible } onDismissed = { ( ) => setConnectionVisible ( false ) } >
109- < FlashMessageRender byKey = { 'database-connection-modal' } className = { ' mb-6' } />
110- < h3 className = { ' mb-6' } > Database connection details</ h3 >
116+ < FlashMessageRender byKey = { 'database-connection-modal' } css = { tw ` mb-6` } />
117+ < h3 css = { tw ` mb-6` } > Database connection details</ h3 >
111118 < Can action = { 'database.view_password' } >
112119 < div >
113- < label className = { 'input-dark-label' } > Password</ label >
114- < input type = { 'text' } className = { 'input-dark' } readOnly = { true } value = { database . password } />
120+ < Label > Password</ Label >
121+ < Input type = { 'text' } readOnly value = { database . password } />
115122 </ div >
116123 </ Can >
117- < div className = { ' mt-6' } >
118- < label className = { 'input-dark-label' } > JBDC Connection String</ label >
119- < input
124+ < div css = { tw ` mt-6` } >
125+ < Label > JBDC Connection String</ Label >
126+ < Input
120127 type = { 'text' }
121- className = { 'input-dark' }
122- readOnly = { true }
128+ readOnly
123129 value = { `jdbc:mysql://${ database . username } :${ database . password } @${ database . connectionString } /${ database . name } ` }
124130 />
125131 </ div >
126- < div className = { ' mt-6 text-right' } >
132+ < div css = { tw ` mt-6 text-right` } >
127133 < Can action = { 'database.update' } >
128134 < RotatePasswordButton databaseId = { database . id } onUpdate = { appendDatabase } />
129135 </ Can >
130- < button className = { 'btn btn-sm btn-secondary' } onClick = { ( ) => setConnectionVisible ( false ) } >
136+ < Button isSecondary onClick = { ( ) => setConnectionVisible ( false ) } >
131137 Close
132- </ button >
138+ </ Button >
133139 </ div >
134140 </ Modal >
135- < div className = { classNames ( 'grey-row-box no-hover' , className ) } >
136- < div className = { 'icon' } >
137- < FontAwesomeIcon icon = { faDatabase } fixedWidth = { true } />
141+ < GreyRowBox $hoverable = { false } className = { className } >
142+ < div >
143+ < FontAwesomeIcon icon = { faDatabase } fixedWidth />
138144 </ div >
139- < div className = { ' flex-1 ml-4' } >
140- < p className = { ' text-lg' } > { database . name } </ p >
145+ < div css = { tw ` flex-1 ml-4` } >
146+ < p css = { tw ` text-lg` } > { database . name } </ p >
141147 </ div >
142- < div className = { ' ml-8 text-center' } >
143- < p className = { ' text-sm' } > { database . connectionString } </ p >
144- < p className = { ' mt-1 text-2xs text-neutral-500 uppercase select-none' } > Endpoint</ p >
148+ < div css = { tw ` ml-8 text-center` } >
149+ < p css = { tw ` text-sm` } > { database . connectionString } </ p >
150+ < p css = { tw ` mt-1 text-2xs text-neutral-500 uppercase select-none` } > Endpoint</ p >
145151 </ div >
146- < div className = { ' ml-8 text-center' } >
147- < p className = { ' text-sm' } > { database . allowConnectionsFrom } </ p >
148- < p className = { ' mt-1 text-2xs text-neutral-500 uppercase select-none' } > Connections from</ p >
152+ < div css = { tw ` ml-8 text-center` } >
153+ < p css = { tw ` text-sm` } > { database . allowConnectionsFrom } </ p >
154+ < p css = { tw ` mt-1 text-2xs text-neutral-500 uppercase select-none` } > Connections from</ p >
149155 </ div >
150- < div className = { ' ml-8 text-center' } >
151- < p className = { ' text-sm' } > { database . username } </ p >
152- < p className = { ' mt-1 text-2xs text-neutral-500 uppercase select-none' } > Username</ p >
156+ < div css = { tw ` ml-8 text-center` } >
157+ < p css = { tw ` text-sm` } > { database . username } </ p >
158+ < p css = { tw ` mt-1 text-2xs text-neutral-500 uppercase select-none` } > Username</ p >
153159 </ div >
154- < div className = { ' ml-8' } >
155- < button className = { 'btn btn-sm btn-secondary mr-2' } onClick = { ( ) => setConnectionVisible ( true ) } >
156- < FontAwesomeIcon icon = { faEye } fixedWidth = { true } />
157- </ button >
160+ < div css = { tw ` ml-8` } >
161+ < Button isSecondary css = { tw ` mr-2` } onClick = { ( ) => setConnectionVisible ( true ) } >
162+ < FontAwesomeIcon icon = { faEye } fixedWidth />
163+ </ Button >
158164 < Can action = { 'database.delete' } >
159- < button className = { 'btn btn-sm btn-secondary btn- red' } onClick = { ( ) => setVisible ( true ) } >
160- < FontAwesomeIcon icon = { faTrashAlt } fixedWidth = { true } />
161- </ button >
165+ < Button color = { 'red' } isSecondary onClick = { ( ) => setVisible ( true ) } >
166+ < FontAwesomeIcon icon = { faTrashAlt } fixedWidth />
167+ </ Button >
162168 </ Can >
163169 </ div >
164- </ div >
165- </ React . Fragment >
170+ </ GreyRowBox >
171+ </ >
166172 ) ;
167173} ;
0 commit comments