Files
webstudio/apps/builder/app/shared/error/error-message.client.tsx
Bogdan Chadkin 29e455a9b7 fix: remove Text Content property from Image component (#5195)
Was accidentally added when rewriting content model.

Also fixed two other issues

- user can override text color in error boundary with global root
- text content property now have tooltip with description and it can be
reset

<img width="320" alt="Screenshot 2025-05-10 at 18 14 19"
src="https://github.com/user-attachments/assets/ffb16efc-e7b5-44d1-a214-0a9251e9eb9d"
/>
2025-05-11 01:10:27 +04:00

104 lines
2.3 KiB
TypeScript

import {
AccessibleIcon,
css,
Grid,
Link,
Text,
theme,
buttonStyle,
} from "@webstudio-is/design-system";
import { WebstudioIcon } from "@webstudio-is/icons";
const pageStyle = css({
position: "fixed",
justifyItems: "center",
alignContent: "start",
inset: 0,
background: theme.colors.brandBackgroundDashboard,
paddingTop: "10vh",
// prevent global root styles override error color
color: theme.colors.black,
});
export const ErrorMessage = ({
error,
}: {
error: {
status: number;
statusText?: string;
message: string;
description?: string;
};
}) => {
return (
<Grid className={pageStyle()} justify={"center"} gap={6}>
<AccessibleIcon label="Logo">
<WebstudioIcon size="60" />
</AccessibleIcon>
<div />
<div />
<Text
css={{
fontSize: theme.spacing[21],
lineHeight: 1,
}}
variant={"bigTitle"}
>
{error.status}
</Text>
<Grid
css={{
justifyItems: "center",
marginInline: theme.spacing[10],
maxWidth: 600,
}}
gap={5}
>
<Grid
css={{
background: theme.colors.backgroundPanel,
padding: theme.spacing[7],
borderRadius: theme.spacing[5],
minWidth: theme.spacing[34],
}}
gap="3"
>
<Text
css={{
display: "-webkit-box",
"-webkit-line-clamp": 4,
"-webkit-box-orient": "vertical",
overflow: "hidden",
textOverflow: "ellipsis",
wordBreak: "break-word",
}}
variant="brandSectionTitle"
userSelect="text"
>
{error.message ?? error.statusText}
</Text>
{error.description && (
<Text
css={{ wordBreak: "break-word", whiteSpace: "pre-line" }}
userSelect="text"
variant="brandRegular"
>
{error.description}
</Text>
)}
</Grid>
<Link
href="/"
className={buttonStyle()}
color="contrast"
underline="none"
>
Go Home
</Link>
</Grid>
</Grid>
);
};