-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
272 additions
and
437 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
102 changes: 0 additions & 102 deletions
102
browser/data-browser/src/components/NewInstanceButton/NewBookmarkButton.tsx
This file was deleted.
Oops, something went wrong.
53 changes: 53 additions & 0 deletions
53
browser/data-browser/src/components/NewInstanceButton/NewInstanceButton.tsx
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,53 @@ | ||
import { useResource } from '@tomic/react'; | ||
|
||
import { useSettings } from '../../helpers/AppSettings'; | ||
import { useNewResourceUI } from '../forms/NewForm/useNewResourceUI'; | ||
import { Base } from './Base'; | ||
import { IconType } from 'react-icons'; | ||
|
||
interface NewInstanceButtonProps { | ||
/** URL of the Class to be instantiated */ | ||
klass: string; | ||
subtle?: boolean; | ||
icon?: boolean; | ||
IconComponent?: IconType; | ||
/** subject of the parent Resource, which will be passed to the form */ | ||
parent?: string; | ||
/** Give explicit label. If missing, uses the Shortname of the Class */ | ||
label?: string; | ||
className?: string; | ||
} | ||
|
||
/** A button for creating a new instance of some thing */ | ||
export function NewInstanceButton({ | ||
klass, | ||
subtle, | ||
icon, | ||
IconComponent, | ||
parent, | ||
children, | ||
label, | ||
className, | ||
}: React.PropsWithChildren<NewInstanceButtonProps>): JSX.Element { | ||
const { drive } = useSettings(); | ||
const classResource = useResource(klass); | ||
const showNewResourceUI = useNewResourceUI(); | ||
|
||
const onClick = () => { | ||
showNewResourceUI(klass, parent ?? drive); | ||
}; | ||
|
||
return ( | ||
<Base | ||
className={className} | ||
onClick={onClick} | ||
IconComponent={IconComponent} | ||
title={classResource.title} | ||
icon={icon} | ||
subtle={subtle} | ||
label={label} | ||
> | ||
{children} | ||
</Base> | ||
); | ||
} |
35 changes: 0 additions & 35 deletions
35
browser/data-browser/src/components/NewInstanceButton/NewInstanceButtonDefault.tsx
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
browser/data-browser/src/components/NewInstanceButton/NewInstanceButtonProps.ts
This file was deleted.
Oops, something went wrong.
37 changes: 0 additions & 37 deletions
37
browser/data-browser/src/components/NewInstanceButton/NewOntologyButton.tsx
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
browser/data-browser/src/components/NewInstanceButton/NewTableButton.tsx
This file was deleted.
Oops, something went wrong.
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 @@ | ||
export * from './NewInstanceButton'; |
32 changes: 0 additions & 32 deletions
32
browser/data-browser/src/components/NewInstanceButton/index.tsx
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.