-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(lemon-ui): fix lemon toast overflow (#19391)
- Loading branch information
1 parent
148c888
commit a8fc6ec
Showing
72 changed files
with
189 additions
and
62 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+13.1 KB
frontend/__snapshots__/lemon-ui-lemon-toast--billing-error--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+15.6 KB
frontend/__snapshots__/lemon-ui-lemon-toast--with-progress--light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
2 changes: 1 addition & 1 deletion
2
frontend/src/lib/components/AddToDashboard/addToDashboardModalLogic.ts
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
2 changes: 1 addition & 1 deletion
2
frontend/src/lib/components/IntervalFilter/intervalFilterLogic.ts
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
127 changes: 127 additions & 0 deletions
127
frontend/src/lib/lemon-ui/LemonToast/LemonToast.stories.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,127 @@ | ||
import { Meta, StoryObj } from '@storybook/react' | ||
import { useEffect } from 'react' | ||
import { Slide, ToastContainer } from 'react-toastify' | ||
|
||
import { lemonToast, ToastCloseButton, ToastContent, ToastContentProps } from './LemonToast' | ||
|
||
const meta: Meta<typeof ToastContent> = { | ||
title: 'Lemon UI/Lemon Toast', | ||
component: ToastContent, | ||
parameters: { | ||
testOptions: { | ||
include3000: true, | ||
waitForLoadersToDisappear: false, | ||
snapshotTargetSelector: '.Toastify__toast-container', | ||
}, | ||
}, | ||
} | ||
|
||
type ToastStory = { | ||
toasts: ToastContentProps[] | ||
} | ||
|
||
export default meta | ||
type Story = StoryObj<ToastStory> | ||
|
||
export const ToastTypes: Story = { | ||
args: { | ||
toasts: [ | ||
{ | ||
type: 'info', | ||
message: 'An info toast', | ||
}, | ||
{ | ||
type: 'success', | ||
message: 'A success toast', | ||
}, | ||
{ | ||
type: 'warning', | ||
message: 'A warning toast', | ||
}, | ||
{ | ||
type: 'error', | ||
message: 'An error toast', | ||
}, | ||
], | ||
}, | ||
render: (args, { globals }) => { | ||
const isDarkModeOn = globals.theme === 'dark' | ||
|
||
useEffect(() => { | ||
lemonToast.dismiss() | ||
args.toasts.forEach((toast) => { | ||
const { type, message, ...rest } = toast | ||
lemonToast[type](message, rest) | ||
}) | ||
}, [isDarkModeOn]) | ||
|
||
return ( | ||
<ToastContainer | ||
position="top-left" // different from app | ||
autoClose={false} // different from app | ||
transition={Slide} | ||
closeOnClick={false} | ||
draggable={false} | ||
closeButton={<ToastCloseButton />} | ||
theme={isDarkModeOn ? 'dark' : 'light'} | ||
/> | ||
) | ||
}, | ||
} | ||
|
||
export const BillingError: Story = { | ||
...ToastTypes, | ||
args: { | ||
toasts: [ | ||
{ | ||
type: 'error', | ||
message: | ||
'Load experiment failed: This feature is part of the premium PostHog offering. To use it, subscribe to PostHog Cloud with a generous free tier: https://app.posthog.com/organization/billing', | ||
}, | ||
], | ||
}, | ||
} | ||
|
||
export const WithButton: Story = { | ||
...ToastTypes, | ||
args: { | ||
toasts: [ | ||
{ | ||
type: 'success', | ||
message: 'Insight added to dashboard', | ||
button: { | ||
label: 'View dashboard', | ||
action: (): void => {}, | ||
}, | ||
}, | ||
], | ||
}, | ||
} | ||
|
||
export const WithProgress: Story = { | ||
...ToastTypes, | ||
args: { | ||
toasts: [ | ||
{ | ||
type: 'info', | ||
message: 'An info toast with progress', | ||
progress: 0.4, | ||
} as ToastContentProps, | ||
{ | ||
type: 'success', | ||
message: 'A success toast with progress', | ||
progress: 0.4, | ||
} as ToastContentProps, | ||
{ | ||
type: 'warning', | ||
message: 'A warning toast with progress', | ||
progress: 0.4, | ||
} as ToastContentProps, | ||
{ | ||
type: 'error', | ||
message: 'An error toast with progress', | ||
progress: 0.4, | ||
} as ToastContentProps, | ||
], | ||
}, | ||
} |
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 @@ | ||
export { lemonToast } from './LemonToast' |
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
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
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
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
Oops, something went wrong.