Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two-step process for toggling CDP state #494

Merged
merged 33 commits into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
d8cac04
Add a toast message component in design-system.
amovar18 Feb 8, 2024
0668ce6
Add toast message in the popup.
amovar18 Feb 8, 2024
c4e83a2
Persist toastmessage on reload of extension
amovar18 Feb 9, 2024
50c606c
Add styling to toast message
amovar18 Feb 12, 2024
7dfcaf6
Add a button to match the chrome://flags toast-message.
amovar18 Feb 12, 2024
ff21ec3
Add a button to the popup.
amovar18 Feb 12, 2024
3823671
Merge branch 'develop' of github.com:GoogleChromeLabs/ps-analysis-too…
amovar18 Feb 12, 2024
5371e7f
Fix the order of firing of events.
amovar18 Feb 12, 2024
4cd5c6e
Reduce Padding.
amovar18 Feb 12, 2024
d841513
Reduce vertical padding.
amovar18 Feb 12, 2024
288995b
Fix the text and add toast message in popup.
amovar18 Feb 13, 2024
bb1ec41
Add fullstop to the popup messaging.
amovar18 Feb 13, 2024
cda245f
Shorten the devtools message.
amovar18 Feb 13, 2024
536df8b
Remove persistence of the toastMessage
amovar18 Feb 13, 2024
dc458b8
use sessionStorage instead of localStorage from web api
amovar18 Feb 13, 2024
80cc2c1
Fix refresh of the cookies.
amovar18 Feb 14, 2024
5095f4c
revert changes.
amovar18 Feb 14, 2024
46005d6
Fix component showing analyse this tab on newtab open.
amovar18 Feb 14, 2024
3ca6268
Fix service worker popup connection.
amovar18 Feb 14, 2024
0163941
Merge branch 'develop' of github.com:GoogleChromeLabs/ps-analysis-too…
amovar18 Feb 14, 2024
91c399d
Fix the messaging.
amovar18 Feb 14, 2024
915de8e
Fix value being set add new state for display.
amovar18 Feb 15, 2024
f4bb42b
Fix 0 cookies landing page on multitab debugging issue.
amovar18 Feb 15, 2024
370eadc
Fix padding and the design.
amovar18 Feb 15, 2024
e182cc9
Add breakpoints for the button.
amovar18 Feb 15, 2024
f322b10
Fix the fontsize
amovar18 Feb 15, 2024
844d7dc
Fix breakpoints
amovar18 Feb 15, 2024
559265b
Fix text for button.
amovar18 Feb 16, 2024
2f11de0
Fix message not showing up in popup.
amovar18 Feb 16, 2024
b2eba82
Add comment to listener.
amovar18 Feb 16, 2024
deb1a8f
Merge branch 'develop' of github.com:GoogleChromeLabs/ps-analysis-too…
amovar18 Feb 16, 2024
2b23d57
ref: use absolute to spread toast message
mayan-000 Feb 19, 2024
9de2a6c
Fix the toastmessage while scrolling.
amovar18 Feb 19, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 80 additions & 25 deletions packages/design-system/src/components/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ interface ButtonProps {
onClick?: () => void;
loading?: boolean;
type?: 'button' | 'submit' | 'reset';
variant?: 'primary' | 'secondary' | 'danger' | 'small';
variant?: 'primary' | 'secondary' | 'danger' | 'small' | 'large';
extraClasses?: string;
}
const Button = ({
Expand All @@ -36,30 +36,85 @@ const Button = ({
variant = 'primary',
extraClasses = '',
}: ButtonProps) => {
return (
<button
data-test-id="button"
type={type}
name={name}
onClick={onClick ? onClick : undefined}
className={classNames(
'rounded flex items-center text-center',
extraClasses,
{
'py-1 px-2 font-medium': variant !== 'small',
'py-0.5 px-1.5 text-xs': variant === 'small',
'text-white dark:bg-baby-blue-eyes bg-sapphire hover:bg-tufts-blue dark:hover:bg-pale-cornflower-blue dark:text-raisin-black':
['primary', 'small'].includes(variant),
'bg-transparent dark:bg-transparent dark:text-bright-gray text-raisin-black active:opacity-60 hover:opacity-80':
variant === 'secondary',
'text-white dark:text-white dark:bg-red-500 bg-red-500 hover:bg-red-600':
variant === 'danger',
}
)}
>
{text}
</button>
);
switch (variant) {
case 'small':
return (
<button
data-test-id="button"
type={type}
name={name}
onClick={onClick ? onClick : undefined}
className={classNames(
'rounded flex items-center text-center py-0.5 px-1.5 text-xs text-white dark:bg-baby-blue-eyes bg-sapphire hover:bg-tufts-blue dark:hover:bg-pale-cornflower-blue dark:text-raisin-black',
extraClasses
)}
>
{text}
</button>
);
case 'large':
return (
<button
data-test-id="button"
type={type}
name={name}
onClick={onClick ? onClick : undefined}
className={classNames(
'font-medium rounded-xs flex items-center text-center md:py-3.5 md:px-9 xxs:max-sm:p-2 xs:max-md:py-4 sm:max-md:px-2 text-white dark:bg-google-blue bg-smurf-blue hover:bg-beteleguese dark:hover:bg-bright-navy-blue dark:text-raisin-black',
extraClasses
)}
>
{text}
</button>
);
case 'primary':
return (
<button
data-test-id="button"
type={type}
name={name}
onClick={onClick ? onClick : undefined}
className={classNames(
'rounded flex items-center text-center py-1 px-2 font-medium text-white dark:bg-baby-blue-eyes bg-sapphire hover:bg-tufts-blue dark:hover:bg-pale-cornflower-blue dark:text-raisin-black',
extraClasses
)}
>
{text}
</button>
);
case 'secondary':
return (
<button
data-test-id="button"
type={type}
name={name}
onClick={onClick ? onClick : undefined}
className={classNames(
'rounded flex items-center text-center py-1 px-2 font-medium bg-transparent dark:bg-transparent dark:text-bright-gray text-raisin-black active:opacity-60 hover:opacity-80',
extraClasses
)}
>
{text}
</button>
);
case 'danger':
return (
<button
data-test-id="button"
type={type}
name={name}
onClick={onClick ? onClick : undefined}
className={classNames(
'rounded flex items-center text-center py-1 px-2 font-medium text-white dark:text-white dark:bg-red-500 bg-red-500 hover:bg-red-600',
extraClasses
)}
>
{text}
</button>
);
default:
return <></>;
}
};

export default Button;
1 change: 1 addition & 0 deletions packages/design-system/src/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export * from './table';
export { default as SearchInput } from './searchInput';
export * from './sidebar';
export { default as InspectButton } from './inspectButton';
export { default as ToastMessage } from './toastMessage';
export {
default as CookiesLandingContainer,
type CookiesLandingContainerProps,
Expand Down
64 changes: 64 additions & 0 deletions packages/design-system/src/components/toastMessage/index.tsx
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;
Loading
Loading