-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(ui): add server creation/view/edit, add ui alerts
- Loading branch information
Showing
10 changed files
with
160 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import colors from 'tailwindcss/colors'; | ||
|
||
export type AlertType = 'success' | 'info' | 'warning' | 'danger'; | ||
|
||
interface Props { | ||
message: string; | ||
type: AlertType; | ||
} | ||
|
||
function getAlertStyle({ type }: { type: AlertType }): string { | ||
let color: string = colors.white; | ||
|
||
switch (type) { | ||
case 'success': | ||
color = colors.green[500]; | ||
break; | ||
case 'info': | ||
color = colors.blue[500]; | ||
break; | ||
case 'warning': | ||
color = colors.orange[500]; | ||
break; | ||
case 'danger': | ||
color = colors.red[500]; | ||
break; | ||
} | ||
|
||
return color | ||
} | ||
|
||
export default function Alert({ message, type }: Props) { | ||
const color = getAlertStyle({ type }); | ||
|
||
|
||
return ( | ||
<div className={'absolute bottom-4 right-4'}> | ||
<div | ||
style={{ borderColor: color, color: color }} | ||
className="flex items-center py-3 px-4 text-sm border rounded-lg bg-zinc-800"> | ||
<div> | ||
<span className="font-bold px-2 py-1 text-xs bg-white/10 rounded-full uppercase mr-1">{type}</span> | ||
<span className={'text-gray-400 font-normal text-sm'}>{message}</span> | ||
</div> | ||
</div> | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import Card from '@/Components/Card'; | ||
import Authenticated from '@/Layouts/AuthenticatedLayout'; | ||
import { PageProps, Server } from '@/types'; | ||
import Avatar from 'boring-avatars'; | ||
import ServerForm from './ServerForm'; | ||
|
||
export default function Edit({ server }: PageProps<{ server: Server }>) { | ||
return ( | ||
<Authenticated title={'Edit server: ' + server.name}> | ||
<Card | ||
header={'Edit Server'} | ||
description={ | ||
'Update server details or remove the server from the system.' | ||
} | ||
> | ||
<div className={'grid gap-6 lg:grid-cols-3'}> | ||
<div className={'grid items-center justify-center'}> | ||
<div> | ||
<Avatar | ||
name={server.name} | ||
className={'h-24'} | ||
variant={'beam'} | ||
/> | ||
</div> | ||
</div> | ||
<ServerForm server={server} /> | ||
</div> | ||
</Card> | ||
</Authenticated> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters