milestone 23 s3: convert lib/InlineError.tsx to stylex

This commit is contained in:
2026-08-12 22:19:59 +02:00
parent 73bc180c67
commit d5c4a8d978
2 changed files with 29 additions and 4 deletions
+23 -3
View File
@@ -1,6 +1,26 @@
import { useEffect, useState } from "react";
import * as stylex from "@stylexjs/stylex";
import { ApiError } from "@/lib/api";
import { focusRing } from "@/ui/classes";
import { styles as shared } from "@/ui/styles";
import { colors } from "@/ui/tokens.stylex";
const styles = stylex.create({
message: {
marginTop: "0.5rem",
fontSize: "0.875rem",
lineHeight: "1.25rem",
color: colors.danger,
},
retry: {
borderStyle: "none",
backgroundColor: "transparent",
padding: 0,
color: "inherit",
fontSize: "inherit",
fontWeight: 500,
textDecorationLine: "underline",
},
});
/**
* Inline mutation error per ruling 17: 400/409 messages verbatim, 429 with
@@ -36,12 +56,12 @@ export default function InlineError({ error, onRetry }: { error: unknown; onRetr
}
return (
<p role="alert" className="mt-2 text-sm text-red-600 dark:text-red-400">
<p role="alert" {...stylex.props(styles.message)}>
{message}
{onRetry !== undefined && (
<>
{" "}
<button type="button" onClick={onRetry} className={`font-medium underline ${focusRing}`}>
<button type="button" onClick={onRetry} {...stylex.props(styles.retry, shared.focusRing)}>
Retry
</button>
</>