-
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add share functionality to website
- Loading branch information
1 parent
1b02833
commit 156c5e9
Showing
8 changed files
with
159 additions
and
15 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
57 changes: 57 additions & 0 deletions
57
apps/studio-next/src/components/Modals/ImportUUIDModal.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,57 @@ | ||
import { useState } from 'react'; | ||
import toast from 'react-hot-toast'; | ||
import { create } from '@ebay/nice-modal-react'; | ||
|
||
import { ConfirmModal } from './index'; | ||
|
||
import { useServices } from '../../services'; | ||
|
||
export const ImportUUIDModal = create(() => { | ||
const [shareID, setShareID] = useState(''); | ||
const { editorSvc } = useServices(); | ||
|
||
const onSubmit = () => { | ||
toast.promise(editorSvc.importFromShareID(shareID), { | ||
loading: 'Importing...', | ||
success: ( | ||
<div> | ||
<span className="block text-bold"> | ||
Document succesfully imported! | ||
</span> | ||
</div> | ||
), | ||
error: ( | ||
<div> | ||
<span className="block text-bold text-red-400"> | ||
Failed to import document. | ||
</span> | ||
</div> | ||
), | ||
}); | ||
}; | ||
|
||
return ( | ||
<ConfirmModal | ||
title="Import AsyncAPI document from Shared UUID" | ||
confirmText="Import" | ||
confirmDisabled={!shareID} | ||
onSubmit={onSubmit} | ||
> | ||
<div className="flex content-center justify-center"> | ||
<label | ||
htmlFor="url" | ||
className="flex justify-right items-center content-center text-sm font-medium text-gray-700 hidden" | ||
> | ||
Shared UUID | ||
</label> | ||
<input | ||
type="url" | ||
name="url" | ||
placeholder="Paste UUID here" | ||
className="shadow-sm focus:ring-pink-500 focus:border-pink-500 block w-full sm:text-sm border-gray-300 rounded-md py-2 px-3 text-gray-700 border-pink-300 border-2" | ||
onChange={e => setShareID(e.target.value)} | ||
/> | ||
</div> | ||
</ConfirmModal> | ||
); | ||
}); |
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
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