mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-06 12:52:31 +02:00
fix(live-codeblock): add error boundary to live code preview (#8015)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
80064b2eb9
commit
79b3f65a17
5 changed files with 64 additions and 16 deletions
|
@ -80,3 +80,5 @@ export {usePrismTheme} from './hooks/usePrismTheme';
|
|||
export {useDocsPreferredVersion} from './contexts/docsPreferredVersion';
|
||||
|
||||
export {processAdmonitionProps} from './utils/admonitionUtils';
|
||||
|
||||
export {ErrorBoundaryTryAgainButton} from './utils/errorBoundaryUtils';
|
||||
|
|
|
@ -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>
|
||||
);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue