Rework task pane UI and document design guidelines
- Add a header, a shared accordion, a docked status region, and token-based styles - Use the blue primary style for every action button and collapse all sections by default - Improve labels, selection hints, destructive confirmations, grid semantics, and narrow-pane layout - Add docs/UI_GUIDELINES.md and update the README, user guide, and developer guide
This commit is contained in:
1 parent
89989c04e9
commit
e223dc61c8
23 files changed
+719
-549
No files matched your search
@@ -4,6 +4,7 @@
|
||||
*/
|
||||
|
||||
import * as React from "react";
|
||||
import { Button, makeStyles, Text, tokens } from "@fluentui/react-components";
|
||||
import { getErrorMessage } from "../types/office-types";
|
||||
|
||||
interface ErrorBoundaryProps {
|
||||
@@ -15,6 +16,37 @@ interface ErrorBoundaryState {
|
||||
message: string;
|
||||
}
|
||||
|
||||
const useStyles = makeStyles({
|
||||
root: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "flex-start",
|
||||
gap: tokens.spacingVerticalM,
|
||||
padding: tokens.spacingVerticalL,
|
||||
backgroundColor: tokens.colorNeutralBackground1
|
||||
},
|
||||
message: {
|
||||
color: tokens.colorNeutralForeground2,
|
||||
whiteSpace: "pre-wrap"
|
||||
}
|
||||
});
|
||||
|
||||
const ErrorFallback: React.FC<{ message: string }> = ({ message }) => {
|
||||
const styles = useStyles();
|
||||
|
||||
return (
|
||||
<div role="alert" className={styles.root}>
|
||||
<Text size={400} weight="semibold">Edison could not load</Text>
|
||||
<Text size={300} className={styles.message}>
|
||||
{message || "An unexpected error occurred."}
|
||||
</Text>
|
||||
<Button appearance="primary" onClick={() => window.location.reload()}>
|
||||
Reload task pane
|
||||
</Button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
|
||||
state: ErrorBoundaryState = { hasError: false, message: "" };
|
||||
|
||||
@@ -28,15 +60,7 @@ export class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoun
|
||||
|
||||
render(): React.ReactNode {
|
||||
if (this.state.hasError) {
|
||||
return (
|
||||
<div role="alert" style={{ padding: "16px", fontFamily: "inherit" }}>
|
||||
<h2 style={{ marginTop: 0, fontSize: "16px" }}>Edison could not load</h2>
|
||||
<p style={{ fontSize: "13px" }}>{this.state.message || "An unexpected error occurred."}</p>
|
||||
<button type="button" onClick={() => window.location.reload()}>
|
||||
Reload task pane
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
return <ErrorFallback message={this.state.message} />;
|
||||
}
|
||||
|
||||
return this.props.children;
|
||||
|
||||
Reference in new issue
Block a user