-
Notifications
You must be signed in to change notification settings - Fork 323
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
8 changed files
with
112 additions
and
0 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,25 @@ | ||
import { FC } from 'react' | ||
import { components, events, renderClassName, EventContextProvider, models } from 'fastui' | ||
import BootstrapToast from 'react-bootstrap/Toast' | ||
import BootstrapToastContainer from 'react-bootstrap/ToastContainer' | ||
|
||
export const Toast: FC<models.Toast> = (props) => { | ||
const { className, title, body, position, openTrigger, openContext } = props | ||
|
||
const { eventContext, fireId, clear } = events.usePageEventListen(openTrigger, openContext) | ||
|
||
return ( | ||
<EventContextProvider context={eventContext}> | ||
<BootstrapToastContainer position={position} className="position-fixed bottom-0 end-0 p-3"> | ||
<BootstrapToast className={renderClassName(className)} show={!!fireId} onClose={clear}> | ||
<BootstrapToast.Header> | ||
<strong className="me-auto">{title}</strong> | ||
</BootstrapToast.Header> | ||
<BootstrapToast.Body> | ||
<components.AnyCompList propsList={body} /> | ||
</BootstrapToast.Body> | ||
</BootstrapToast> | ||
</BootstrapToastContainer> | ||
</EventContextProvider> | ||
) | ||
} |
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,22 @@ | ||
import { FC, useEffect } from 'react' | ||
|
||
import type { Toast } from '../models' | ||
|
||
import { usePageEventListen } from '../events' | ||
|
||
export const ToastComp: FC<Toast> = (props) => { | ||
const { title, openTrigger, openContext } = props | ||
|
||
const { fireId, clear } = usePageEventListen(openTrigger, openContext) | ||
|
||
useEffect(() => { | ||
if (fireId) { | ||
setTimeout(() => { | ||
alert(`${title}\n\nNote: modals are not implemented by pure FastUI, implement a component for 'ToastProps'.`) | ||
clear() | ||
}) | ||
} | ||
}, [fireId, title, clear]) | ||
|
||
return <></> | ||
} |
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