-
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.
Add and edit graph from the UI (#45)
* graph from ui * Add relationships, remove relationships, remove resource, fixes * colors improvements, fixes, and code improvements
- Loading branch information
Showing
19 changed files
with
320 additions
and
51 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 |
---|---|---|
@@ -1,17 +1,25 @@ | ||
interface ButtonProps { | ||
onClick: () => void; | ||
label: string; | ||
label?: string; | ||
icon?: React.ForwardRefExoticComponent<React.SVGProps<SVGSVGElement> & { title?: string; titleId?: string }>; | ||
background?: boolean; | ||
danger?: boolean; | ||
} | ||
|
||
export function Button(props: ButtonProps) { | ||
return ( | ||
<button | ||
onClick={() => props.onClick!()} | ||
className="text-secondary font-extrabold hover:text-primary transition-colors bg-secondary p-2 pr-3 text-xs flex items-center rounded gap-1" | ||
className={`h-9 text-secondary font-extrabold hover:text-primary transition-colors ${ | ||
props.background ? 'bg-secondary' : '' | ||
} p-2 text-xs flex items-center rounded gap-1 ${props.danger ? 'hover:bg-danger' : ''}`} | ||
> | ||
{props.icon && <props.icon width={15} />} | ||
<div>{props.label}</div> | ||
{props.label && <div>{props.label}</div>} | ||
</button> | ||
); | ||
} | ||
|
||
Button.defaultProps = { | ||
background: true, | ||
}; |
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,38 @@ | ||
import { useRef } from 'react'; | ||
|
||
interface InputProps { | ||
id: string; | ||
placeholder?: string; | ||
label: string; | ||
type?: string; | ||
onChange?: (value: string) => void; | ||
value?: string; | ||
} | ||
|
||
export function Input(props: InputProps): React.ReactElement { | ||
const inputRef = useRef<HTMLInputElement>(null); | ||
|
||
return ( | ||
<div | ||
className="bg-secondary p-1 pl-2 border-0 outline-none rounded text-disabled hover:text-secondary focus-within:text-secondary transition-colors" | ||
onClick={() => inputRef.current?.focus()} | ||
> | ||
<label htmlFor={props.id} className="mr-2 font-bold text-xs"> | ||
{props.label} | ||
</label> | ||
<input | ||
ref={inputRef} | ||
value={props.value ?? ''} | ||
type={props.type} | ||
className="bg-primary outline-none p-1 pl-2 rounded text-primary font-mono" | ||
id={props.id} | ||
placeholder={props.placeholder} | ||
onChange={(e) => props.onChange?.(e.target.value)} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
Input.defaultProps = { | ||
type: 'text', | ||
}; |
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,26 @@ | ||
import { Dialog } from '@headlessui/react'; | ||
import { XMarkIcon } from '@heroicons/react/20/solid'; | ||
|
||
import { Button } from './Button'; | ||
|
||
interface ModalProps { | ||
isOpen: boolean; | ||
close: () => void; | ||
title: string; | ||
children: React.ReactNode; | ||
} | ||
|
||
export function Modal(props: ModalProps) { | ||
return ( | ||
<Dialog open={props.isOpen} onClose={() => props.close()} className="z-50 fixed inset-0 flex items-center justify-center"> | ||
<div className="fixed inset-0 bg-darker opacity-50" /> | ||
<Dialog.Panel className="z-50 p-5 bg-darker w-96 rounded-xl"> | ||
<Dialog.Title className="text-xl font-black mb-5 flex justify-between items-start"> | ||
{props.title} | ||
<Button onClick={() => props.close()} icon={XMarkIcon} background={false} /> | ||
</Dialog.Title> | ||
{props.children} | ||
</Dialog.Panel> | ||
</Dialog> | ||
); | ||
} |
Oops, something went wrong.