-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Two-step process for toggling CDP state (#494)
* Add a toast message component in design-system. Add mechanism in place to reload all the tabs. Add mechanism to show the reload button in the devtools. * Add toast message in the popup. * Persist toastmessage on reload of extension * Add styling to toast message * Add a button to match the chrome://flags toast-message. * Add a button to the popup. * Fix the order of firing of events. * Reduce Padding. * Reduce vertical padding. * Fix the text and add toast message in popup. * Add fullstop to the popup messaging. * Shorten the devtools message. * Remove persistence of the toastMessage * use sessionStorage instead of localStorage from web api * Fix refresh of the cookies. * revert changes. * Fix component showing analyse this tab on newtab open. * Fix service worker popup connection. * Fix the messaging. * Fix value being set add new state for display. * Fix 0 cookies landing page on multitab debugging issue. * Fix padding and the design. * Add breakpoints for the button. Add breakpoints for text. * Fix the fontsize * Fix breakpoints * Fix text for button. * Fix message not showing up in popup. * Add comment to listener. Add default case to switch block. * ref: use absolute to spread toast message * Fix the toastmessage while scrolling. --------- Co-authored-by: Mayank Rana <mayankranax1@gmail.com>
- Loading branch information
Showing
12 changed files
with
557 additions
and
134 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
64 changes: 64 additions & 0 deletions
64
packages/design-system/src/components/toastMessage/index.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,64 @@ | ||
/* | ||
* Copyright 2024 Google LLC | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* https://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
/** | ||
* External dependencies. | ||
*/ | ||
import React, { forwardRef } from 'react'; | ||
|
||
/** | ||
* Internal dependencies. | ||
*/ | ||
import Button from '../button'; | ||
|
||
interface ToastMessageProps { | ||
text: string; | ||
onClick: () => void; | ||
additionalStyles?: string; | ||
textAdditionalStyles?: string; | ||
variant?: 'primary' | 'secondary' | 'danger' | 'small' | 'large'; | ||
buttonText?: string; | ||
} | ||
const ToastMessage = forwardRef<HTMLDivElement, ToastMessageProps>( | ||
function ToastMessage( | ||
{ | ||
text, | ||
onClick, | ||
additionalStyles = '', | ||
textAdditionalStyles = '', | ||
variant = 'large', | ||
buttonText = 'Reload', | ||
}: ToastMessageProps, | ||
ref | ||
) { | ||
return ( | ||
<div | ||
ref={ref} | ||
className={`${additionalStyles} absolute inset-x-0 bottom-0 w-full z-2 bg-white dark:bg-charleston-green shadow-xxs`} | ||
> | ||
<div className="flex items-center justify-between p-4"> | ||
<div className={`w-5/6 dark:text-white ${textAdditionalStyles}`}> | ||
{text} | ||
</div> | ||
<div className="w-1/6"> | ||
<Button text={buttonText} onClick={onClick} variant={variant} /> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} | ||
); | ||
|
||
export default ToastMessage; |
Oops, something went wrong.