Increase toast interval, add missing package

This commit is contained in:
Jackson Harper 2023-06-13 12:37:01 +08:00
parent e95f3972be
commit c55db9c018
2 changed files with 29 additions and 12 deletions

View file

@ -76,6 +76,12 @@ const readerCommands = () => {
shortcutKeyDescription: 'f',
callback: () => {},
},
{
shortcutKeys: ['escape'],
actionDescription: 'End multi select',
shortcutKeyDescription: 'Escape',
callback: () => {},
},
{
actionDescription: 'Return to library',
shortcutKeys: ['u'],

View file

@ -28,7 +28,7 @@ const FullWidthContainer = styled(HStack, {
width: '100%',
})
type ToastType = 'success' | 'error'
type ToastType = 'success' | 'error'
const showToast = (
message: string,
@ -38,22 +38,33 @@ const showToast = (
) => {
return toast(
({ id }) => (
<FullWidthContainer alignment='center'>
{type === 'success' ? <CheckCircle size={24} color='white' /> : <WarningCircle size={24} color='white' />}
<FullWidthContainer alignment="center">
{type === 'success' ? (
<CheckCircle size={24} color="white" />
) : (
<WarningCircle size={24} color="white" />
)}
<MessageContainer>{message}</MessageContainer>
<HStack distribution='end' css={{marginLeft: 16}}>
<X size={18} style={{cursor: 'pointer'}} color='#CCEAC4' weight='bold' onClick={() => toast.dismiss(id)} />
<HStack distribution="end" css={{ marginLeft: 16 }}>
<X
size={18}
style={{ cursor: 'pointer' }}
color="#CCEAC4"
weight="bold"
onClick={() => toast.dismiss(id)}
/>
</HStack>
</FullWidthContainer>
),
{
style: {
...toastStyles,
background: background,
},
duration: 2000,
...options,
})
style: {
...toastStyles,
background: background,
},
duration: 1500,
...options,
}
)
}
export const showSuccessToast = (message: string, options?: ToastOptions) => {