-
Notifications
You must be signed in to change notification settings - Fork 2
BA-2205 Copy messages to clipboard #207
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
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
42 changes: 42 additions & 0 deletions
42
packages/design-system/components/web/icons/ErrorIcon/index.tsx
This file contains hidden or 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,42 @@ | ||
| import { FC } from 'react' | ||
|
|
||
| import { SvgIcon, SvgIconProps } from '@mui/material' | ||
|
|
||
| const ErrorIcon: FC<SvgIconProps> = ({ sx, ...props }) => ( | ||
| <SvgIcon sx={{ fontSize: 20, color: 'text.primary', ...sx }} {...props}> | ||
| <svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"> | ||
| <g id="Group"> | ||
| <g id="Group_2"> | ||
| <path | ||
| id="Path" | ||
| d="M12 12V7.5" | ||
| stroke="currentColor" | ||
| strokeWidth="1.5" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| <path | ||
| id="Path_2" | ||
| d="M11.999 15.5C11.861 15.5 11.749 15.612 11.75 15.75C11.75 15.888 11.862 16 12 16C12.138 16 12.25 15.888 12.25 15.75C12.25 15.612 12.138 15.5 11.999 15.5" | ||
| stroke="currentColor" | ||
| strokeWidth="1.5" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| <path | ||
| id="Path_3" | ||
| fillRule="evenodd" | ||
| clipRule="evenodd" | ||
| d="M3 14.3815V9.61948C3 8.01748 3.852 6.53648 5.236 5.73048L9.736 3.11148C11.135 2.29748 12.864 2.29748 14.263 3.11148L18.763 5.73048C20.148 6.53648 21 8.01748 21 9.61948V14.3815C21 15.9835 20.148 17.4645 18.764 18.2705L14.264 20.8895C12.865 21.7035 11.136 21.7035 9.737 20.8895L5.237 18.2705C3.852 17.4645 3 15.9835 3 14.3815Z" | ||
| stroke="currentColor" | ||
| strokeWidth="1.5" | ||
| strokeLinecap="round" | ||
| strokeLinejoin="round" | ||
| /> | ||
| </g> | ||
| </g> | ||
| </svg> | ||
| </SvgIcon> | ||
| ) | ||
|
|
||
| export default ErrorIcon |
This file contains hidden or 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 hidden or 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
12 changes: 12 additions & 0 deletions
12
packages/design-system/providers/web/SnackbarProvider/ProgressBar/index.tsx
This file contains hidden or 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,12 @@ | ||
| import { FC } from 'react' | ||
|
|
||
| import { ProgressBarContainer, ProgressContainer } from './styled' | ||
| import { ProgressAnimationProps } from './types' | ||
|
|
||
| const ProgressAnimation: FC<ProgressAnimationProps> = ({ animationTime, severity }) => ( | ||
| <ProgressContainer severity={severity}> | ||
| <ProgressBarContainer {...{ severity, animationTime }} /> | ||
| </ProgressContainer> | ||
| ) | ||
|
|
||
| export default ProgressAnimation |
34 changes: 34 additions & 0 deletions
34
packages/design-system/providers/web/SnackbarProvider/ProgressBar/styled.tsx
This file contains hidden or 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,34 @@ | ||
| import { Box, alpha } from '@mui/material' | ||
| import { styled } from '@mui/material/styles' | ||
|
|
||
| import { AlertContainerProps, ProgressBarContainerProps } from './types' | ||
|
|
||
| export const ProgressContainer = styled(Box)<AlertContainerProps>(({ theme, severity }) => ({ | ||
| display: 'flex', | ||
| flexDirection: 'column', | ||
| alignItems: 'flex-start', | ||
| width: '100%', | ||
| height: '4px', | ||
| backgroundColor: | ||
| severity === 'info' | ||
| ? alpha(theme.palette.grey[500], 0.24) | ||
| : alpha(theme.palette[severity].main, 0.24), | ||
| })) | ||
|
|
||
| export const ProgressBarContainer = styled(Box)<ProgressBarContainerProps>( | ||
| ({ theme, animationTime, severity }) => ({ | ||
| borderRadius: '50px', | ||
| animation: `increase-width ${animationTime}ms linear forwards`, | ||
| '@keyframes increase-width': { | ||
| from: { | ||
| width: 0, | ||
| }, | ||
| to: { | ||
| width: '100%', | ||
| }, | ||
| }, | ||
| height: '100%', | ||
| backgroundColor: | ||
| severity === 'info' ? theme.palette.text.primary : theme.palette[severity].main, | ||
| }), | ||
| ) |
9 changes: 9 additions & 0 deletions
9
packages/design-system/providers/web/SnackbarProvider/ProgressBar/types.ts
This file contains hidden or 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,9 @@ | ||
| import { AlertColor, BoxProps } from '@mui/material' | ||
|
|
||
| type SeverityProp = { severity: AlertColor } | ||
| type AnimationTimeProp = { animationTime: number } | ||
|
|
||
| export type ProgressAnimationProps = SeverityProp & AnimationTimeProp | ||
|
|
||
| export type AlertContainerProps = SeverityProp & BoxProps | ||
| export type ProgressBarContainerProps = ProgressAnimationProps & BoxProps |
46 changes: 46 additions & 0 deletions
46
packages/design-system/providers/web/SnackbarProvider/__storybook__/Snackbar.mdx
This file contains hidden or 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,46 @@ | ||
| import { Meta } from '@storybook/addon-docs' | ||
|
|
||
| <Meta title="@baseapp-frontend | designSystem/SnackbarProvider/SnackbarProvider" /> | ||
|
|
||
| # Component Documentation | ||
|
|
||
| ## SnackbarProvider | ||
|
|
||
| - **Purpose**: A customized wrapper around MUI's snackbar displaying messages from the notification store. It provides consistent styling for icons and a uniform color scheme. | ||
| - **Expected Behavior**: Renders messages set with 'useNotification'. The messages disappear automatically after a fixed amount of time, but can also be dismissed before by clicking on a close icon. The component can be used with or without a bar indicating the remaining time before the message is dismissed. If used without a bar, the time until automatic dismissal is restarted after the user interacts with the message, if used with bar the message is always dismissed after the timeout, no matter whether the user interacted with it or not. | ||
|
|
||
| ## Props | ||
|
|
||
| - **children** (ReactNode): The content wrapped by the SnackbarProvider. Any components in this wrapped content can make use of 'useNotification' to display messages | ||
| - **shouldShowProgress** (Boolean): The default for showing the progress bar, indicating the time left before the snackbar disappears. Will be overwritten by the 'shouldShowProgress' option of sendToast, if it is set. | ||
| - **...other**: All other props are passed to the snackbar | ||
|
|
||
| ## Example Usage | ||
|
|
||
| ```javascript | ||
| import { SnackbarProvider } from '@baseapp-frontend/design-system/web' | ||
| import { useNotification } from '@baseapp-frontend/utils' | ||
|
|
||
| const MessageEmitter = () => { | ||
| const { sendToast } = useNotification() | ||
|
|
||
| return ( | ||
| <> | ||
| <Button onClick={() => sendToast("Button 1 was clicked", {type: "info"})}> | ||
| Click this button to display a message without progress bar. | ||
| </Button> | ||
| <Button onClick={() => sendToast("Button 2 was clicked", {type: "info", shouldShowProgress: true})}> | ||
| Click this button to display a message with progress bar. | ||
| </Button> | ||
| < /> | ||
| ) | ||
| } | ||
|
|
||
| const MyComponent = () => { | ||
| return ( | ||
| <SnackbarProvider> | ||
| <MessageEmitter /> | ||
| </SnackbarProvider> | ||
| ) | ||
| } | ||
| ``` |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.