-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(live-codeblock): add error boundary to live code preview (#8015)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
- Loading branch information
Showing
5 changed files
with
64 additions
and
16 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
23 changes: 23 additions & 0 deletions
23
packages/docusaurus-theme-common/src/utils/errorBoundaryUtils.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,23 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
import React, {type ComponentProps} from 'react'; | ||
import Translate from '@docusaurus/Translate'; | ||
|
||
export function ErrorBoundaryTryAgainButton( | ||
props: ComponentProps<'button'>, | ||
): JSX.Element { | ||
return ( | ||
<button type="button" {...props}> | ||
<Translate | ||
id="theme.ErrorPageContent.tryAgain" | ||
description="The label of the button to try again rendering when the React error boundary captures an error"> | ||
Try again | ||
</Translate> | ||
</button> | ||
); | ||
} |
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 |
---|---|---|
|
@@ -38,3 +38,7 @@ | |
padding: 1rem; | ||
background-color: var(--ifm-pre-background); | ||
} | ||
|
||
.errorFallback { | ||
padding: 0.55rem; | ||
} |