-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
polish(core): better styling for error screens (#8736)
Co-authored-by: sebastienlorber <lorber.sebastien@gmail.com>
- Loading branch information
1 parent
8e2cfac
commit 6deecd7
Showing
7 changed files
with
76 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
11 changes: 11 additions & 0 deletions
11
packages/docusaurus-theme-common/src/utils/errorBoundaryUtils.module.css
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,11 @@ | ||
/** | ||
* 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. | ||
*/ | ||
|
||
.errorBoundaryError { | ||
white-space: pre-wrap; | ||
color: red; | ||
} |
28 changes: 28 additions & 0 deletions
28
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,28 @@ | ||
/** | ||
* 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'; | ||
import styles from './errorBoundaryUtils.module.css'; | ||
|
||
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> | ||
); | ||
} | ||
|
||
export function ErrorBoundaryError({error}: {error: Error}): JSX.Element { | ||
return <p className={styles.errorBoundaryError}>{error.message}</p>; | ||
} |
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
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