-
Notifications
You must be signed in to change notification settings - Fork 435
feat(clerk-js): Add dev mode warning to components (#3511) #3870
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
octoper
merged 15 commits into
main
from
george/sdk-1805-update-aio-component-ui-to-be-more-obviously-in-dev-mode
Aug 2, 2024
Merged
Changes from all commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
2ec5137
feat(clerk-js): Add dev mode notice to components
desiprisg 4a2f63b
feat(clerk-js): Update Development notice to match designs
octoper 7682753
chore(clerk-js): Add dev notice to footer
octoper 23548e9
fix(clerk-js): Remove missing prop from ClerkAndPagesTag
octoper 1f75627
chore(repo): Remove changes from playgrounf
octoper b285473
chore(repo): Revert change from webpack.config.js
octoper cea4ecb
fix(clerk-js): Apply Dev mopde notice better for all componentns
octoper 1d55b29
chore(clerk-js): Added popoverBox descriptor and UI fixes for develop…
octoper afb90c5
chore(repo): Update changeset
octoper c5eece0
chore(repo): Update changeset
octoper 79dd3a9
Update .changeset/hungry-clouds-return.md
octoper 101068f
feat(clerk-js): Added showDevModeWarning in DisplayConfigResource
octoper b2f4635
feat(clerk-js): Added internal useDevMode hook and also introduced ap…
octoper 741fdbd
chore(clerk-js): Remove wrong padding when dev mode warning are enabled
octoper 109b698
chore(repo): Update changeset
octoper 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| '@clerk/clerk-js': minor | ||
| "@clerk/types": minor | ||
| --- | ||
|
|
||
| Introducing a development mode warning when in development mode in order to mitigate going to production with development keys. | ||
|
|
||
| In case need to deactivate this UI change temporarily to simulate how components will look in production, you can do so by adding the `unsafe_disableDevelopmentModeWarnings` layout appearance prop to `<ClerkProvider>` | ||
|
|
||
| Example: | ||
|
|
||
| ```tsx | ||
| <ClerkProvider | ||
| appearance={{ | ||
| layout: { | ||
| unsafe_disableDevelopmentModeWarnings: true, | ||
| }, | ||
| }} | ||
| /> | ||
| ``` |
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
103 changes: 71 additions & 32 deletions
103
packages/clerk-js/src/ui/elements/Card/CardClerkAndPagesTag.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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import type { ThemableCssProp } from 'ui/styledSystem'; | ||
|
|
||
| import { Box, Text } from '../customizables'; | ||
| import { useDevMode } from '../hooks/useDevMode'; | ||
|
|
||
| type DevModeOverlayProps = { | ||
| gradient?: number; | ||
| }; | ||
|
|
||
| export const DevModeOverlay = (props: DevModeOverlayProps) => { | ||
| const { gradient = 60 } = props; | ||
| const { showDevModeNotice } = useDevMode(); | ||
|
|
||
| if (!showDevModeNotice) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <Box | ||
| sx={t => ({ | ||
| userSelect: 'none', | ||
| pointerEvents: 'none', | ||
| inset: 0, | ||
| position: 'absolute', | ||
| background: `repeating-linear-gradient(-45deg,${t.colors.$warningAlpha100},${t.colors.$warningAlpha100} 6px,${t.colors.$warningAlpha150} 6px,${t.colors.$warningAlpha150} 12px)`, | ||
| maskImage: `linear-gradient(transparent ${gradient}%, black)`, | ||
| })} | ||
| /> | ||
| ); | ||
| }; | ||
|
|
||
| type DevModeNoticeProps = { sx?: ThemableCssProp }; | ||
| export const DevModeNotice = (props: DevModeNoticeProps) => { | ||
| const { sx } = props; | ||
| const { showDevModeNotice } = useDevMode(); | ||
|
|
||
| if (!showDevModeNotice) { | ||
| return null; | ||
| } | ||
|
|
||
| return ( | ||
| <Text | ||
| sx={[ | ||
| t => ({ | ||
| color: t.colors.$warning500, | ||
| fontWeight: t.fontWeights.$semibold, | ||
| padding: t.space.$1x5, | ||
| }), | ||
| sx, | ||
| ]} | ||
| > | ||
| Development mode | ||
| </Text> | ||
| ); | ||
| }; |
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍